Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1352166 > unrolled thread

[PATCH net-next] net: dsa: mv88e6xxx: avoid writing the same mode

Started byVivien Didelot <vivien.didelot@savoirfairelinux.com>
First post2016-03-08 00:30 +0100
Last post2016-03-10 22:20 +0100
Articles 3 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH net-next] net: dsa: mv88e6xxx: avoid writing the same mode Vivien Didelot <vivien.didelot@savoirfairelinux.com> - 2016-03-08 00:30 +0100
    Re: [PATCH net-next] net: dsa: mv88e6xxx: avoid writing the same mode Andrew Lunn <andrew@lunn.ch> - 2016-03-08 15:40 +0100
    Re: [PATCH net-next] net: dsa: mv88e6xxx: avoid writing the same  mode David Miller <davem@davemloft.net> - 2016-03-10 22:20 +0100

#1352166 — [PATCH net-next] net: dsa: mv88e6xxx: avoid writing the same mode

FromVivien Didelot <vivien.didelot@savoirfairelinux.com>
Date2016-03-08 00:30 +0100
Subject[PATCH net-next] net: dsa: mv88e6xxx: avoid writing the same mode
Message-ID<racL8-13y-15@gated-at.bofh.it>
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

[toc] | [next] | [standalone]


#1353099

FromAndrew Lunn <andrew@lunn.ch>
Date2016-03-08 15:40 +0100
Message-ID<raqXL-25J-1@gated-at.bofh.it>
In reply to#1352166
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
> 

[toc] | [prev] | [next] | [standalone]


#1355406 — Re: [PATCH net-next] net: dsa: mv88e6xxx: avoid writing the same mode

FromDavid Miller <davem@davemloft.net>
Date2016-03-10 22:20 +0100
SubjectRe: [PATCH net-next] net: dsa: mv88e6xxx: avoid writing the same mode
Message-ID<rbg9Y-4gf-15@gated-at.bofh.it>
In reply to#1352166
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.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web