diff mbox series

[net-next,10/13] net: dsa: Skip calling .port_vlan_filtering on no change

Message ID 20190428184554.9968-11-olteanv@gmail.com
State Accepted
Delegated to: David Miller
Headers show
Series Improvements to DSA core VLAN manipulation | expand

Commit Message

Vladimir Oltean April 28, 2019, 6:45 p.m. UTC
Even if VLAN filtering is global, DSA will call this callback once per
each port. Drivers should not have to compare the global state with the
requested change. So let DSA do it.

Signed-off-by: Vladimir Oltean <olteanv@gmail.com>
---
 net/dsa/port.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Andrew Lunn April 29, 2019, 9:57 p.m. UTC | #1
On Sun, Apr 28, 2019 at 09:45:51PM +0300, Vladimir Oltean wrote:
> Even if VLAN filtering is global, DSA will call this callback once per
> each port. Drivers should not have to compare the global state with the
> requested change. So let DSA do it.
> 
> Signed-off-by: Vladimir Oltean <olteanv@gmail.com>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew
diff mbox series

Patch

diff --git a/net/dsa/port.c b/net/dsa/port.c
index 555fdbf0a3f4..da5922ba7d33 100644
--- a/net/dsa/port.c
+++ b/net/dsa/port.c
@@ -203,6 +203,9 @@  int dsa_port_vlan_filtering(struct dsa_port *dp, bool vlan_filtering,
 	if (!dsa_port_can_apply_vlan_filtering(dp, vlan_filtering))
 		return -EINVAL;
 
+	if (dsa_port_is_vlan_filtering(dp) == vlan_filtering)
+		return 0;
+
 	err = ds->ops->port_vlan_filtering(ds, dp->index,
 					   vlan_filtering);
 	if (err)