Skip to content

Commit

Permalink
net: dsa: microchip: do not store max MTU for all ports
Browse files Browse the repository at this point in the history
If we have global MTU configuration, it is enough to configure it on CPU
port only.

Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
  • Loading branch information
Oleksij Rempel authored and Paolo Abeni committed Dec 7, 2022
1 parent 838c19f commit 1d0a1a6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
14 changes: 5 additions & 9 deletions drivers/net/dsa/microchip/ksz9477.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion drivers/net/dsa/microchip/ksz_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 1d0a1a6

Please sign in to comment.