linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] net: ethernet: ti: cpsw: fix runtime pm while add/del reserved vid
@ 2018-08-10 12:47 Ivan Khoronzhuk
  2018-08-10 12:47 ` [PATCH 1/2] net: ethernet: ti: cpsw: clear all entries when delete vid Ivan Khoronzhuk
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Ivan Khoronzhuk @ 2018-08-10 12:47 UTC (permalink / raw)
  To: grygorii.strashko, davem
  Cc: linux-omap, netdev, linux-kernel, Ivan Khoronzhuk

Here 2 not critical fixes for:
- vlan ale table leak while error if deleting vlan (simplifies next fix)
- runtime pm while try to set reserved vlan

Based on net/master

Ivan Khoronzhuk (2):
  net: ethernet: ti: cpsw: clear all entries when delete vid
  net: ethernet: ti: cpsw: fix runtime_pm while add/kill vlan

 drivers/net/ethernet/ti/cpsw.c     | 25 +++++++++++--------------
 drivers/net/ethernet/ti/cpsw_ale.c |  2 +-
 2 files changed, 12 insertions(+), 15 deletions(-)

-- 
2.17.1


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

* [PATCH 1/2] net: ethernet: ti: cpsw: clear all entries when delete vid
  2018-08-10 12:47 [PATCH 0/2] net: ethernet: ti: cpsw: fix runtime pm while add/del reserved vid Ivan Khoronzhuk
@ 2018-08-10 12:47 ` Ivan Khoronzhuk
  2018-08-10 12:47 ` [PATCH 2/2] net: ethernet: ti: cpsw: fix runtime_pm while add/kill vlan Ivan Khoronzhuk
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Ivan Khoronzhuk @ 2018-08-10 12:47 UTC (permalink / raw)
  To: grygorii.strashko, davem
  Cc: linux-omap, netdev, linux-kernel, Ivan Khoronzhuk

In cases if some of the entries were not found in forwarding table
while killing vlan, the rest not needed entries still left in the
table. No need to stop, as entry was deleted anyway. So fix this by
returning error only after all was cleaned. To implement this, return
-ENOENT in cpsw_ale_del_mcast() as it's supposed to be.

Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
---
 drivers/net/ethernet/ti/cpsw.c     | 14 ++++----------
 drivers/net/ethernet/ti/cpsw_ale.c |  2 +-
 2 files changed, 5 insertions(+), 11 deletions(-)

diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index 358edab9e72e..9edac671f276 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -2125,16 +2125,10 @@ static int cpsw_ndo_vlan_rx_kill_vid(struct net_device *ndev,
 
 	dev_info(priv->dev, "removing vlanid %d from vlan filter\n", vid);
 	ret = cpsw_ale_del_vlan(cpsw->ale, vid, 0);
-	if (ret != 0)
-		return ret;
-
-	ret = cpsw_ale_del_ucast(cpsw->ale, priv->mac_addr,
-				 HOST_PORT_NUM, ALE_VLAN, vid);
-	if (ret != 0)
-		return ret;
-
-	ret = cpsw_ale_del_mcast(cpsw->ale, priv->ndev->broadcast,
-				 0, ALE_VLAN, vid);
+	ret |= cpsw_ale_del_ucast(cpsw->ale, priv->mac_addr,
+				  HOST_PORT_NUM, ALE_VLAN, vid);
+	ret |= cpsw_ale_del_mcast(cpsw->ale, priv->ndev->broadcast,
+				  0, ALE_VLAN, vid);
 	pm_runtime_put(cpsw->dev);
 	return ret;
 }
diff --git a/drivers/net/ethernet/ti/cpsw_ale.c b/drivers/net/ethernet/ti/cpsw_ale.c
index 93dc05c194d3..5766225a4ce1 100644
--- a/drivers/net/ethernet/ti/cpsw_ale.c
+++ b/drivers/net/ethernet/ti/cpsw_ale.c
@@ -394,7 +394,7 @@ int cpsw_ale_del_mcast(struct cpsw_ale *ale, u8 *addr, int port_mask,
 
 	idx = cpsw_ale_match_addr(ale, addr, (flags & ALE_VLAN) ? vid : 0);
 	if (idx < 0)
-		return -EINVAL;
+		return -ENOENT;
 
 	cpsw_ale_read(ale, idx, ale_entry);
 
-- 
2.17.1


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

* [PATCH 2/2] net: ethernet: ti: cpsw: fix runtime_pm while add/kill vlan
  2018-08-10 12:47 [PATCH 0/2] net: ethernet: ti: cpsw: fix runtime pm while add/del reserved vid Ivan Khoronzhuk
  2018-08-10 12:47 ` [PATCH 1/2] net: ethernet: ti: cpsw: clear all entries when delete vid Ivan Khoronzhuk
