netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net v2 0/3] net: systemport: misc fixes
@ 2014-06-26 17:06 Florian Fainelli
  2014-06-26 17:06 ` [PATCH net v2 1/3] net: systemport: do not clear IFF_MULTICAST flag Florian Fainelli
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Florian Fainelli @ 2014-06-26 17:06 UTC (permalink / raw)
  To: netdev; +Cc: davem, Florian Fainelli

Hi David,

This patch set contains 3 small fixes for the SYSTEM PORT driver

Thanks!

Florian Fainelli (3):
  net: systemport: do not clear IFF_MULTICAST flag
  net: systemport: fix UniMAC reset logic
  net: systemport: fix TX NAPI work done return value

 drivers/net/ethernet/broadcom/bcmsysport.c | 43 ++++++++----------------------
 1 file changed, 11 insertions(+), 32 deletions(-)

-- 
1.9.1

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

* [PATCH net v2 1/3] net: systemport: do not clear IFF_MULTICAST flag
  2014-06-26 17:06 [PATCH net v2 0/3] net: systemport: misc fixes Florian Fainelli
@ 2014-06-26 17:06 ` Florian Fainelli
  2014-06-26 17:06 ` [PATCH net v2 2/3] net: systemport: fix UniMAC reset logic Florian Fainelli
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Florian Fainelli @ 2014-06-26 17:06 UTC (permalink / raw)
  To: netdev; +Cc: davem, Florian Fainelli

The SYSTEMPORT Ethernet MAC supports multicast just fine, it just lacks
any sort of Unicast/Broadcast/Multicasting filtering at the Ethernet MAC
level since that is handled by the front end Ethernet switch, but that
is properly handled by bcm_sysport_set_rx_mode().

Some user-space applications might be relying on the presence of this
flag to prevent using multicast sockets, this also prevents that
interface from joining the IPv6 all-router mcast group.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
Changes in v2:
- rebased

 drivers/net/ethernet/broadcom/bcmsysport.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c
index 141160ef249a..f6bccd847ee6 100644
--- a/drivers/net/ethernet/broadcom/bcmsysport.c
+++ b/drivers/net/ethernet/broadcom/bcmsysport.c
@@ -1589,12 +1589,6 @@ static int bcm_sysport_probe(struct platform_device *pdev)
 	BUILD_BUG_ON(sizeof(struct bcm_tsb) != 8);
 	dev->needed_headroom += sizeof(struct bcm_tsb);
 
-	/* We are interfaced to a switch which handles the multicast
-	 * filtering for us, so we do not support programming any
-	 * multicast hash table in this Ethernet MAC.
-	 */
-	dev->flags &= ~IFF_MULTICAST;
-
 	/* libphy will adjust the link state accordingly */
 	netif_carrier_off(dev);
 
-- 
1.9.1

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

* [PATCH net v2 2/3] net: systemport: fix UniMAC reset logic
  2014-06-26 17:06 [PATCH net v2 0/3] net: systemport: misc fixes Florian Fainelli
  2014-06-26 17:06 ` [PATCH net v2 1/3] net: systemport: do not clear IFF_MULTICAST flag Florian Fainelli
