netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] myri10ge minor updates
@ 2007-03-07 18:58 Brice Goglin
  2007-03-07 18:59 ` [PATCH 1/4] myri10ge: fix error checking and return value in myri10ge_allocate_rings Brice Goglin
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Brice Goglin @ 2007-03-07 18:58 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: netdev

Hi Jeff,

4 small updates of myri10ge for 2.6.21 will follow this mail:
1) fix error checking and return value in myri10ge_allocate_rings
2) use pci_map_page to prepare the dmatest buffer
3) prevent 4k rdma on SGI TIOCE chipset
4) add a wc_enabled flag to myri10ge_priv

Thanks,

Brice


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/4] myri10ge: fix error checking and return value in myri10ge_allocate_rings
  2007-03-07 18:58 [PATCH 0/4] myri10ge minor updates Brice Goglin
@ 2007-03-07 18:59 ` Brice Goglin
  2007-03-09 16:52   ` Jeff Garzik
  2007-03-07 19:00 ` [PATCH 2/4] myri10ge: use pci_map_page to prepare the dmatest buffer Brice Goglin
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 6+ messages in thread
From: Brice Goglin @ 2007-03-07 18:59 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: netdev

Fix a missing error check in myri10ge_allocate_rings() and set status
to -ENOMEM before all actual allocations so that the error path returns
what it should.

Signed-off-by: Brice Goglin <brice@myri.com>
---
 drivers/net/myri10ge/myri10ge.c |    4 ++++
 1 file changed, 4 insertions(+)

Index: linux-rc/drivers/net/myri10ge/myri10ge.c
===================================================================
--- linux-rc.orig/drivers/net/myri10ge/myri10ge.c	2007-03-07 08:49:08.000000000 +0100
+++ linux-rc/drivers/net/myri10ge/myri10ge.c	2007-03-07 08:51:07.000000000 +0100
@@ -1456,6 +1456,8 @@
 	status = myri10ge_send_cmd(mgp, MXGEFW_CMD_GET_SEND_RING_SIZE, &cmd, 0);
 	tx_ring_size = cmd.data0;
 	status |= myri10ge_send_cmd(mgp, MXGEFW_CMD_GET_RX_RING_SIZE, &cmd, 0);
+	if (status != 0)
+		return status;
 	rx_ring_size = cmd.data0;
 
 	tx_ring_entries = tx_ring_size / sizeof(struct mcp_kreq_ether_send);
@@ -1463,6 +1465,8 @@
 	mgp->tx.mask = tx_ring_entries - 1;
 	mgp->rx_small.mask = mgp->rx_big.mask = rx_ring_entries - 1;
 
+	status = -ENOMEM;
+
 	/* allocate the host shadow rings */
 
 	bytes = 8 + (MYRI10GE_MAX_SEND_DESC_TSO + 4)



^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 2/4] myri10ge: use pci_map_page to prepare the dmatest buffer
  2007-03-07 18:58 [PATCH 0/4] myri10ge minor updates Brice Goglin
  2007-03-07 18:59 ` [PATCH 1/4] myri10ge: fix error checking and return value in myri10ge_allocate_rings Brice Goglin
@ 2007-03-07 19:00 ` Brice Goglin
  2007-03-07 19:01 ` [PATCH 3/4] myri10ge: prevent 4k rdma on SGI TIOCE chipset Brice Goglin
  2007-03-07 19:02 ` [PATCH 4/4] myri10ge: add a wc_enabled flag to myri10ge_priv Brice Goglin
  3 siblings, 0 replies; 6+ messages in thread
From: Brice Goglin @ 2007-03-07 19:00 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: netdev

Allocate a specific page and use pci_map_page for dma test instead
of relying on another existing buffer.

Signed-off-by: Brice Goglin <brice@myri.com>
---
 drivers/net/myri10ge/myri10ge.c |   22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)

Index: linux-rc/drivers/net/myri10ge/myri10ge.c
===================================================================
--- linux-rc.orig/drivers/net/myri10ge/myri10ge.c	2007-03-07 08:51:47.000000000 +0100
+++ linux-rc/drivers/net/myri10ge/myri10ge.c	2007-03-07 08:51:54.000000000 +0100
@@ -717,6 +717,8 @@
 	int status;
 	size_t bytes;
 	u32 len;
+	struct page *dmatest_page;
+	dma_addr_t dmatest_bus;
 
 	/* try to send a reset command to the card to see if it
 	 * is alive */
@@ -726,6 +728,11 @@
 		dev_err(&mgp->pdev->dev, "failed reset\n");
 		return -ENXIO;
 	}
