All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] net: calxedaxgmac: fix rx ring handling when OOM
@ 2013-03-28 21:32 Rob Herring
  2013-03-28 21:32 ` [PATCH 2/2] net: calxedaxgmac: Wake-on-LAN fixes Rob Herring
  2013-03-29 19:29 ` [PATCH 1/2] net: calxedaxgmac: fix rx ring handling when OOM David Miller
  0 siblings, 2 replies; 4+ messages in thread
From: Rob Herring @ 2013-03-28 21:32 UTC (permalink / raw)
  To: linux-kernel, netdev; +Cc: David S. Miller, Rob Herring

From: Rob Herring <rob.herring@calxeda.com>

If skb allocation for the rx ring fails repeatedly, we can reach a point
were the ring is empty. In this condition, the driver is out of sync with
the h/w. While this has always been possible, the removal of the skb
recycling seems to have made triggering this problem easier.

Signed-off-by: Rob Herring <rob.herring@calxeda.com>
---
 drivers/net/ethernet/calxeda/xgmac.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/ethernet/calxeda/xgmac.c b/drivers/net/ethernet/calxeda/xgmac.c
index a170065..bb1e80b 100644
--- a/drivers/net/ethernet/calxeda/xgmac.c
+++ b/drivers/net/ethernet/calxeda/xgmac.c
@@ -1141,6 +1141,9 @@ static int xgmac_rx(struct xgmac_priv *priv, int limit)
 		struct sk_buff *skb;
 		int frame_len;
 
+		if (!dma_ring_cnt(priv->rx_head, priv->rx_tail, DMA_RX_RING_SZ))
+			break;
+
 		entry = priv->rx_tail;
 		p = priv->dma_rx + entry;
 		if (desc_get_owner(p))
-- 
1.7.10.4


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

* [PATCH 2/2] net: calxedaxgmac: Wake-on-LAN fixes
  2013-03-28 21:32 [PATCH 1/2] net: calxedaxgmac: fix rx ring handling when OOM Rob Herring
@ 2013-03-28 21:32 ` Rob Herring
  2013-03-29 19:30   ` David Miller
  2013-03-29 19:29 ` [PATCH 1/2] net: calxedaxgmac: fix rx ring handling when OOM David Miller
  1 sibling, 1 reply; 4+ messages in thread
From: Rob Herring @ 2013-03-28 21:32 UTC (permalink / raw)
  To: linux-kernel, netdev; +Cc: David S. Miller, Rob Herring

From: Rob Herring <rob.herring@calxeda.com>

WOL is broken because the magic packet status bit is getting set rather
than the enable bit. The PMT interrupt is not getting serviced because
the PMT interrupt is also enabled on the global interrupt, but not
cleared by the global interrupt and the global interrupt is higher
priority. This fixes both of these issues to get WOL working.

There's still a problem with receive after resume, but at least now we
can wake-up.

Signed-off-by: Rob Herring <rob.herring@calxeda.com>
---
 drivers/net/ethernet/calxeda/xgmac.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/calxeda/xgmac.c b/drivers/net/ethernet/calxeda/xgmac.c
index bb1e80b..b0ebc9f 100644
--- a/drivers/net/ethernet/calxeda/xgmac.c
+++ b/drivers/net/ethernet/calxeda/xgmac.c
@@ -163,6 +163,7 @@
 #define XGMAC_FLOW_CTRL_FCB_BPA	0x00000001	/* Flow Control Busy ... */
 
 /* XGMAC_INT_STAT reg */
+#define XGMAC_INT_STAT_PMTIM	0x00800000	/* PMT Interrupt Mask */
 #define XGMAC_INT_STAT_PMT	0x0080		/* PMT Interrupt Status */
 #define XGMAC_INT_STAT_LPI	0x0040		/* LPI Interrupt Status */
 
@@ -960,6 +961,9 @@ static int xgmac_hw_init(struct net_device *dev)
 	writel(DMA_INTR_DEFAULT_MASK, ioaddr + XGMAC_DMA_STATUS);
 	writel(DMA_INTR_DEFAULT_MASK, ioaddr + XGMAC_DMA_INTR_ENA);
 
+	/* Mask power mgt interrupt */
+	writel(XGMAC_INT_STAT_PMTIM, ioaddr + XGMAC_INT_STAT);
+
 	/* XGMAC requires AXI bus init. This is a 'magic number' for now */
 	writel(0x0077000E, ioaddr + XGMAC_DMA_AXI_BUS);
 
@@ -1828,7 +1832,7 @@ static void xgmac_pmt(void __iomem *ioaddr, unsigned long mode)
 	unsigned int pmt = 0;
 
 	if (mode & WAKE_MAGIC)
-		pmt |= XGMAC_PMT_POWERDOWN | XGMAC_PMT_MAGIC_PKT;
+		pmt |= XGMAC_PMT_POWERDOWN | XGMAC_PMT_MAGIC_PKT_EN;
 	if (mode & WAKE_UCAST)
 		pmt |= XGMAC_PMT_POWERDOWN | XGMAC_PMT_GLBL_UNICAST;
 
-- 
1.7.10.4


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

* Re: [PATCH 1/2] net: calxedaxgmac: fix rx ring handling when OOM
  2013-03-28 21:32 [PATCH 1/2] net: calxedaxgmac: fix rx ring handling when OOM Rob Herring
  2013-03-28 21:32 ` [PATCH 2/2] net: calxedaxgmac: Wake-on-LAN fixes Rob Herring
