* [PATCH net 1/2] net: systemport: enable RX interrupts after NAPI
2014-10-28 18:11 [PATCH net 0/2] net: systemport: RX path and suspend fixes Florian Fainelli
@ 2014-10-28 18:12 ` Florian Fainelli
2014-10-28 18:12 ` [PATCH net 2/2] net: systemport: reset UniMAC coming out of a suspend cycle Florian Fainelli
2014-10-28 21:11 ` [PATCH net 0/2] net: systemport: RX path and suspend fixes David Miller
2 siblings, 0 replies; 4+ messages in thread
From: Florian Fainelli @ 2014-10-28 18:12 UTC (permalink / raw)
To: netdev; +Cc: davem, Florian Fainelli
There is currently a small window during which the SYSTEMPORT adapter
enables its RX interrupts without having enabled its NAPI handler, which
can result in packets to be discarded during interface bringup.
A similar but more serious window exists in bcm_sysport_resume() during
which we can have the RDMA engine not fully prepared to receive packets
and yet having RX interrupts enabled.
Fix this my moving the RX interrupt enable down to
bcm_sysport_netif_start() after napi_enable() for the RX path is called,
which fixes both call sites: bcm_sysport_open() and
bcm_sysport_resume().
Fixes: b02e6d9ba7ad ("net: systemport: add bcm_sysport_netif_{enable,stop}")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/net/ethernet/broadcom/bcmsysport.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c
index 9ae36979bdee..7dce91189e51 100644
--- a/drivers/net/ethernet/broadcom/bcmsysport.c
+++ b/drivers/net/ethernet/broadcom/bcmsysport.c
@@ -1397,6 +1397,9 @@ static void bcm_sysport_netif_start(struct net_device *dev)
/* Enable NAPI */
napi_enable(&priv->napi);
+ /* Enable RX interrupt and TX ring full interrupt */
+ intrl2_0_mask_clear(priv, INTRL2_0_RDMA_MBDONE | INTRL2_0_TX_RING_FULL);
+
phy_start(priv->phydev);
/* Enable TX interrupts for the 32 TXQs */
@@ -1499,9 +1502,6 @@ static int bcm_sysport_open(struct net_device *dev)
if (ret)
goto out_free_rx_ring;
- /* Enable RX interrupt and TX ring full interrupt */
- intrl2_0_mask_clear(priv, INTRL2_0_RDMA_MBDONE | INTRL2_0_TX_RING_FULL);
-
/* Turn on TDMA */
ret = tdma_enable_set(priv, 1);
if (ret)
@@ -1885,9 +1885,6 @@ static int bcm_sysport_resume(struct device *d)
netif_device_attach(dev);
- /* Enable RX interrupt and TX ring full interrupt */
- intrl2_0_mask_clear(priv, INTRL2_0_RDMA_MBDONE | INTRL2_0_TX_RING_FULL);
-
/* RX pipe enable */
topctrl_writel(priv, 0, RX_FLUSH_CNTL);
--
1.9.1
^ permalink raw reply related [flat|nested] 4+ messages in thread* [PATCH net 2/2] net: systemport: reset UniMAC coming out of a suspend cycle
2014-10-28 18:11 [PATCH net 0/2] net: systemport: RX path and suspend fixes Florian Fainelli
2014-10-28 18:12 ` [PATCH net 1/2] net: systemport: enable RX interrupts after NAPI Florian Fainelli
@ 2014-10-28 18:12 ` Florian Fainelli
2014-10-28 21:11 ` [PATCH net 0/2] net: systemport: RX path and suspend fixes David Miller
2 siblings, 0 replies; 4+ messages in thread
From: Florian Fainelli @ 2014-10-28 18:12 UTC (permalink / raw)
To: netdev; +Cc: davem, Florian Fainelli
bcm_sysport_resume() was missing an UniMAC reset which can lead to
various receive FIFO corruptions coming out of a suspend cycle. If the
RX FIFO is stuck, it will deliver corrupted/duplicate packets towards
the host CPU interface.
This could be reproduced on crowded network and when Wake-on-LAN is
enabled for this particular interface because the switch still forwards
packets towards the host CPU interface (SYSTEMPORT), and we had to leave
the UniMAC RX enable bit on to allow matching MagicPackets.
Once we re-enter the resume function, there is a small window during
which the UniMAC receive is still enabled, and we start queueing
packets, but the RDMA and RBUF engines are not ready, which leads to
having packets stuck in the UniMAC RX FIFO, ultimately delivered towards
the host CPU as corrupted.
Fixes: 40755a0fce17 ("net: systemport: add suspend and resume support")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/net/ethernet/broadcom/bcmsysport.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c
index 7dce91189e51..3a6778a667f4 100644
--- a/drivers/net/ethernet/broadcom/bcmsysport.c
+++ b/drivers/net/ethernet/broadcom/bcmsysport.c
@@ -1858,6 +1858,8 @@ static int bcm_sysport_resume(struct device *d)
if (!netif_running(dev))
return 0;
+ umac_reset(priv);
+
/* We may have been suspended and never received a WOL event that
* would turn off MPD detection, take care of that now
*/
--
1.9.1
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH net 0/2] net: systemport: RX path and suspend fixes
2014-10-28 18:11 [PATCH net 0/2] net: systemport: RX path and suspend fixes Florian Fainelli
2014-10-28 18:12 ` [PATCH net 1/2] net: systemport: enable RX interrupts after NAPI Florian Fainelli
2014-10-28 18:12 ` [PATCH net 2/2] net: systemport: reset UniMAC coming out of a suspend cycle Florian Fainelli
@ 2014-10-28 21:11 ` David Miller
2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2014-10-28 21:11 UTC (permalink / raw)
To: f.fainelli; +Cc: netdev
From: Florian Fainelli <f.fainelli@gmail.com>
Date: Tue, 28 Oct 2014 11:11:59 -0700
> These two patches fix a race condition where we have our RX interrupts
> enabled, but not NAPI for the RX path, and the second patch fixes an
> issue for packets stuck in RX fifo during a suspend/resume cycle.
Series applied, thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread