linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] net: dsa: mv88e6xxx: avoid writing the same mode
@ 2016-03-07 23:24 Vivien Didelot
  2016-03-08 14:37 ` Andrew Lunn
  2016-03-10 21:11 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Vivien Didelot @ 2016-03-07 23:24 UTC (permalink / raw)
  To: netdev
  Cc: linux-kernel, kernel, David S. Miller, Andrew Lunn, Kevin Smith,
	Vivien Didelot

There is no need to change the 802.1Q port mode for the same value.
Thus avoid such message:

    [  401.954836] dsa dsa@0 lan0: 802.1Q Mode: Disabled (was Disabled)

Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
---
 drivers/net/dsa/mv88e6xxx.c | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/drivers/net/dsa/mv88e6xxx.c b/drivers/net/dsa/mv88e6xxx.c
index 1aee42d..5f07524 100644
--- a/drivers/net/dsa/mv88e6xxx.c
+++ b/drivers/net/dsa/mv88e6xxx.c
@@ -1765,16 +1765,21 @@ int mv88e6xxx_port_vlan_filtering(struct dsa_switch *ds, int port,
 
 	old = ret & PORT_CONTROL_2_8021Q_MASK;
 
-	ret &= ~PORT_CONTROL_2_8021Q_MASK;
-	ret |= new & PORT_CONTROL_2_8021Q_MASK;
+	if (new != old) {
+		ret &= ~PORT_CONTROL_2_8021Q_MASK;
+		ret |= new & PORT_CONTROL_2_8021Q_MASK;
 
-	ret = _mv88e6xxx_reg_write(ds, REG_PORT(port), PORT_CONTROL_2, ret);
-	if (ret < 0)
-		goto unlock;
+		ret = _mv88e6xxx_reg_write(ds, REG_PORT(port), PORT_CONTROL_2,
+					   ret);
+		if (ret < 0)
+			goto unlock;
+
+		netdev_dbg(ds->ports[port], "802.1Q Mode %s (was %s)\n",
+			   mv88e6xxx_port_8021q_mode_names[new],
+			   mv88e6xxx_port_8021q_mode_names[old]);
+	}
 
-	netdev_dbg(ds->ports[port], "802.1Q Mode: %s (was %s)\n",
-		   mv88e6xxx_port_8021q_mode_names[new],
-		   mv88e6xxx_port_8021q_mode_names[old]);
+	ret = 0;
 unlock:
 	mutex_unlock(&ps->smi_mutex);
 
-- 
2.7.2

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

* Re: [PATCH net-next] net: dsa: mv88e6xxx: avoid writing the same mode
  2016-03-07 23:24 [PATCH net-next] net: dsa: mv88e6xxx: avoid writing the same mode Vivien Didelot
@ 2016-03-08 14:37 ` Andrew Lunn
  2016-03-10 21:11 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Andrew Lunn @ 2016-03-08 14:37 UTC (permalink / raw)
  To: Vivien Didelot; +Cc: netdev, linux-kernel, kernel, David S. Miller, Kevin Smith

On Mon, Mar 07, 2016 at 06:24:52PM -0500, Vivien Didelot wrote:
> There is no need to change the 802.1Q port mode for the same value.
> Thus avoid such message:
> 
>     [  401.954836] dsa dsa@0 lan0: 802.1Q Mode: Disabled (was Disabled)
> 
> Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>

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

Thanks
        Andrew


> ---
>  drivers/net/dsa/mv88e6xxx.c | 21 +++++++++++++--------
>  1 file changed, 13 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/net/dsa/mv88e6xxx.c b/drivers/net/dsa/mv88e6xxx.c
> index 1aee42d..5f07524 100644
> --- a/drivers/net/dsa/mv88e6xxx.c
> +++ b/drivers/net/dsa/mv88e6xxx.c
> @@ -1765,16 +1765,21 @@ int mv88e6xxx_port_vlan_filtering(struct dsa_switch *ds, int port,
>  
>  	old = ret & PORT_CONTROL_2_8021Q_MASK;
>  
> -	ret &= ~PORT_CONTROL_2_8021Q_MASK;
> -	ret |= new & PORT_CONTROL_2_8021Q_MASK;
> +	if (new != old) {
> +		ret &= ~PORT_CONTROL_2_8021Q_MASK;
> +		ret |= new & PORT_CONTROL_2_8021Q_MASK;
>  
> -	ret = _mv88e6xxx_reg_write(ds, REG_PORT(port), PORT_CONTROL_2, ret);
> -	if (ret < 0)
> -		goto unlock;
> +		ret = _mv88e6xxx_reg_write(ds, REG_PORT(port), PORT_CONTROL_2,
> +					   ret);
> +		if (ret < 0)
> +			goto unlock;
> +
> +		netdev_dbg(ds->ports[port], "802.1Q Mode %s (was %s)\n",
> +			   mv88e6xxx_port_8021q_mode_names[new],
> +			   mv88e6xxx_port_8021q_mode_names[old]);
> +	}
>  
> -	netdev_dbg(ds->ports[port], "802.1Q Mode: %s (was %s)\n",
> -		   mv88e6xxx_port_8021q_mode_names[new],
> -		   mv88e6xxx_port_8021q_mode_names[old]);
> +	ret = 0;
>  unlock:
>  	mutex_unlock(&ps->smi_mutex);
>  
> -- 
> 2.7.2
> 

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

* Re: [PATCH net-next] net: dsa: mv88e6xxx: avoid writing the same mode
  2016-03-07 23:24 [PATCH net-next] net: dsa: mv88e6xxx: avoid writing the same mode Vivien Didelot
  2016-03-08 14:37 ` Andrew Lunn
@ 2016-03-10 21:11 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2016-03-10 21:11 UTC (permalink / raw)
  To: vivien.didelot; +Cc: netdev, linux-kernel, kernel, andrew, kevin.smith

From: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Date: Mon,  7 Mar 2016 18:24:52 -0500

> There is no need to change the 802.1Q port mode for the same value.
> Thus avoid such message:
> 
>     [  401.954836] dsa dsa@0 lan0: 802.1Q Mode: Disabled (was Disabled)
> 
> Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com>

Applied.

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

end of thread, other threads:[~2016-03-10 21:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-07 23:24 [PATCH net-next] net: dsa: mv88e6xxx: avoid writing the same mode Vivien Didelot
2016-03-08 14:37 ` Andrew Lunn
2016-03-10 21:11 ` 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).