FAILED: patch "[PATCH] net: dsa: qca8k: reset cpu port on MTU change" failed to apply to 5.15-stable tree
Subsystems (3)
[email protected]
maintainerThe patch below does not apply to the 5.15-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 386228c694bf1e7a7688e44412cb33500b0ac585 Mon Sep 17 00:00:00 2001
From: Christian Marangi <[email protected]>
Date: Tue, 21 Jun 2022 17:11:22 +0200
Subject: [PATCH] net: dsa: qca8k: reset cpu port on MTU change
It was discovered that the Documentation lacks of a fundamental detail on how to correctly change the MAX_FRAME_SIZE of the switch.
In fact if the MAX_FRAME_SIZE is changed while the cpu port is on, the switch panics and cease to send any packet. This cause the mgmt ethernet system to not receive any packet (the slow fallback still works) and makes the device not reachable. To recover from this a switch reset is required.
To correctly handle this, turn off the cpu ports before changing the MAX_FRAME_SIZE and turn on again after the value is applied.
drivers/net/dsa/qca8k.c +21 -1
@@ -2334,6 +2334,7 @@ static int qca8k_port_change_mtu(struct dsa_switch *ds, int port, int new_mtu) { struct qca8k_priv *priv = ds->priv; +int ret;/* We have only have a general MTU setting. * DSA always set the CPU port's MTU to the largest MTU of the slave
@@ -2344,8 +2345,27 @@ qca8k_port_change_mtu(struct dsa_switch *ds, int port, int new_mtu)if (!dsa_is_cpu_port (ds, port))return 0 ; +/* To change the MAX_FRAME_SIZE the cpu ports must be off or +* the switch panics. +* Turn off both cpu ports before applying the new value to prevent +* this. +*/ +if (priv->port_enabled_map &BIT (0 )) +qca8k_port_set_status (priv,0 ,0 ); + +if (priv->port_enabled_map &BIT (6 )) +qca8k_port_set_status (priv,6 ,0 ); +/* Include L2 header / FCS length */ -return qca8k_write (priv,QCA8K_MAX_FRAME_SIZE , new_mtu +ETH_HLEN +ETH_FCS_LEN ); + ret =qca8k_write (priv,QCA8K_MAX_FRAME_SIZE , new_mtu +ETH_HLEN +ETH_FCS_LEN ); + +if (priv->port_enabled_map &BIT (0 )) +qca8k_port_set_status (priv,0 ,1 ); + +if (priv->port_enabled_map &BIT (6 )) +qca8k_port_set_status (priv,6 ,1 ); + +return ret; } static int