netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] [0/6] Bugfixes for pasemi_mac
@ 2007-09-26 21:22 Olof Johansson
  2007-09-26 21:22 ` [PATCH] [1/6] pasemi_mac: fix build break in pasemi_mac_probe() Olof Johansson
                   ` (6 more replies)
  0 siblings, 7 replies; 11+ messages in thread
From: Olof Johansson @ 2007-09-26 21:22 UTC (permalink / raw)
  To: jgarzik; +Cc: netdev

Hi,

Following patches are for various bug fixes against current netdev-2.6.24
upstream branch. Please apply.


[PATCH] [1/6] pasemi_mac: fix build break in pasemi_mac_probe()
[PATCH] [2/6] pasemi_mac: fix build break in pasemi_mac_clean_rx()
[PATCH] [3/6] pasemi_mac: set interface speed correctly on XAUI ports
[PATCH] [4/6] pasemi_mac: flags as passed to spin_*_irqsave() should be unsigned long
[PATCH] [5/6] pasemi_mac: don't enable rx before there are buffers on the ring
[PATCH] [6/6] pasemi_mac: pass in count of buffers to replenish rx ring with


Thanks,

-Olof

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

* [PATCH] [1/6] pasemi_mac: fix build break in pasemi_mac_probe()
  2007-09-26 21:22 [PATCH] [0/6] Bugfixes for pasemi_mac Olof Johansson
@ 2007-09-26 21:22 ` Olof Johansson
  2007-09-26 21:22   ` David Miller
  2007-09-26 21:23 ` [PATCH] [2/6] pasemi_mac: fix build break in pasemi_mac_clean_rx() Olof Johansson
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 11+ messages in thread
From: Olof Johansson @ 2007-09-26 21:22 UTC (permalink / raw)
  To: jgarzik; +Cc: netdev

pasemi_mac: fix build break in pasemi_mac_probe()

Fix breakage caused by recent unification of print_mac() stuff.


Signed-off-by: Olof Johansson <olof@lixom.net>

Index: k.org/drivers/net/pasemi_mac.c
===================================================================
--- k.org.orig/drivers/net/pasemi_mac.c
+++ k.org/drivers/net/pasemi_mac.c
@@ -1155,7 +1155,7 @@ pasemi_mac_probe(struct pci_dev *pdev, c
 	struct net_device *dev;
 	struct pasemi_mac *mac;
 	int err;
-	DECLARE_MAC_BUF(mac);
+	DECLARE_MAC_BUF(mac_buf);
 
 	err = pci_enable_device(pdev);
 	if (err)
@@ -1241,7 +1241,7 @@ pasemi_mac_probe(struct pci_dev *pdev, c
 		       "hw addr %s\n",
 		       dev->name, mac->type == MAC_TYPE_GMAC ? "GMAC" : "XAUI",
 		       mac->dma_if, mac->dma_txch, mac->dma_rxch,
-		       print_mac(mac, dev->dev_addr));
+		       print_mac(mac_buf, dev->dev_addr));
 
 	return err;
 

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

* Re: [PATCH] [1/6] pasemi_mac: fix build break in pasemi_mac_probe()
  2007-09-26 21:22 ` [PATCH] [1/6] pasemi_mac: fix build break in pasemi_mac_probe() Olof Johansson
@ 2007-09-26 21:22   ` David Miller
  0 siblings, 0 replies; 11+ messages in thread
From: David Miller @ 2007-09-26 21:22 UTC (permalink / raw)
  To: olof; +Cc: jgarzik, netdev

From: Olof Johansson <olof@lixom.net>
Date: Wed, 26 Sep 2007 16:22:43 -0500

> pasemi_mac: fix build break in pasemi_mac_probe()
> 
> Fix breakage caused by recent unification of print_mac() stuff.
> 
> 
> Signed-off-by: Olof Johansson <olof@lixom.net>

This one is in net-2.6.24 already, thanks!

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

* [PATCH] [2/6] pasemi_mac: fix build break in pasemi_mac_clean_rx()
  2007-09-26 21:22 [PATCH] [0/6] Bugfixes for pasemi_mac Olof Johansson
  2007-09-26 21:22 ` [PATCH] [1/6] pasemi_mac: fix build break in pasemi_mac_probe() Olof Johansson
