2015-04-21 20:09:58

by Luis Chamberlain

[permalink] [raw]
Subject: [PATCH v3] ethernet: myri10ge: use arch_phys_wc_add()

From: "Luis R. Rodriguez" <[email protected]>

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 <[email protected]>
Cc: Andy Lutomirski <[email protected]>
Cc: Suresh Siddha <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: Juergen Gross <[email protected]>
Cc: Daniel Vetter <[email protected]>
Cc: [email protected]
Cc: Juergen Gross <[email protected]>
Cc: Daniel Vetter <[email protected]>
Cc: Andy Lutomirski <[email protected]>
Cc: Dave Airlie <[email protected]>
Cc: Antonino Daplas <[email protected]>
Cc: Jean-Christophe Plagniol-Villard <[email protected]>
Cc: Tomi Valkeinen <[email protected]>
Cc: [email protected]
Cc: [email protected]
Signed-off-by: Luis R. Rodriguez <[email protected]>
---
drivers/net/ethernet/myricom/myri10ge/myri10ge.c | 38 ++++++------------------
1 file changed, 9 insertions(+), 29 deletions(-)

diff --git a/drivers/net/ethernet/myricom/myri10ge/myri10ge.c b/drivers/net/ethernet/myricom/myri10ge/myri10ge.c
index 1412f5a..2bae502 100644
--- a/drivers/net/ethernet/myricom/myri10ge/myri10ge.c
+++ b/drivers/net/ethernet/myricom/myri10ge/myri10ge.c
@@ -69,11 +69,7 @@
#include <net/ip.h>
#include <net/tcp.h>
#include <asm/byteorder.h>
-#include <asm/io.h>
#include <asm/processor.h>
-#ifdef CONFIG_MTRR
-#include <asm/mtrr.h>
-#endif
#include <net/busy_poll.h>

