From: Jerry Ray <jerry.ray@microchip.com>
To: Andrew Lunn <andrew@lunn.ch>,
Florian Fainelli <f.fainelli@gmail.com>,
Vladimir Oltean <olteanv@gmail.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>,
"Paolo Abeni" <pabeni@redhat.com>, <netdev@vger.kernel.org>,
<linux-kernel@vger.kernel.org>, <linux@armlinux.org.uk>,
Jerry Ray <jerry.ray@microchip.com>
Subject: [PATCH net-next v3 1/2] dsa: lan9303: Add port_max_mtu API
Date: Tue, 6 Dec 2022 12:34:59 -0600 [thread overview]
Message-ID: <20221206183500.6898-2-jerry.ray@microchip.com> (raw)
In-Reply-To: <20221206183500.6898-1-jerry.ray@microchip.com>
Adding in support for reporting the max mtu for a given
port.
Signed-off-by: Jerry Ray <jerry.ray@microchip.com>
---
drivers/net/dsa/lan9303-core.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/drivers/net/dsa/lan9303-core.c b/drivers/net/dsa/lan9303-core.c
index 80f07bd20593..baa336bb9d15 100644
--- a/drivers/net/dsa/lan9303-core.c
+++ b/drivers/net/dsa/lan9303-core.c
@@ -1279,6 +1279,25 @@ static int lan9303_port_mdb_del(struct dsa_switch *ds, int port,
return 0;
}
+/* For non-cpu ports, the max frame size is 1518.
+ * The CPU port supports a max frame size of 1522.
+ * There is a JUMBO flag to make the max size 2048, but this driver
+ * presently does not support using it.
+ */
+static int lan9303_port_max_mtu(struct dsa_switch *ds, int port)
+{
+ struct net_device *p = dsa_port_to_master(dsa_to_port(ds, port));
+ struct lan9303 *chip = ds->priv;
+
+ dev_dbg(chip->dev, "%s(%d) entered. NET max_mtu is %d",
+ __func__, port, p->max_mtu);
+
+ if (dsa_port_is_cpu(dsa_to_port(ds, port)))
+ return 1522 - ETH_HLEN - ETH_FCS_LEN;
+ else
+ return 1518 - ETH_HLEN - ETH_FCS_LEN;
+}
+
static const struct dsa_switch_ops lan9303_switch_ops = {
.get_tag_protocol = lan9303_get_tag_protocol,
.setup = lan9303_setup,
@@ -1299,6 +1318,7 @@ static const struct dsa_switch_ops lan9303_switch_ops = {
.port_fdb_dump = lan9303_port_fdb_dump,
.port_mdb_add = lan9303_port_mdb_add,
.port_mdb_del = lan9303_port_mdb_del,
+ .port_max_mtu = lan9303_port_max_mtu,
};
static int lan9303_register_switch(struct lan9303 *chip)
--
2.17.1
next prev parent reply other threads:[~2022-12-06 18:35 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-06 18:34 [PATCH net-next v3 0/2] dsa: lan9303: Move to PHYLINK Jerry Ray
2022-12-06 18:34 ` Jerry Ray [this message]
2022-12-06 18:56 ` [PATCH net-next v3 1/2] dsa: lan9303: Add port_max_mtu API Vladimir Oltean
2022-12-06 23:44 ` Jerry.Ray
2022-12-07 11:39 ` Vladimir Oltean
2022-12-06 18:35 ` [PATCH net-next v3 2/2] dsa: lan9303: Move to PHYLINK Jerry Ray
2022-12-06 19:32 ` Vladimir Oltean
2022-12-06 21:07 ` Russell King (Oracle)
2022-12-06 22:12 ` Vladimir Oltean
2022-12-06 22:58 ` Jerry.Ray
2022-12-07 14:01 ` Vladimir Oltean
2022-12-06 18:57 ` [PATCH net-next v3 0/2] " Vladimir Oltean
2022-12-06 23:58 ` Jerry.Ray
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221206183500.6898-2-jerry.ray@microchip.com \
--to=jerry.ray@microchip.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=f.fainelli@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).