net: dsa: felix: support changing the MTU
Changing the MTU for this switch means altering the DEV_GMII:MAC_CFG_STATUS:MAC_MAXLEN_CFG field MAX_LEN, which in turn limits the size of frames that can be received. Special accounting needs to be done for the DSA CPU port (NPI port in hardware terms). The NPI port configuration needs to be held inside the private ocelot structure, since it is now accessed from multiple places. Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
fb77ffc6ec
commit
0b912fc93a
@@ -532,6 +532,7 @@ static int felix_setup(struct dsa_switch *ds)
|
||||
ANA_PGID_PGID_PGID(GENMASK(ocelot->num_phys_ports, 0)),
|
||||
ANA_PGID_PGID, PGID_UC);
|
||||
|
||||
ds->mtu_enforcement_ingress = true;
|
||||
/* It looks like the MAC/PCS interrupt register - PM0_IEVENT (0x8040)
|
||||
* isn't instantiated for the Felix PF.
|
||||
* In-band AN may take a few ms to complete, so we need to poll.
|
||||
@@ -609,6 +610,22 @@ static bool felix_txtstamp(struct dsa_switch *ds, int port,
|
||||
return false;
|
||||
}
|
||||
|
||||
static int felix_change_mtu(struct dsa_switch *ds, int port, int new_mtu)
|
||||
{
|
||||
struct ocelot *ocelot = ds->priv;
|
||||
|
||||
ocelot_port_set_maxlen(ocelot, port, new_mtu);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int felix_get_max_mtu(struct dsa_switch *ds, int port)
|
||||
{
|
||||
struct ocelot *ocelot = ds->priv;
|
||||
|
||||
return ocelot_get_max_mtu(ocelot, port);
|
||||
}
|
||||
|
||||
static int felix_cls_flower_add(struct dsa_switch *ds, int port,
|
||||
struct flow_cls_offload *cls, bool ingress)
|
||||
{
|
||||
@@ -664,6 +681,8 @@ static const struct dsa_switch_ops felix_switch_ops = {
|
||||
.port_hwtstamp_set = felix_hwtstamp_set,
|
||||
.port_rxtstamp = felix_rxtstamp,
|
||||
.port_txtstamp = felix_txtstamp,
|
||||
.port_change_mtu = felix_change_mtu,
|
||||
.port_max_mtu = felix_get_max_mtu,
|
||||
.cls_flower_add = felix_cls_flower_add,
|
||||
.cls_flower_del = felix_cls_flower_del,
|
||||
.cls_flower_stats = felix_cls_flower_stats,
|
||||
|
Reference in New Issue
Block a user