2022-11-23 12:38:52

by Oleksij Rempel

[permalink] [raw]
Subject: [PATCH net-next v5 0/5] net: dsa: microchip: add MTU support for KSZ8 series

changes v4:
- add mtu normalization patch

changes v4:
- remove per port max_frame cache
- remove port variable for ksz88* variants
- add KSZ9563_CHIP_ID
- not start a new line with an operator

changes v3:
- rename KSZ8863_LEGAL_PACKET_SIZE -> KSZ8_LEGAL_PACKET_SIZE

changes v2:
- add ksz_rmw8() helper
- merge all max MTUs to one location

Oleksij Rempel (5):
net: dsa: microchip: move max mtu to one location
net: dsa: microchip: do not store max MTU for all ports
net: dsa: microchip: add ksz_rmw8() function
net: dsa: microchip: ksz8: add MTU configuration support
net: dsa: microchip: enable MTU normalization for KSZ8795 and KSZ9477
compatible switches

drivers/net/dsa/microchip/ksz8.h | 1 +
drivers/net/dsa/microchip/ksz8795.c | 55 ++++++++++++++++++++++++-
drivers/net/dsa/microchip/ksz8795_reg.h | 3 ++
drivers/net/dsa/microchip/ksz9477.c | 21 ++++------
drivers/net/dsa/microchip/ksz9477.h | 1 -
drivers/net/dsa/microchip/ksz9477_reg.h | 2 -
drivers/net/dsa/microchip/ksz_common.c | 29 ++++++++++---
drivers/net/dsa/microchip/ksz_common.h | 13 +++++-
8 files changed, 99 insertions(+), 26 deletions(-)

--
2.30.2


2022-11-23 12:41:52

by Oleksij Rempel

[permalink] [raw]
Subject: [PATCH net-next v5 2/5] net: dsa: microchip: do not store max MTU for all ports

If we have global MTU configuration, it is enough to configure it on CPU
port only.

Signed-off-by: Oleksij Rempel <[email protected]>
Reviewed-by: Vladimir Oltean <[email protected]>
Reviewed-by: Florian Fainelli <[email protected]>
---
drivers/net/dsa/microchip/ksz9477.c | 14 +++++---------
drivers/net/dsa/microchip/ksz_common.h | 1 -
2 files changed, 5 insertions(+), 10 deletions(-)

diff --git a/drivers/net/dsa/microchip/ksz9477.c b/drivers/net/dsa/microchip/ksz9477.c
index 602d00671bef..f6e7968ab105 100644
--- a/drivers/net/dsa/microchip/ksz9477.c
+++ b/drivers/net/dsa/microchip/ksz9477.c
@@ -45,19 +45,15 @@ static void ksz9477_port_cfg32(struct ksz_device *dev, int port, int offset,

int ksz9477_change_mtu(struct ksz_device *dev, int port, int mtu)
{
- u16 frame_size, max_frame = 0;
- int i;
-
- frame_size = mtu + VLAN_ETH_HLEN + ETH_FCS_LEN;
+ u16 frame_size;

- /* Cache the per-port MTU setting */
- dev->ports[port].max_frame = frame_size;
+ if (!dsa_is_cpu_port(dev->ds, port))
+ return 0;

- for (i = 0; i < dev->info->port_cnt; i++)
- max_frame = max(max_frame, dev->ports[i].max_frame);
+ frame_size = mtu + VLAN_ETH_HLEN + ETH_FCS_LEN;

return regmap_update_bits(dev->regmap[1], REG_SW_MTU__2,
- REG_SW_MTU_MASK, max_frame);
+ REG_SW_MTU_MASK, frame_size);
}

static int ksz9477_wait_vlan_ctrl_ready(struct ksz_device *dev)
diff --git a/drivers/net/dsa/microchip/ksz_common.h b/drivers/net/dsa/microchip/ksz_common.h
index 27c26ee15af4..61228be299f9 100644
--- a/drivers/net/dsa/microchip/ksz_common.h
+++ b/drivers/net/dsa/microchip/ksz_common.h
@@ -95,7 +95,6 @@ struct ksz_port {

struct ksz_port_mib mib;
phy_interface_t interface;
- u16 max_frame;
u32 rgmii_tx_val;
u32 rgmii_rx_val;
struct ksz_device *ksz_dev;
--
2.30.2