net: dsa: qca8k: implement the port MTU callbacks
This switch has a single max frame size configuration register, so we track the requested MTU for each port and apply the largest. v2: - Address review feedback from Vladimir Oltean Signed-off-by: Jonathan McDowell <noodles@earth.li> Acked-by: Vladimir Oltean <olteanv@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
2b96692bcf
commit
f58d2598cf
@@ -670,6 +670,11 @@ qca8k_setup(struct dsa_switch *ds)
|
||||
}
|
||||
}
|
||||
|
||||
/* Setup our port MTUs to match power on defaults */
|
||||
for (i = 0; i < QCA8K_NUM_PORTS; i++)
|
||||
priv->port_mtu[i] = ETH_FRAME_LEN + ETH_FCS_LEN;
|
||||
qca8k_write(priv, QCA8K_MAX_FRAME_SIZE, ETH_FRAME_LEN + ETH_FCS_LEN);
|
||||
|
||||
/* Flush the FDB table */
|
||||
qca8k_fdb_flush(priv);
|
||||
|
||||
@@ -1098,6 +1103,30 @@ qca8k_port_disable(struct dsa_switch *ds, int port)
|
||||
priv->port_sts[port].enabled = 0;
|
||||
}
|
||||
|
||||
static int
|
||||
qca8k_port_change_mtu(struct dsa_switch *ds, int port, int new_mtu)
|
||||
{
|
||||
struct qca8k_priv *priv = ds->priv;
|
||||
int i, mtu = 0;
|
||||
|
||||
priv->port_mtu[port] = new_mtu;
|
||||
|
||||
for (i = 0; i < QCA8K_NUM_PORTS; i++)
|
||||
if (priv->port_mtu[port] > mtu)
|
||||
mtu = priv->port_mtu[port];
|
||||
|
||||
/* Include L2 header / FCS length */
|
||||
qca8k_write(priv, QCA8K_MAX_FRAME_SIZE, mtu + ETH_HLEN + ETH_FCS_LEN);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
qca8k_port_max_mtu(struct dsa_switch *ds, int port)
|
||||
{
|
||||
return QCA8K_MAX_MTU;
|
||||
}
|
||||
|
||||
static int
|
||||
qca8k_port_fdb_insert(struct qca8k_priv *priv, const u8 *addr,
|
||||
u16 port_mask, u16 vid)
|
||||
@@ -1174,6 +1203,8 @@ static const struct dsa_switch_ops qca8k_switch_ops = {
|
||||
.set_mac_eee = qca8k_set_mac_eee,
|
||||
.port_enable = qca8k_port_enable,
|
||||
.port_disable = qca8k_port_disable,
|
||||
.port_change_mtu = qca8k_port_change_mtu,
|
||||
.port_max_mtu = qca8k_port_max_mtu,
|
||||
.port_stp_state_set = qca8k_port_stp_state_set,
|
||||
.port_bridge_join = qca8k_port_bridge_join,
|
||||
.port_bridge_leave = qca8k_port_bridge_leave,
|
||||
|
Reference in New Issue
Block a user