[net-next,v6,5/6] net: dsa: microchip: enable MTU normalization for KSZ8795 and KSZ9477 compatible switches

Message ID 20221124101458.3353902-6-o.rempel@pengutronix.de
State New
Headers
Series net: dsa: microchip: add MTU support for KSZ8 series |

Commit Message

Oleksij Rempel Nov. 24, 2022, 10:14 a.m. UTC
  KSZ8795 and KSZ9477 compatible series of switches use global max frame
size configuration register. So, enable MTU normalization for this reason.

Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
 drivers/net/dsa/microchip/ksz8795.c | 2 ++
 drivers/net/dsa/microchip/ksz9477.c | 2 ++
 2 files changed, 4 insertions(+)
  

Comments

Arun Ramadoss Nov. 24, 2022, 3:08 p.m. UTC | #1
On Thu, 2022-11-24 at 11:14 +0100, Oleksij Rempel wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you
> know the content is safe
> 
> KSZ8795 and KSZ9477 compatible series of switches use global max
> frame
> size configuration register. So, enable MTU normalization for this
> reason.

Acked-by: Arun Ramadoss <arun.ramadoss@microchip.com>

> 
> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
> ---
>  drivers/net/dsa/microchip/ksz8795.c | 2 ++
>  drivers/net/dsa/microchip/ksz9477.c | 2 ++
>  2 files changed, 4 insertions(+)
> 
> diff --git a/drivers/net/dsa/microchip/ksz8795.c
> b/drivers/net/dsa/microchip/ksz8795.c
> index d01bfd609130..060e41b9b6ef 100644
> --- a/drivers/net/dsa/microchip/ksz8795.c
> +++ b/drivers/net/dsa/microchip/ksz8795.c
> @@ -1357,6 +1357,8 @@ int ksz8_setup(struct dsa_switch *ds)
>         struct ksz_device *dev = ds->priv;
>         int i;
> 
> +       ds->mtu_enforcement_ingress = true;
> +
>         ksz_cfg(dev, S_REPLACE_VID_CTRL, SW_FLOW_CTRL, true);
> 
>         /* Enable automatic fast aging when link changed detected. */
> diff --git a/drivers/net/dsa/microchip/ksz9477.c
> b/drivers/net/dsa/microchip/ksz9477.c
> index f6e7968ab105..47b54ecf2c6f 100644
> --- a/drivers/net/dsa/microchip/ksz9477.c
> +++ b/drivers/net/dsa/microchip/ksz9477.c
> @@ -1134,6 +1134,8 @@ int ksz9477_setup(struct dsa_switch *ds)
>         struct ksz_device *dev = ds->priv;
>         int ret = 0;
> 
> +       ds->mtu_enforcement_ingress = true;
> +
>         /* Required for port partitioning. */
>         ksz9477_cfg32(dev, REG_SW_QM_CTRL__4, UNICAST_VLAN_BOUNDARY,
>                       true);
> --
> 2.30.2
>
  
Vladimir Oltean Nov. 25, 2022, 9:32 p.m. UTC | #2
On Thu, Nov 24, 2022 at 11:14:57AM +0100, Oleksij Rempel wrote:
> KSZ8795 and KSZ9477 compatible series of switches use global max frame
> size configuration register. So, enable MTU normalization for this reason.
> 
> Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
> ---

Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
  

Patch

diff --git a/drivers/net/dsa/microchip/ksz8795.c b/drivers/net/dsa/microchip/ksz8795.c
index d01bfd609130..060e41b9b6ef 100644
--- a/drivers/net/dsa/microchip/ksz8795.c
+++ b/drivers/net/dsa/microchip/ksz8795.c
@@ -1357,6 +1357,8 @@  int ksz8_setup(struct dsa_switch *ds)
 	struct ksz_device *dev = ds->priv;
 	int i;
 
+	ds->mtu_enforcement_ingress = true;
+
 	ksz_cfg(dev, S_REPLACE_VID_CTRL, SW_FLOW_CTRL, true);
 
 	/* Enable automatic fast aging when link changed detected. */
diff --git a/drivers/net/dsa/microchip/ksz9477.c b/drivers/net/dsa/microchip/ksz9477.c
index f6e7968ab105..47b54ecf2c6f 100644
--- a/drivers/net/dsa/microchip/ksz9477.c
+++ b/drivers/net/dsa/microchip/ksz9477.c
@@ -1134,6 +1134,8 @@  int ksz9477_setup(struct dsa_switch *ds)
 	struct ksz_device *dev = ds->priv;
 	int ret = 0;
 
+	ds->mtu_enforcement_ingress = true;
+
 	/* Required for port partitioning. */
 	ksz9477_cfg32(dev, REG_SW_QM_CTRL__4, UNICAST_VLAN_BOUNDARY,
 		      true);