@ 2007-09-26 21:23 ` Olof Johansson
  2007-09-26 21:24   ` David Miller
  2007-09-26 21:23 ` [PATCH] [3/6] pasemi_mac: set interface speed correctly on XAUI ports Olof Johansson
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 11+ messages in thread
From: Olof Johansson @ 2007-09-26 21:23 UTC (permalink / raw)
  To: jgarzik; +Cc: netdev

pasemi_mac: fix build break in pasemi_mac_clean_rx()

Fix breakage caused by the unification of stats structs.


Signed-off-by: Olof Johansson <olof@lixom.net>

Index: k.org/drivers/net/pasemi_mac.c
===================================================================
--- k.org.orig/drivers/net/pasemi_mac.c
+++ k.org/drivers/net/pasemi_mac.c
@@ -530,8 +530,8 @@ static int pasemi_mac_clean_rx(struct pa
 		} else
 			skb->ip_summed = CHECKSUM_NONE;
 
-		dev->stats.rx_bytes += len;
-		dev->stats.rx_packets++;
+		mac->netdev->stats.rx_bytes += len;
+		mac->netdev->stats.rx_packets++;
 
 		skb->protocol = eth_type_trans(skb, mac->netdev);
 		netif_receive_skb(skb);

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

* [PATCH] [3/6] pasemi_mac: set interface speed correctly on XAUI ports
  2007-09-26 21:22 [PATCH] [0/6] Bugfixes for pasemi_mac Olof Johansson
  2007-09-26 21:22 ` [PATCH] [1/6] pasemi_mac: fix build break in pasemi_mac_probe() Olof Johansson
  2007-09-26 21:23 ` [PATCH] [2/6] pasemi_mac: fix build break in pasemi_mac_clean_rx() Olof Johansson
@ 2007-09-26 21:23 ` Olof Johansson
  2007-09-29  4:45   ` Jeff Garzik
  2007-09-26 21:23 ` [PATCH] [5/6] pasemi_mac: flags as passed to spin_*_irqsave() should be unsigned long Olof Johansson
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 11+ messages in thread
From: Olof Johansson @ 2007-09-26 21:23 UTC (permalink / raw)
  To: jgarzik; +Cc: netdev

pasemi_mac: set interface speed correctly on XAUI ports

Set interface speed for XAUI to 10G per default, not 1G.

Signed-off-by: Olof Johansson <olof@lixom.net>