@ 2013-03-29 19:29 ` David Miller
  1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2013-03-29 19:29 UTC (permalink / raw)
  To: robherring2; +Cc: linux-kernel, netdev, rob.herring

From: Rob Herring <robherring2@gmail.com>
Date: Thu, 28 Mar 2013 16:32:44 -0500

> From: Rob Herring <rob.herring@calxeda.com>
> 
> If skb allocation for the rx ring fails repeatedly, we can reach a point
> were the ring is empty. In this condition, the driver is out of sync with
> the h/w. While this has always been possible, the removal of the skb
> recycling seems to have made triggering this problem easier.
> 
> Signed-off-by: Rob Herring <rob.herring@calxeda.com>

Applied.

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

* Re: [PATCH 2/2] net: calxedaxgmac: Wake-on-LAN fixes
  2013-03-28 21:32 ` [PATCH 2/2] net: calxedaxgmac: Wake-on-LAN fixes Rob Herring
@ 2013-03-29 19:30   ` David Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2013-03-29 19:30 UTC (permalink / raw)
  To: robherring2; +Cc: linux-kernel, netdev, rob.herring

From: Rob Herring <robherring2@gmail.com>
Date: Thu, 28 Mar 2013 16:32:45 -0500

> From: Rob Herring <rob.herring@calxeda.com>
> 
> WOL is broken because the magic packet status bit is getting set rather
> than the enable bit. The PMT interrupt is not getting serviced because
> the PMT interrupt is also enabled on the global interrupt, but not
> cleared by the global interrupt and the global interrupt is higher
> priority. This fixes both of these issues to get WOL working.
> 
> There's still a problem with receive after resume, but at least now we
> can wake-up.
> 
> Signed-off-by: Rob Herring <rob.herring@calxeda.com>

Applied.

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

end of thread, other threads:[~2013-03-29 19:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-28 21:32 [PATCH 1/2] net: calxedaxgmac: fix rx ring handling when OOM Rob Herring
2013-03-28 21:32 ` [PATCH 2/2] net: calxedaxgmac: Wake-on-LAN fixes Rob Herring
2013-03-29 19:30   ` David Miller
2013-03-29 19:29 ` [PATCH 1/2] net: calxedaxgmac: fix rx ring handling when OOM David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.