#include "myri10ge_mcp.h"
@@ -242,8 +238,7 @@ struct myri10ge_priv {
unsigned int rdma_tags_available;
int intr_coal_delay;
__be32 __iomem *intr_coal_delay_ptr;
- int mtrr;
- int wc_enabled;
+ int wc_cookie;
int down_cnt;
wait_queue_head_t down_wq;
struct work_struct watchdog_work;
@@ -1905,7 +1900,7 @@ static const char myri10ge_gstrings_main_stats[][ETH_GSTRING_LEN] = {
"tx_aborted_errors", "tx_carrier_errors", "tx_fifo_errors",
"tx_heartbeat_errors", "tx_window_errors",
/* 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",
"serial_number", "watchdog_resets",
#ifdef CONFIG_MYRI10GE_DCA
@@ -1984,7 +1979,6 @@ myri10ge_get_ethtool_stats(struct net_device *netdev,
data[i] = ((u64 *)&link_stats)[i];

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->msi_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)

mgp->board_span = pci_resource_len(pdev, 0);
mgp->iomem_base = pci_resource_start(pdev, 0);
- mgp->mtrr = -1;
- 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->wc_cookie = arch_phys_wc_add(mgp->iomem_base, mgp->board_span);
mgp->sram = ioremap_wc(mgp->iomem_base, mgp->board_span);
if (mgp->sram == NULL) {
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)
goto abort_with_state;
}
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->wc_enabled ? "Enabled" : "Disabled"));
+ (mgp->wc_cookie > 0 ? "Enabled" : "Disabled"));
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",
pdev->irq, mgp->tx_boundary, mgp->fw_name,
- (mgp->wc_enabled ? "Enabled" : "Disabled"));
+ (mgp->wc_cookie > 0 ? "Enabled" : "Disabled"));

board_number++;
return 0;
@@ -4175,10 +4162,7 @@ abort_with_ioremap:
iounmap(mgp->sram);

abort_with_mtrr:
-#ifdef CONFIG_MTRR
- if (mgp->mtrr >= 0)
- mtrr_del(mgp->mtrr, mgp->iomem_base, mgp->board_span);
-#endif
+ arch_phys_wc_del(mgp->wc_cookie);
dma_free_coherent(&pdev->dev, sizeof(*mgp->cmd),
mgp->cmd, mgp->cmd_bus);

@@ -4220,11 +4204,7 @@ static void myri10ge_remove(struct pci_dev *pdev)
pci_restore_state(pdev);

iounmap(mgp->sram);
-
-#ifdef CONFIG_MTRR
- if (mgp->mtrr >= 0)
- mtrr_del(mgp->mtrr, mgp->iomem_base, mgp->board_span);
-#endif
+ arch_phys_wc_del(mgp->wc_cookie);
myri10ge_free_slices(mgp);
kfree(mgp->msix_vectors);
dma_free_coherent(&pdev->dev, sizeof(*mgp->cmd),
--
2.3.2.209.gd67f9d5.dirty


2015-04-21 21:48:20

by David Miller

[permalink] [raw]
Subject: Re: [PATCH v3] ethernet: myri10ge: use arch_phys_wc_add()

From: "Luis R. Rodriguez" <[email protected]>
Date: Tue, 21 Apr 2015 13:09:45 -0700

> From: "Luis R. Rodriguez" <[email protected]>
>
> This driver already uses ioremap_wc() on the same range
> so when write-combining is available that will be used
> instead.
...
> Signed-off-by: Luis R. Rodriguez <[email protected]>

I'll apply this with a driver maintainer's ACK.

2015-04-22 07:16:12

by Hyong-Youb Kim

[permalink] [raw]
Subject: Re: [PATCH v3] ethernet: myri10ge: use arch_phys_wc_add()

On Tue, Apr 21, 2015 at 01:09:45PM -0700, Luis R. Rodriguez wrote:
> From: "Luis R. Rodriguez" <[email protected]>
>
> This driver already uses ioremap_wc() on the same range
> so when write-combining is available that will be used
> instead.
[...]
> Signed-off-by: Luis R. Rodriguez <[email protected]>

Tested using the patched v4.0. It works fine. Thanks.

2015-04-23 18:28:46

by David Miller

[permalink] [raw]
Subject: Re: [PATCH v3] ethernet: myri10ge: use arch_phys_wc_add()

From: "Luis R. Rodriguez" <[email protected]>
Date: Tue, 21 Apr 2015 13:09:45 -0700

> From: "Luis R. Rodriguez" <[email protected]>
>
> This driver already uses ioremap_wc() on the same range
> so when write-combining is available that will be used
> instead.
>
...
> Signed-off-by: Luis R. Rodriguez <[email protected]>

I can't wait forever for the driver maintainers to review this, so
I'm applying it.

Thanks Luis.

2015-04-24 01:58:59

by Hyong-Youb Kim

[permalink] [raw]
Subject: Re: [PATCH v3] ethernet: myri10ge: use arch_phys_wc_add()

On Thu, Apr 23, 2015 at 02:28:40PM -0400, David Miller wrote:
> I can't wait forever for the driver maintainers to review this, so
> I'm applying it.

FWIW, I replied to Luis's patch yesterday. It appears on the netdev
list and patchwork. Checked the recipient list, and it includes
netdev, but not your address. I guess I will not make that mistake
again.

https://patchwork.ozlabs.org/patch/463481/

2015-04-24 02:35:13

by David Miller

[permalink] [raw]
Subject: Re: [PATCH v3] ethernet: myri10ge: use arch_phys_wc_add()

From: Hyong-Youb Kim <[email protected]>
Date: Fri, 24 Apr 2015 10:57:58 +0900

> X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Apr 2015 01:58:46.2847 (UTC)
> X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted
> X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB5PR05MB1302
> X-Greylist: Default is to whitelist mail, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Thu, 23 Apr 2015 18:58:55 -0700 (PDT)
> Content-Type: text/plain; charset="us-ascii"
> Content-Disposition: inline
> Subject: Re: [PATCH v3] ethernet: myri10ge: use arch_phys_wc_add()
> From: Hyong-Youb Kim <[email protected]>
> To: David Miller <[email protected]>
> CC: <[email protected]>, <[email protected]>, <[email protected]>,
> <[email protected]>, <[email protected]>, <[email protected]>,
> <[email protected]>, <[email protected]>, <[email protected]>,
> <[email protected]>, <[email protected]>, <[email protected]>,
> <[email protected]>, <[email protected]>,
> <[email protected]>
> Date: Fri, 24 Apr 2015 10:57:58 +0900
> User-Agent: Mutt/1.5.23 (2014-03-12)
>
> On Thu, Apr 23, 2015 at 02:28:40PM -0400, David Miller wrote:
>> I can't wait forever for the driver maintainers to review this, so
>> I'm applying it.
>
> FWIW, I replied to Luis's patch yesterday. It appears on the netdev
> list and patchwork. Checked the recipient list, and it includes
> netdev, but not your address. I guess I will not make that mistake
> again.

I saw it.

You did not supply an Acked-by: or Tested-by: tag in that response.

Also, if you are not going to use the email address listed in the
MAINTAINERS entry for this driver, you should update it so I know
what email addresses to look for to know if someone is responsible
for that driver or not.

Thanks.