+	dmatest_page = alloc_page(GFP_KERNEL);
+	if (!dmatest_page)
+		return -ENOMEM;
+	dmatest_bus = pci_map_page(mgp->pdev, dmatest_page, 0, PAGE_SIZE,
+				   DMA_BIDIRECTIONAL);
 
 	/* Now exchange information about interrupts  */
 
@@ -764,8 +771,8 @@
 
 	len = mgp->tx.boundary;
 
-	cmd.data0 = MYRI10GE_LOWPART_TO_U32(mgp->rx_done.bus);
-	cmd.data1 = MYRI10GE_HIGHPART_TO_U32(mgp->rx_done.bus);
+	cmd.data0 = MYRI10GE_LOWPART_TO_U32(dmatest_bus);
+	cmd.data1 = MYRI10GE_HIGHPART_TO_U32(dmatest_bus);
 	cmd.data2 = len * 0x10000;
 	status = myri10ge_send_cmd(mgp, MXGEFW_DMA_TEST, &cmd, 0);
 	if (status == 0)
@@ -774,8 +781,8 @@
 	else
 		dev_warn(&mgp->pdev->dev, "DMA read benchmark failed: %d\n",
 			 status);
-	cmd.data0 = MYRI10GE_LOWPART_TO_U32(mgp->rx_done.bus);
-	cmd.data1 = MYRI10GE_HIGHPART_TO_U32(mgp->rx_done.bus);
+	cmd.data0 = MYRI10GE_LOWPART_TO_U32(dmatest_bus);
+	cmd.data1 = MYRI10GE_HIGHPART_TO_U32(dmatest_bus);
 	cmd.data2 = len * 0x1;
 	status = myri10ge_send_cmd(mgp, MXGEFW_DMA_TEST, &cmd, 0);
 	if (status == 0)
@@ -785,8 +792,8 @@
 		dev_warn(&mgp->pdev->dev, "DMA write benchmark failed: %d\n",
 			 status);
 
-	cmd.data0 = MYRI10GE_LOWPART_TO_U32(mgp->rx_done.bus);
-	cmd.data1 = MYRI10GE_HIGHPART_TO_U32(mgp->rx_done.bus);
+	cmd.data0 = MYRI10GE_LOWPART_TO_U32(dmatest_bus);
+	cmd.data1 = MYRI10GE_HIGHPART_TO_U32(dmatest_bus);
 	cmd.data2 = len * 0x10001;
 	status = myri10ge_send_cmd(mgp, MXGEFW_DMA_TEST, &cmd, 0);
 	if (status == 0)
@@ -796,6 +803,9 @@
 		dev_warn(&mgp->pdev->dev,
 			 "DMA read/write benchmark failed: %d\n", status);
 
+	pci_unmap_page(mgp->pdev, dmatest_bus, PAGE_SIZE, DMA_BIDIRECTIONAL);
+	put_page(dmatest_page);
+
 	memset(mgp->rx_done.entry, 0, bytes);
 
 	/* reset mcp/driver shared state back to 0 */



^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 3/4] myri10ge: prevent 4k rdma on SGI TIOCE chipset
  2007-03-07 18:58 [PATCH 0/4] myri10ge minor updates Brice Goglin
  2007-03-07 18:59 ` [PATCH 1/4] myri10ge: fix error checking and return value in myri10ge_allocate_rings Brice Goglin
  2007-03-07 19:00 ` [PATCH 2/4] myri10ge: use pci_map_page to prepare the dmatest buffer Brice Goglin
@ 2007-03-07 19:01 ` Brice Goglin
  2007-03-07 19:02 ` [PATCH 4/4] myri10ge: add a wc_enabled flag to myri10ge_priv Brice Goglin
  3 siblings, 0 replies; 6+ messages in thread
From: Brice Goglin @ 2007-03-07 19:01 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: netdev

Do not use 4k rdma request on SGI TIOCE chipset since this
bridge does not support it.

Signed-off-by: Brice Goglin <brice@myri.com>
---
 drivers/net/myri10ge/myri10ge.c |    6 ++++++
 1 file changed, 6 insertions(+)

Index: linux-rc/drivers/net/myri10ge/myri10ge.c
===================================================================
--- linux-rc.orig/drivers/net/myri10ge/myri10ge.c	2007-03-07 08:51:07.000000000 +0100
+++ linux-rc/drivers/net/myri10ge/myri10ge.c	2007-03-07 08:51:47.000000000 +0100
@@ -2514,6 +2514,12 @@
 				 bridge->vendor, bridge->device);
 			mgp->tx.boundary = 4096;
 			mgp->fw_name = myri10ge_fw_aligned;