Index: 2.6.23/drivers/net/pasemi_mac.c
===================================================================
--- 2.6.23.orig/drivers/net/pasemi_mac.c
+++ 2.6.23/drivers/net/pasemi_mac.c
@@ -794,7 +794,10 @@ static int pasemi_mac_open(struct net_de
 	flags = PAS_MAC_CFG_PCFG_S1 | PAS_MAC_CFG_PCFG_PE |
 		PAS_MAC_CFG_PCFG_PR | PAS_MAC_CFG_PCFG_CE;
 
-	flags |= PAS_MAC_CFG_PCFG_TSR_1G | PAS_MAC_CFG_PCFG_SPD_1G;
+	if (mac->type == MAC_TYPE_GMAC)
+		flags |= PAS_MAC_CFG_PCFG_TSR_1G | PAS_MAC_CFG_PCFG_SPD_1G;
+	else
+		flags |= PAS_MAC_CFG_PCFG_TSR_10G | PAS_MAC_CFG_PCFG_SPD_10G;
 
 	write_iob_reg(mac, PAS_IOB_DMA_RXCH_CFG(mac->dma_rxch),
 			   PAS_IOB_DMA_RXCH_CFG_CNTTH(0));

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

* [PATCH] [5/6] pasemi_mac: flags as passed to spin_*_irqsave() should be unsigned long
  2007-09-26 21:22 [PATCH] [0/6] Bugfixes for pasemi_mac Olof Johansson
                   ` (2 preceding siblings ...)
  2007-09-26 21:23 ` [PATCH] [3/6] pasemi_mac: set interface speed correctly on XAUI ports Olof Johansson
@ 2007-09-26 21:23 ` Olof Johansson
  2007-09-26 21:24 ` [PATCH] [5/6] pasemi_mac: don't enable rx before there are buffers on the ring Olof Johansson
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 11+ messages in thread
From: Olof Johansson @ 2007-09-26 21:23 UTC (permalink / raw)
  To: jgarzik; +Cc: netdev

pasemi_mac: flags as passed to spin_*_irqsave() should be unsigned long.

Signed-off-by: Tony Breeds <tony@bakeyournoodle.com>
Signed-off-by: Olof Johansson <olof@lixom.net>

---
Found trying to build a -rt kernel, which has a BUILD_BUG_ON(), in this
caswe.

 drivers/net/pasemi_mac.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Index: k.org/drivers/net/pasemi_mac.c
===================================================================
--- k.org.orig/drivers/net/pasemi_mac.c
+++ k.org/drivers/net/pasemi_mac.c
@@ -557,7 +557,7 @@ static int pasemi_mac_clean_tx(struct pa
 	struct pas_dma_xct_descr *dp;
 	unsigned int start, count, limit;
 	unsigned int total_count;
-	int flags;
+	unsigned long flags;
 	struct sk_buff *skbs[32];
 	dma_addr_t dmas[32];
 
@@ -978,7 +978,7 @@ static int pasemi_mac_start_tx(struct sk
 	struct pas_dma_xct_descr *dp;
 	u64 dflags, mactx, ptr;
 	dma_addr_t map;
-	int flags;
+	unsigned long flags;
 
 	dflags = XCT_MACTX_O | XCT_MACTX_ST | XCT_MACTX_SS | XCT_MACTX_CRC_PAD;
 

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

* Re: [PATCH] [2/6] pasemi_mac: fix build break in pasemi_mac_clean_rx()
  2007-09-26 21:23 ` [PATCH] [2/6] pasemi_mac: fix build break in pasemi_mac_clean_rx() Olof Johansson
@ 2007-09-26 21:24   ` David Miller
  0 siblings, 0 replies; 11+ messages in thread
From: David Miller @ 2007-09-26 21:24 UTC (permalink / raw)
  To: olof; +Cc: jgarzik, netdev

From: Olof Johansson <olof@lixom.net>
Date: Wed, 26 Sep 2007 16:23:06 -0500

> pasemi_mac: fix build break in pasemi_mac_clean_rx()
> 
> Fix breakage caused by the unification of stats structs.
> 
> 
> Signed-off-by: Olof Johansson <olof@lixom.net>

Jeff, I added this to my net-2.6.24 tree because it fixes
a regression causes by a change in my tree.

I hope you don't mind :-)  You would just push it to me
in the end anyways :))

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

* [PATCH] [5/6] pasemi_mac: don't enable rx before there are buffers on the ring
  2007-09-26 21:22 [PATCH] [0/6] Bugfixes for pasemi_mac Olof Johansson
                   ` (3 preceding siblings ...)
  2007-09-26 21:23 ` [PATCH] [5/6] pasemi_mac: flags as passed to spin_*_irqsave() should be unsigned long Olof Johansson
@ 2007-09-26 21:24 ` Olof Johansson
  2007-09-26 21:25 ` [PATCH] [6/6] pasemi_mac: pass in count of buffers to replenish rx ring with Olof Johansson
  2007-09-26 21:26 ` [PATCH] [0/6] Bugfixes for pasemi_mac David Miller
  6 siblings, 0 replies; 11+ messages in thread
From: Olof Johansson @ 2007-09-26 21:24 UTC (permalink / raw)
  To: jgarzik; +Cc: netdev

pasemi_mac: don't enable rx before there are buffers on the ring

Reorder initialization of the DMA channels and the interface. Before there
was a time window when the interface was enabled before DMA was enabled.
Also, now there will always be RX buffers available at the time the
MAC interface is enabled, to avoid temporary out-of-buffer errors for the
very first packets (on busy networks).


Signed-off-by: Olof Johansson <olof@lixom.net>


Index: 2.6.23/drivers/net/pasemi_mac.c
===================================================================
--- 2.6.23.orig/drivers/net/pasemi_mac.c
+++ 2.6.23/drivers/net/pasemi_mac.c
@@ -791,14 +791,6 @@ static int pasemi_mac_open(struct net_de
 
 	write_mac_reg(mac, PAS_MAC_CFG_TXP, flags);
 
-	flags = PAS_MAC_CFG_PCFG_S1 | PAS_MAC_CFG_PCFG_PE |
-		PAS_MAC_CFG_PCFG_PR | PAS_MAC_CFG_PCFG_CE;
-
-	if (mac->type == MAC_TYPE_GMAC)
-		flags |= PAS_MAC_CFG_PCFG_TSR_1G | PAS_MAC_CFG_PCFG_SPD_1G;
-	else
-		flags |= PAS_MAC_CFG_PCFG_TSR_10G | PAS_MAC_CFG_PCFG_SPD_10G;
-
 	write_iob_reg(mac, PAS_IOB_DMA_RXCH_CFG(mac->dma_rxch),
 			   PAS_IOB_DMA_RXCH_CFG_CNTTH(0));
 
@@ -813,8 +805,6 @@ static int pasemi_mac_open(struct net_de
 	write_iob_reg(mac, PAS_IOB_DMA_COM_TIMEOUTCFG,
 			   PAS_IOB_DMA_COM_TIMEOUTCFG_TCNT(0xffffff));
 
-	write_mac_reg(mac, PAS_MAC_CFG_PCFG, flags);
-
 	ret = pasemi_mac_setup_rx_resources(dev);
 	if (ret)
 		goto out_rx_resources;
@@ -842,6 +832,17 @@ static int pasemi_mac_open(struct net_de
 
 	pasemi_mac_replenish_rx_ring(dev);
 
+	flags = PAS_MAC_CFG_PCFG_S1 | PAS_MAC_CFG_PCFG_PE |
+		PAS_MAC_CFG_PCFG_PR | PAS_MAC_CFG_PCFG_CE;
+
+	if (mac->type == MAC_TYPE_GMAC)
+		flags |= PAS_MAC_CFG_PCFG_TSR_1G | PAS_MAC_CFG_PCFG_SPD_1G;
+	else
+		flags |= PAS_MAC_CFG_PCFG_TSR_10G | PAS_MAC_CFG_PCFG_SPD_10G;
+
+	/* Enable interface in MAC */
+	write_mac_reg(mac, PAS_MAC_CFG_PCFG, flags);
+
 	ret = pasemi_mac_phy_init(dev);
 	/* Some configs don't have PHYs (XAUI etc), so don't complain about
 	 * failed init due to -ENODEV.

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

* [PATCH] [6/6] pasemi_mac: pass in count of buffers to replenish rx ring with
  2007-09-26 21:22 [PATCH] [0/6] Bugfixes for pasemi_mac Olof Johansson
                   ` (4 preceding siblings ...)
  2007-09-26 21:24 ` [PATCH] [5/6] pasemi_mac: don't enable rx before there are buffers on the ring Olof Johansson
@ 2007-09-26 21:25 ` Olof Johansson
  2007-09-26 21:26 ` [PATCH] [0/6] Bugfixes for pasemi_mac David Miller
  6 siblings, 0 replies; 11+ messages in thread
From: Olof Johansson @ 2007-09-26 21:25 UTC (permalink / raw)
  To: jgarzik; +Cc: netdev

pasemi_mac: pass in count of buffers to replenish rx ring with

Refactor replenish_rx_ring to take an argument for how many entries to
fill. Since it's normally available from where it's called anyway, this
is just simpler. It also removes the awkward logic to try to figure out
if we're filling for the first time or not.

Signed-off-by: Olof Johansson <olof@lixom.net>

Index: k.org/drivers/net/pasemi_mac.c
===================================================================
--- k.org.orig/drivers/net/pasemi_mac.c
+++ k.org/drivers/net/pasemi_mac.c
@@ -375,23 +375,18 @@ static void pasemi_mac_free_rx_resources
 	mac->rx = NULL;
 }
 
-static void pasemi_mac_replenish_rx_ring(struct net_device *dev)
+static void pasemi_mac_replenish_rx_ring(struct net_device *dev, int limit)
 {
 	struct pasemi_mac *mac = netdev_priv(dev);
 	unsigned int i;
 	int start = mac->rx->next_to_fill;
-	unsigned int limit, count;
-
-	limit = RING_AVAIL(mac->rx);
-	/* Check to see if we're doing first-time setup */
-	if (unlikely(mac->rx->next_to_clean == 0 && mac->rx->next_to_fill == 0))
-		limit = RX_RING_SIZE;
+	int count;
 
 	if (limit <= 0)
 		return;
 
 	i = start;
-	for (count = limit; count; count--) {
+	for (count = 0; count < limit; count++) {
 		struct pasemi_mac_buffer *info = &RX_DESC_INFO(mac, i);
 		u64 *buff = &RX_BUFF(mac, i);
 		struct sk_buff *skb;
@@ -422,10 +417,10 @@ static void pasemi_mac_replenish_rx_ring
 
 	wmb();
 
-	write_dma_reg(mac, PAS_DMA_RXCHAN_INCR(mac->dma_rxch), limit - count);
-	write_dma_reg(mac, PAS_DMA_RXINT_INCR(mac->dma_if), limit - count);
+	write_dma_reg(mac, PAS_DMA_RXCHAN_INCR(mac->dma_rxch), count);
+	write_dma_reg(mac, PAS_DMA_RXINT_INCR(mac->dma_if), count);
 
-	mac->rx->next_to_fill += limit - count;
+	mac->rx->next_to_fill += count;
 }
 
 static void pasemi_mac_restart_rx_intr(struct pasemi_mac *mac)
@@ -543,7 +538,7 @@ static int pasemi_mac_clean_rx(struct pa
 	}
 
 	mac->rx->next_to_clean += limit - count;
-	pasemi_mac_replenish_rx_ring(mac->netdev);
+	pasemi_mac_replenish_rx_ring(mac->netdev, limit-count);
 
 	spin_unlock(&mac->rx->lock);
 
@@ -830,7 +825,7 @@ static int pasemi_mac_open(struct net_de
 	write_dma_reg(mac, PAS_DMA_TXCHAN_TCMDSTA(mac->dma_txch),
 			   PAS_DMA_TXCHAN_TCMDSTA_EN);
 
-	pasemi_mac_replenish_rx_ring(dev);
+	pasemi_mac_replenish_rx_ring(dev, RX_RING_SIZE);
 
 	flags = PAS_MAC_CFG_PCFG_S1 | PAS_MAC_CFG_PCFG_PE |
 		PAS_MAC_CFG_PCFG_PR | PAS_MAC_CFG_PCFG_CE;

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

* Re: [PATCH] [0/6] Bugfixes for pasemi_mac
  2007-09-26 21:22 [PATCH] [0/6] Bugfixes for pasemi_mac Olof Johansson
                   ` (5 preceding siblings ...)
  2007-09-26 21:25 ` [PATCH] [6/6] pasemi_mac: pass in count of buffers to replenish rx ring with Olof Johansson
@ 2007-09-26 21:26 ` David Miller
  6 siblings, 0 replies; 11+ messages in thread
From: David Miller @ 2007-09-26 21:26 UTC (permalink / raw)
  To: olof; +Cc: jgarzik, netdev

From: Olof Johansson <olof@lixom.net>
Date: Wed, 26 Sep 2007 16:22:00 -0500

> [PATCH] [1/6] pasemi_mac: fix build break in pasemi_mac_probe()
> [PATCH] [2/6] pasemi_mac: fix build break in pasemi_mac_clean_rx()
> [PATCH] [3/6] pasemi_mac: set interface speed correctly on XAUI ports
> [PATCH] [4/6] pasemi_mac: flags as passed to spin_*_irqsave() should be unsigned long
> [PATCH] [5/6] pasemi_mac: don't enable rx before there are buffers on the ring
> [PATCH] [6/6] pasemi_mac: pass in count of buffers to replenish rx ring with

Jeff, patches #1 and #2 are taken care of in my net-2.6.24
tree, please review and take the rest, thanks!

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

* Re: [PATCH] [3/6] pasemi_mac: set interface speed correctly on XAUI ports
  2007-09-26 21:23 ` [PATCH] [3/6] pasemi_mac: set interface speed correctly on XAUI ports Olof Johansson
@ 2007-09-29  4:45   ` Jeff Garzik
  0 siblings, 0 replies; 11+ messages in thread
From: Jeff Garzik @ 2007-09-29  4:45 UTC (permalink / raw)
  To: Olof Johansson; +Cc: netdev

Olof Johansson wrote:
> pasemi_mac: set interface speed correctly on XAUI ports
> 
> Set interface speed for XAUI to 10G per default, not 1G.
> 
> Signed-off-by: Olof Johansson <olof@lixom.net>

applied 3-6 (davem already got 1-2)



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

end of thread, other threads:[~2007-09-29  4:46 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-26 21:22 [PATCH] [0/6] Bugfixes for pasemi_mac Olof Johansson
2007-09-26 21:22 ` [PATCH] [1/6] pasemi_mac: fix build break in pasemi_mac_probe() Olof Johansson
2007-09-26 21:22   ` David Miller
2007-09-26 21:23 ` [PATCH] [2/6] pasemi_mac: fix build break in pasemi_mac_clean_rx() Olof Johansson
2007-09-26 21:24   ` David Miller
2007-09-26 21:23 ` [PATCH] [3/6] pasemi_mac: set interface speed correctly on XAUI ports Olof Johansson
2007-09-29  4:45   ` Jeff Garzik
2007-09-26 21:23 ` [PATCH] [5/6] pasemi_mac: flags as passed to spin_*_irqsave() should be unsigned long Olof Johansson
2007-09-26 21:24 ` [PATCH] [5/6] pasemi_mac: don't enable rx before there are buffers on the ring Olof Johansson
2007-09-26 21:25 ` [PATCH] [6/6] pasemi_mac: pass in count of buffers to replenish rx ring with Olof Johansson
2007-09-26 21:26 ` [PATCH] [0/6] Bugfixes for pasemi_mac David Miller

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