@ 2014-06-26 17:06 ` Florian Fainelli
  2014-06-26 17:06 ` [PATCH net v2 3/3] net: systemport: fix TX NAPI work done return value Florian Fainelli
  2014-07-02  0:16 ` [PATCH net v2 0/3] net: systemport: misc fixes David Miller
  3 siblings, 0 replies; 5+ messages in thread
From: Florian Fainelli @ 2014-06-26 17:06 UTC (permalink / raw)
  To: netdev; +Cc: davem, Florian Fainelli

The UniMAC CMD_SW_RESET bit is not a self-clearing bit, so we need to
assert it, wait a bit and clear it manually. As a result, umac_reset()
is updated not to return any value. The previous version of the code
simply wrote 0 to the CMD register, which would make the busy-waiting
loop exit immediately, having zero effect.

By writing 0 to the CMD register, we were clearing all bits in the CMD
register, and not using the hardware reset default values which are
set on purpose.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
Changes in v2:
- clarify the commit message and make it accurate with what the code
  did before

 drivers/net/ethernet/broadcom/bcmsysport.c | 33 ++++++++----------------------
 1 file changed, 9 insertions(+), 24 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c
index f6bccd847ee6..d31f7d239064 100644
--- a/drivers/net/ethernet/broadcom/bcmsysport.c
+++ b/drivers/net/ethernet/broadcom/bcmsysport.c
@@ -1254,28 +1254,17 @@ static inline void umac_enable_set(struct bcm_sysport_priv *priv,
 		usleep_range(1000, 2000);
 }
 
-static inline int umac_reset(struct bcm_sysport_priv *priv)
+static inline void umac_reset(struct bcm_sysport_priv *priv)
 {
-	unsigned int timeout = 0;
 	u32 reg;
-	int ret = 0;
-
-	umac_writel(priv, 0, UMAC_CMD);
-	while (timeout++ < 1000) {
-		reg = umac_readl(priv, UMAC_CMD);
-		if (!(reg & CMD_SW_RESET))
-			break;
-
-		udelay(1);
-	}
-
-	if (timeout == 1000) {
-		dev_err(&priv->pdev->dev,
-			"timeout waiting for MAC to come out of reset\n");
-		ret = -ETIMEDOUT;
-	}
 
-	return ret;
+	reg = umac_readl(priv, UMAC_CMD);
+	reg |= CMD_SW_RESET;
+	umac_writel(priv, reg, UMAC_CMD);
+	udelay(10);
+	reg = umac_readl(priv, UMAC_CMD);
+	reg &= ~CMD_SW_RESET;
+	umac_writel(priv, reg, UMAC_CMD);
 }
 
 static void umac_set_hw_addr(struct bcm_sysport_priv *priv,
@@ -1303,11 +1292,7 @@ static int bcm_sysport_open(struct net_device *dev)
 	int ret;
 
 	/* Reset UniMAC */
-	ret = umac_reset(priv);
-	if (ret) {
-		netdev_err(dev, "UniMAC reset failed\n");
-		return ret;
-	}
+	umac_reset(priv);
 
 	/* Flush TX and RX FIFOs at TOPCTRL level */
 	topctrl_flush(priv);
-- 
1.9.1

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

* [PATCH net v2 3/3] net: systemport: fix TX NAPI work done return value
  2014-06-26 17:06 [PATCH net v2 0/3] net: systemport: misc fixes Florian Fainelli
  2014-06-26 17:06 ` [PATCH net v2 1/3] net: systemport: do not clear IFF_MULTICAST flag Florian Fainelli
  2014-06-26 17:06 ` [PATCH net v2 2/3] net: systemport: fix UniMAC reset logic Florian Fainelli
@ 2014-06-26 17:06 ` Florian Fainelli
  2014-07-02  0:16 ` [PATCH net v2 0/3] net: systemport: misc fixes David Miller
  3 siblings, 0 replies; 5+ messages in thread
From: Florian Fainelli @ 2014-06-26 17:06 UTC (permalink / raw)
  To: netdev; +Cc: davem, Florian Fainelli

Although we do not limit the number of packets the TX completion
function bcm_sysport_tx_reclaim() is allowed to reclaim, we were still
using its return value as-is. This means that we could hit the WARN() in
net/core/dev.c where work_done >= budget.

Make sure we do exit the NAPI context when the TX ring is empty, and
pretend there was no work to do.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
New patch in v2

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

diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c
index d31f7d239064..5776e503e4c5 100644
--- a/drivers/net/ethernet/broadcom/bcmsysport.c
+++ b/drivers/net/ethernet/broadcom/bcmsysport.c
@@ -654,13 +654,13 @@ static int bcm_sysport_tx_poll(struct napi_struct *napi, int budget)
 
 	work_done = bcm_sysport_tx_reclaim(ring->priv, ring);
 
-	if (work_done < budget) {
+	if (work_done == 0) {
 		napi_complete(napi);
 		/* re-enable TX interrupt */
 		intrl2_1_mask_clear(ring->priv, BIT(ring->index));
 	}
 
-	return work_done;
+	return 0;
 }
 
 static void bcm_sysport_tx_reclaim_all(struct bcm_sysport_priv *priv)
-- 
1.9.1

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

* Re: [PATCH net v2 0/3] net: systemport: misc fixes
  2014-06-26 17:06 [PATCH net v2 0/3] net: systemport: misc fixes Florian Fainelli
                   ` (2 preceding siblings ...)
  2014-06-26 17:06 ` [PATCH net v2 3/3] net: systemport: fix TX NAPI work done return value Florian Fainelli
@ 2014-07-02  0:16 ` David Miller
  3 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2014-07-02  0:16 UTC (permalink / raw)
  To: f.fainelli; +Cc: netdev

From: Florian Fainelli <f.fainelli@gmail.com>
Date: Thu, 26 Jun 2014 10:06:43 -0700

> This patch set contains 3 small fixes for the SYSTEM PORT driver

Series applied, thanks Florian.

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

end of thread, other threads:[~2014-07-02  0:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-26 17:06 [PATCH net v2 0/3] net: systemport: misc fixes Florian Fainelli
2014-06-26 17:06 ` [PATCH net v2 1/3] net: systemport: do not clear IFF_MULTICAST flag Florian Fainelli
2014-06-26 17:06 ` [PATCH net v2 2/3] net: systemport: fix UniMAC reset logic Florian Fainelli
2014-06-26 17:06 ` [PATCH net v2 3/3] net: systemport: fix TX NAPI work done return value Florian Fainelli
2014-07-02  0:16 ` [PATCH net v2 0/3] net: systemport: misc fixes 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).