net: bcmgenet & systemport fixes
Subsystems (4)
v2 cover net: bcmgenet & systemport fixes
Hi David,
This patch series fixes an off-by-one error introduced during a previous change, and the two other fixes fix a wake depth imbalance situation for the Wake-on-LAN interrupt line.
Thanks!
Florian Fainelli (3):
net: bcmgenet: fix off-by-one in incrementing read pointer
net: bcmgenet: avoid unbalanced enable_irq_wake calls
net: systemport: avoid unbalanced enable_irq_wake calls
drivers/net/ethernet/broadcom/bcmsysport.c | 3 ++- drivers/net/ethernet/broadcom/genet/bcmgenet.c | 9 ++++----- drivers/net/ethernet/broadcom/genet/bcmgenet_wol.c | 4 +++- 3 files changed, 9 insertions(+), 7 deletions(-)
Signature · 1 line
1.9.1
PATCH v2 1/3 net: bcmgenet: fix off-by-one in incrementing read pointer
Commit b629be5c8399d7c423b92135eb43a86c924d1cbc ("net: bcmgenet: check harder for out of memory conditions") moved the increment of the local read pointer *before* reading from the hardware descriptor using dmadesc_get_length_status(), which creates an off-by-one situation.
Fix this by moving again the read_ptr increment after we have read the hardware descriptor to get both the control block and the read pointer back in sync.
---
Changes in v2:
- moved the rxpktprocessed and rx_read_ptr increment after refiling the control block
drivers/net/ethernet/broadcom/genet/bcmgenet.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/net/ethernet/broadcom/genet/bcmgenet.c +4 -5
@@ -1285,11 +1285,6 @@ static unsigned int bcmgenet_desc_rx(struct bcmgenet_priv *priv, cb = &priv->rx_cbs[priv->rx_read_ptr]; skb = cb->skb; - rxpktprocessed++; - - priv->rx_read_ptr++; - priv->rx_read_ptr &= (priv->num_rx_bds -1 ); -/* We do not have a backing SKB, so we do not have a * corresponding DMA mapping for this incoming packet since * bcmgenet_rx_refill always either has both skb and mapping or
@@ -1404,6 +1399,10 @@ refill: err =bcmgenet_rx_refill (priv, cb);if (err)netif_err (priv, rx_err, dev,"Rx refill failed\n" ); + + rxpktprocessed++; + priv->rx_read_ptr++; + priv->rx_read_ptr &= (priv->num_rx_bds -1 ); }return rxpktprocessed;
Signature · 1 line
1.9.1
Re: [PATCH net v2 1/3] net: bcmgenet: fix off-by-one in incrementing read pointer
Looks good to me.
Quoted 5 lines · Florian Fainelli
Commit
b629be5c8399d7c423b92135eb43a86c924d1cbc("net: bcmgenet: check harder for out of memory conditions") moved the increment of the local read pointer *before* reading from the hardware descriptor usingdmadesc_get_length_status(), which creates an off-by-one situation.
Quoted 7 lines
Fix this by moving again the
read_ptrincrement after we have read the hardware descriptor to get both the control block and the read pointer back in sync.Fixes b629be5c8399 ("net: bcmgenet: check harder for out of memory conditions")Signed-off-by Jaedon Shin <[email protected]>Signed-off-by Florian Fainelli <[email protected]>
Quoted 38 lines
---
Changes in v2:
- moved the rxpktprocessed andrx_read_ptrincrement after refiling the control blockdrivers/net/ethernet/broadcom/genet/bcmgenet.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)drivers/net/ethernet/broadcom/genet/bcmgenet.c +4
-6@@ -1285,11 +1285,6 @@ static unsigned int bcmgenet_desc_rx(struct bcmgenet_priv *priv, cb = &priv->rx_cbs[priv->rx_read_ptr]; skb = cb->skb; - rxpktprocessed++; - - priv->rx_read_ptr++; - priv->rx_read_ptr &= (priv->num_rx_bds -1 ); -/* We do not have a backing SKB, so we do not have a * corresponding DMA mapping for this incoming packet since * bcmgenet_rx_refill always either has both skb and mapping or @@ -1404,6 +1399,10 @@ refill: err =bcmgenet_rx_refill (priv, cb);if (err)netif_err (priv, rx_err, dev,"Rx refill failed\n" ); + + rxpktprocessed++; + priv->rx_read_ptr++; + priv->rx_read_ptr &= (priv->num_rx_bds -1 ); }return rxpktprocessed; --1.9.1
PATCH v2 2/3 net: bcmgenet: avoid unbalanced enable_irq_wake calls
In reply to Florian FainelliMultiple enable_irq_wake() calls will keep increasing the IRQ wake_depth, which ultimately leads to the following types of situation:
1) enable Wake-on-LAN interrupt w/o password
2) enable Wake-on-LAN interrupt w/ password
3) enable Wake-on-LAN interrupt w/o password
4) disable Wake-on-LAN interrupt
After step 4), GENET would always wake-up the system no matter what wake-up device we use, which is not what we want. Fix this by making sure there are no unbalanced enable_irq_wake() calls.
--- drivers/net/ethernet/broadcom/genet/bcmgenet_wol.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/broadcom/genet/bcmgenet_wol.c +3 -1
@@ -86,7 +86,9 @@ int bcmgenet_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)/* Flag the device and relevant IRQ as wakeup capable */ if (wol->wolopts) {device_set_wakeup_enable (kdev,1 ); -enable_irq_wake (priv->wol_irq); +/* Avoid unbalanced enable_irq_wake calls */ +if (priv->wol_irq_disabled) +enable_irq_wake (priv->wol_irq); priv->wol_irq_disabled = false; }else {device_set_wakeup_enable (kdev,0 );
Signature · 1 line
1.9.1
PATCH v2 3/3 net: systemport: avoid unbalanced enable_irq_wake calls
In reply to Florian FainelliMultiple enable_irq_wake() calls will keep increasing the IRQ wake_depth, which ultimately leads to the following types of situation:
1) enable Wake-on-LAN interrupt w/o password
2) enable Wake-on-LAN interrupt w/ password
3) enable Wake-on-LAN interrupt w/o password
4) disable Wake-on-LAN interrupt
After step 4), SYSTEMPORT would always wake-up the system no matter what wake-up device we use, which is not what we want. Fix this by making sure there are no unbalanced enable_irq_wake() calls.
--- drivers/net/ethernet/broadcom/bcmsysport.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/broadcom/bcmsysport.c +2 -1
@@ -436,7 +436,8 @@ static int bcm_sysport_set_wol(struct net_device *dev,/* Flag the device and relevant IRQ as wakeup capable */ if (wol->wolopts) {device_set_wakeup_enable (kdev,1 ); -enable_irq_wake (priv->wol_irq); +if (priv->wol_irq_disabled) +enable_irq_wake (priv->wol_irq); priv->wol_irq_disabled =0 ; }else {device_set_wakeup_enable (kdev,0 );
Signature · 1 line
1.9.1
David Miller
maintainerFrom: Florian Fainelli <[email protected]>
Date: Fri, 10 Oct 2014 10:51:51 -0700
Quoted 3 lines
This patch series fixes an off-by-one error introduced during a previous change, and the two other fixes fix a wake depth imbalance situation for the Wake-on-LAN interrupt line.
Series applied, thanks Florian.