@ 2018-08-10 12:47 ` Ivan Khoronzhuk
  2018-08-10 17:53 ` [PATCH 0/2] net: ethernet: ti: cpsw: fix runtime pm while add/del reserved vid Grygorii Strashko
  2018-08-11 16:39 ` David Miller
  3 siblings, 0 replies; 5+ messages in thread
From: Ivan Khoronzhuk @ 2018-08-10 12:47 UTC (permalink / raw)
  To: grygorii.strashko, davem
  Cc: linux-omap, netdev, linux-kernel, Ivan Khoronzhuk

It's exclusive with normal behaviour but if try to set vlan to one of
the reserved values is made, the cpsw runtime pm is broken.

Fixes: commit a6c5d14f5136
("drivers: net: cpsw: ndev: fix accessing to suspended device")

Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
---
 drivers/net/ethernet/ti/cpsw.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index 9edac671f276..3e34cb8ac1d3 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -2086,14 +2086,16 @@ static int cpsw_ndo_vlan_rx_add_vid(struct net_device *ndev,
 		int i;
 
 		for (i = 0; i < cpsw->data.slaves; i++) {
-			if (vid == cpsw->slaves[i].port_vlan)
-				return -EINVAL;
+			if (vid == cpsw->slaves[i].port_vlan) {
+				ret = -EINVAL;
+				goto err;
+			}
 		}
 	}
 
 	dev_info(priv->dev, "Adding vlanid %d to vlan filter\n", vid);
 	ret = cpsw_add_vlan_ale_entry(priv, vid);
-
+err:
 	pm_runtime_put(cpsw->dev);
 	return ret;
 }
@@ -2119,7 +2121,7 @@ static int cpsw_ndo_vlan_rx_kill_vid(struct net_device *ndev,
 
 		for (i = 0; i < cpsw->data.slaves; i++) {
 			if (vid == cpsw->slaves[i].port_vlan)
-				return -EINVAL;
+				goto err;
 		}
 	}
 
@@ -2129,6 +2131,7 @@ static int cpsw_ndo_vlan_rx_kill_vid(struct net_device *ndev,
 				  HOST_PORT_NUM, ALE_VLAN, vid);
 	ret |= cpsw_ale_del_mcast(cpsw->ale, priv->ndev->broadcast,
 				  0, ALE_VLAN, vid);
+err:
 	pm_runtime_put(cpsw->dev);
 	return ret;
 }
-- 
2.17.1


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

* Re: [PATCH 0/2] net: ethernet: ti: cpsw: fix runtime pm while add/del reserved vid
  2018-08-10 12:47 [PATCH 0/2] net: ethernet: ti: cpsw: fix runtime pm while add/del reserved vid Ivan Khoronzhuk
  2018-08-10 12:47 ` [PATCH 1/2] net: ethernet: ti: cpsw: clear all entries when delete vid Ivan Khoronzhuk
  2018-08-10 12:47 ` [PATCH 2/2] net: ethernet: ti: cpsw: fix runtime_pm while add/kill vlan Ivan Khoronzhuk
@ 2018-08-10 17:53 ` Grygorii Strashko
  2018-08-11 16:39 ` David Miller
  3 siblings, 0 replies; 5+ messages in thread
From: Grygorii Strashko @ 2018-08-10 17:53 UTC (permalink / raw)
  To: Ivan Khoronzhuk, davem; +Cc: linux-omap, netdev, linux-kernel



On 08/10/2018 07:47 AM, Ivan Khoronzhuk wrote:
> Here 2 not critical fixes for:
> - vlan ale table leak while error if deleting vlan (simplifies next fix)
> - runtime pm while try to set reserved vlan
> 
> Based on net/master
> 
> Ivan Khoronzhuk (2):
>    net: ethernet: ti: cpsw: clear all entries when delete vid
>    net: ethernet: ti: cpsw: fix runtime_pm while add/kill vlan
> 
>   drivers/net/ethernet/ti/cpsw.c     | 25 +++++++++++--------------
>   drivers/net/ethernet/ti/cpsw_ale.c |  2 +-
>   2 files changed, 12 insertions(+), 15 deletions(-)
> 

Thank you.
Reviewed-by: Grygorii Strashko <grygorii.strashko@ti.com>

-- 
regards,
-grygorii

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

* Re: [PATCH 0/2] net: ethernet: ti: cpsw: fix runtime pm while add/del reserved vid
  2018-08-10 12:47 [PATCH 0/2] net: ethernet: ti: cpsw: fix runtime pm while add/del reserved vid Ivan Khoronzhuk
                   ` (2 preceding siblings ...)
  2018-08-10 17:53 ` [PATCH 0/2] net: ethernet: ti: cpsw: fix runtime pm while add/del reserved vid Grygorii Strashko
@ 2018-08-11 16:39 ` David Miller
  3 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2018-08-11 16:39 UTC (permalink / raw)
  To: ivan.khoronzhuk; +Cc: grygorii.strashko, linux-omap, netdev, linux-kernel

From: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
Date: Fri, 10 Aug 2018 15:47:07 +0300

> Here 2 not critical fixes for:
> - vlan ale table leak while error if deleting vlan (simplifies next fix)
> - runtime pm while try to set reserved vlan

Series applied, thank you.

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

end of thread, other threads:[~2018-08-11 16:39 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-10 12:47 [PATCH 0/2] net: ethernet: ti: cpsw: fix runtime pm while add/del reserved vid Ivan Khoronzhuk
2018-08-10 12:47 ` [PATCH 1/2] net: ethernet: ti: cpsw: clear all entries when delete vid Ivan Khoronzhuk
2018-08-10 12:47 ` [PATCH 2/2] net: ethernet: ti: cpsw: fix runtime_pm while add/kill vlan Ivan Khoronzhuk
2018-08-10 17:53 ` [PATCH 0/2] net: ethernet: ti: cpsw: fix runtime pm while add/del reserved vid Grygorii Strashko
2018-08-11 16:39 ` 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).