[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200803200354.45062-5-f.fainelli@gmail.com>
Date: Mon, 3 Aug 2020 13:03:53 -0700
From: Florian Fainelli <f.fainelli@...il.com>
To: netdev@...r.kernel.org
Cc: Florian Fainelli <f.fainelli@...il.com>,
Andrew Lunn <andrew@...n.ch>,
Vivien Didelot <vivien.didelot@...il.com>,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>
Subject: [PATCH net-next 4/5] net: dsa: loop: Wire-up MTU callbacks
For now we simply store the port MTU into a per-port member.
Signed-off-by: Florian Fainelli <f.fainelli@...il.com>
---
drivers/net/dsa/dsa_loop.c | 17 +++++++++++++++++
include/linux/dsa/loop.h | 1 +
2 files changed, 18 insertions(+)
diff --git a/drivers/net/dsa/dsa_loop.c b/drivers/net/dsa/dsa_loop.c
index ed0b580c9944..6a7d661b5a59 100644
--- a/drivers/net/dsa/dsa_loop.c
+++ b/drivers/net/dsa/dsa_loop.c
@@ -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,
@@ -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)
diff --git a/include/linux/dsa/loop.h b/include/linux/dsa/loop.h
index bb39401a8056..5a3470bcc8a7 100644
--- a/include/linux/dsa/loop.h
+++ b/include/linux/dsa/loop.h
@@ -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 {
--
2.25.1
Powered by blists - more mailing lists