+		} else if (bridge &&
+			   bridge->vendor == PCI_VENDOR_ID_SGI &&
+			   bridge->device == 0x4002 /* TIOCE pcie-port */ ) {
+			/* this pcie bridge does not support 4K rdma request */
+			mgp->tx.boundary = 2048;
+			mgp->fw_name = myri10ge_fw_aligned;
 		}
 	} else {
 		if (myri10ge_force_firmware == 1) {



^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 4/4] myri10ge: add a wc_enabled flag to myri10ge_priv
  2007-03-07 18:58 [PATCH 0/4] myri10ge minor updates Brice Goglin
                   ` (2 preceding siblings ...)
  2007-03-07 19:01 ` [PATCH 3/4] myri10ge: prevent 4k rdma on SGI TIOCE chipset Brice Goglin
@ 2007-03-07 19:02 ` Brice Goglin
  3 siblings, 0 replies; 6+ messages in thread
From: Brice Goglin @ 2007-03-07 19:02 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: netdev

Add a wc_enabled flag in the myri10ge_priv instead of relying
on mtrr >= 0.

Signed-off-by: Brice Goglin <brice@myri.com>
---
 drivers/net/myri10ge/myri10ge.c |   10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

Index: linux-rc/drivers/net/myri10ge/myri10ge.c
===================================================================
--- linux-rc.orig/drivers/net/myri10ge/myri10ge.c	2007-03-07 08:51:54.000000000 +0100
+++ linux-rc/drivers/net/myri10ge/myri10ge.c	2007-03-07 19:49:37.000000000 +0100
@@ -181,6 +181,7 @@
 	int intr_coal_delay;
 	__be32 __iomem *intr_coal_delay_ptr;
 	int mtrr;
+	int wc_enabled;
 	int wake_queue;
 	int stop_queue;
 	int down_cnt;
@@ -1385,7 +1386,7 @@
 		data[i] = ((unsigned long *)&mgp->stats)[i];
 
 	data[i++] = (unsigned int)mgp->tx.boundary;
-	data[i++] = (unsigned int)(mgp->mtrr >= 0);
+	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->read_dma;
@@ -1749,7 +1750,7 @@
 		goto abort_with_irq;
 	}
 
-	if (myri10ge_wcfifo && mgp->mtrr >= 0) {
+	if (myri10ge_wcfifo && mgp->wc_enabled) {
 		mgp->tx.wc_fifo = (u8 __iomem *) mgp->sram + MXGEFW_ETH_SEND_4;
 		mgp->rx_small.wc_fifo =
 		    (u8 __iomem *) mgp->sram + MXGEFW_ETH_RECV_SMALL;
@@ -2850,9 +2851,12 @@
 	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
 	/* Hack.  need to get rid of these magic numbers */
 	mgp->sram_size =
@@ -2947,7 +2951,7 @@
 	dev_info(dev, "%s IRQ %d, tx bndry %d, fw %s, WC %s\n",
 		 (mgp->msi_enabled ? "MSI" : "xPIC"),
 		 netdev->irq, mgp->tx.boundary, mgp->fw_name,
-		 (mgp->mtrr >= 0 ? "Enabled" : "Disabled"));
+		 (mgp->wc_enabled ? "Enabled" : "Disabled"));
 
 	return 0;
 



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/4] myri10ge: fix error checking and return value in myri10ge_allocate_rings
  2007-03-07 18:59 ` [PATCH 1/4] myri10ge: fix error checking and return value in myri10ge_allocate_rings Brice Goglin
@ 2007-03-09 16:52   ` Jeff Garzik
  0 siblings, 0 replies; 6+ messages in thread
From: Jeff Garzik @ 2007-03-09 16:52 UTC (permalink / raw)
  To: Brice Goglin; +Cc: netdev

Brice Goglin wrote:
> Fix a missing error check in myri10ge_allocate_rings() and set status
> to -ENOMEM before all actual allocations so that the error path returns
> what it should.
> 
> Signed-off-by: Brice Goglin <brice@myri.com>
> ---
>  drivers/net/myri10ge/myri10ge.c |    4 ++++
>  1 file changed, 4 insertions(+)

applied 1-4



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2007-03-09 16:52 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-07 18:58 [PATCH 0/4] myri10ge minor updates Brice Goglin
2007-03-07 18:59 ` [PATCH 1/4] myri10ge: fix error checking and return value in myri10ge_allocate_rings Brice Goglin
2007-03-09 16:52   ` Jeff Garzik
2007-03-07 19:00 ` [PATCH 2/4] myri10ge: use pci_map_page to prepare the dmatest buffer Brice Goglin
2007-03-07 19:01 ` [PATCH 3/4] myri10ge: prevent 4k rdma on SGI TIOCE chipset Brice Goglin
2007-03-07 19:02 ` [PATCH 4/4] myri10ge: add a wc_enabled flag to myri10ge_priv Brice Goglin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).