Skip to content

Commit

Permalink
net: dsa: loop: Wire-up MTU callbacks
Browse files Browse the repository at this point in the history
For now we simply store the port MTU into a per-port member.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Florian Fainelli authored and David S. Miller committed Aug 4, 2020
1 parent 6c84a58 commit c99194e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
17 changes: 17 additions & 0 deletions drivers/net/dsa/dsa_loop.c
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,21 @@ static int dsa_loop_port_vlan_del(struct dsa_switch *ds, int port,
return 0;
}

static int dsa_loop_port_change_mtu(struct dsa_switch *ds, int port,
int new_mtu)
{
struct dsa_loop_priv *priv = ds->priv;

priv->ports[port].mtu = new_mtu;

return 0;
}

static int dsa_loop_port_max_mtu(struct dsa_switch *ds, int port)
{
return ETH_MAX_MTU;
}

static const struct dsa_switch_ops dsa_loop_driver = {
.get_tag_protocol = dsa_loop_get_protocol,
.setup = dsa_loop_setup,
Expand All @@ -241,6 +256,8 @@ static const struct dsa_switch_ops dsa_loop_driver = {
.port_vlan_prepare = dsa_loop_port_vlan_prepare,
.port_vlan_add = dsa_loop_port_vlan_add,
.port_vlan_del = dsa_loop_port_vlan_del,
.port_change_mtu = dsa_loop_port_change_mtu,
.port_max_mtu = dsa_loop_port_max_mtu,
};

static int dsa_loop_drv_probe(struct mdio_device *mdiodev)
Expand Down
1 change: 1 addition & 0 deletions include/linux/dsa/loop.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ enum dsa_loop_mib_counters {
struct dsa_loop_port {
struct dsa_loop_mib_entry mib[__DSA_LOOP_CNT_MAX];
u16 pvid;
int mtu;
};

struct dsa_loop_priv {
Expand Down

0 comments on commit c99194e

Please sign in to comment.