[RFC,net-next,10/11] net: dsa: microchip: lan937x: update vlan untag membership

Message ID 20230202125930.271740-11-rakesh.sankaranarayanan@microchip.com
State New
Headers
Series net: dsa: microchip: lan937x: add switch cascade support |

Commit Message

Rakesh Sankaranarayanan Feb. 2, 2023, 12:59 p.m. UTC
  Exclude cascaded port from vlan untag membership table since it will be
the host port for second switch. Here setting 1 means, port will be
capable of receiving tagged frames and 0 means, port can not receive
tagged frames.

Signed-off-by: Rakesh Sankaranarayanan <rakesh.sankaranarayanan@microchip.com>
---
 drivers/net/dsa/microchip/ksz9477.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Vladimir Oltean Feb. 3, 2023, 11:48 p.m. UTC | #1
On Thu, Feb 02, 2023 at 06:29:29PM +0530, Rakesh Sankaranarayanan wrote:
> Exclude cascaded port from vlan untag membership table since it will be
> the host port for second switch. Here setting 1 means, port will be
> capable of receiving tagged frames and 0 means, port can not receive
> tagged frames.
> 
> Signed-off-by: Rakesh Sankaranarayanan <rakesh.sankaranarayanan@microchip.com>
> ---
>  drivers/net/dsa/microchip/ksz9477.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/dsa/microchip/ksz9477.c b/drivers/net/dsa/microchip/ksz9477.c
> index bf13d47c26cf..4c12131098b1 100644
> --- a/drivers/net/dsa/microchip/ksz9477.c
> +++ b/drivers/net/dsa/microchip/ksz9477.c
> @@ -399,7 +399,7 @@ int ksz9477_port_vlan_add(struct ksz_device *dev, int port,
>  		vlan_table[1] |= BIT(port);
>  	else
>  		vlan_table[1] &= ~BIT(port);
> -	vlan_table[1] &= ~(BIT(dev->cpu_port));
> +	vlan_table[1] &= ~(BIT(dev->cpu_port) | BIT(dev->dsa_port));

same comment, what if dev->dsa_port is 0xff?

>  
>  	vlan_table[2] |= BIT(port) | BIT(dev->cpu_port);
>  
> -- 
> 2.34.1
>
  

Patch

diff --git a/drivers/net/dsa/microchip/ksz9477.c b/drivers/net/dsa/microchip/ksz9477.c
index bf13d47c26cf..4c12131098b1 100644
--- a/drivers/net/dsa/microchip/ksz9477.c
+++ b/drivers/net/dsa/microchip/ksz9477.c
@@ -399,7 +399,7 @@  int ksz9477_port_vlan_add(struct ksz_device *dev, int port,
 		vlan_table[1] |= BIT(port);
 	else
 		vlan_table[1] &= ~BIT(port);
-	vlan_table[1] &= ~(BIT(dev->cpu_port));
+	vlan_table[1] &= ~(BIT(dev->cpu_port) | BIT(dev->dsa_port));
 
 	vlan_table[2] |= BIT(port) | BIT(dev->cpu_port);