All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sergei Antonov <saproj@gmail.com>
To: netdev@vger.kernel.org
Cc: Sergei Antonov <saproj@gmail.com>,
	Vladimir Oltean <olteanv@gmail.com>,
	Florian Fainelli <f.fainelli@gmail.com>
Subject: [PATCH] net: dsa: mv88e6060: report max mtu 1536
Date: Wed, 10 Aug 2022 11:27:45 +0300	[thread overview]
Message-ID: <20220810082745.1466895-1-saproj@gmail.com> (raw)

This driver sets the MaxFrameSize bit to 1 during setup,
see GLOBAL_CONTROL_MAX_FRAME_1536 in mv88e6060_setup_global().
Thus MTU is always 1536.
Introduce mv88e6060_port_max_mtu() to report it back to system.

Signed-off-by: Sergei Antonov <saproj@gmail.com>
CC: Vladimir Oltean <olteanv@gmail.com>
CC: Florian Fainelli <f.fainelli@gmail.com>
---
 drivers/net/dsa/mv88e6060.c | 7 ++++++-
 drivers/net/dsa/mv88e6060.h | 1 +
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/net/dsa/mv88e6060.c b/drivers/net/dsa/mv88e6060.c
index a4c6eb9a52d0..c53734379b96 100644
--- a/drivers/net/dsa/mv88e6060.c
+++ b/drivers/net/dsa/mv88e6060.c
@@ -160,7 +160,6 @@ static int mv88e6060_setup_addr(struct mv88e6060_priv *priv)
 	u16 val;
 
 	eth_random_addr(addr);
-
 	val = addr[0] << 8 | addr[1];
 
 	/* The multicast bit is always transmitted as a zero, so the switch uses
@@ -212,6 +211,11 @@ static int mv88e6060_setup(struct dsa_switch *ds)
 	return 0;
 }
 
+static int mv88e6060_port_max_mtu(struct dsa_switch *ds, int port)
+{
+	return MV88E6060_MAX_MTU;
+}
+
 static int mv88e6060_port_to_phy_addr(int port)
 {
 	if (port >= 0 && port < MV88E6060_PORTS)
@@ -247,6 +251,7 @@ mv88e6060_phy_write(struct dsa_switch *ds, int port, int regnum, u16 val)
 static const struct dsa_switch_ops mv88e6060_switch_ops = {
 	.get_tag_protocol = mv88e6060_get_tag_protocol,
 	.setup		= mv88e6060_setup,
+	.port_max_mtu	= mv88e6060_port_max_mtu,
 	.phy_read	= mv88e6060_phy_read,
 	.phy_write	= mv88e6060_phy_write,
 };
diff --git a/drivers/net/dsa/mv88e6060.h b/drivers/net/dsa/mv88e6060.h
index 6c13c2421b64..382fe462fb2d 100644
--- a/drivers/net/dsa/mv88e6060.h
+++ b/drivers/net/dsa/mv88e6060.h
@@ -11,6 +11,7 @@
 #define __MV88E6060_H
 
 #define MV88E6060_PORTS	6
+#define MV88E6060_MAX_MTU	1536
 
 #define REG_PORT(p)		(0x8 + (p))
 #define PORT_STATUS		0x00
-- 
2.32.0


             reply	other threads:[~2022-08-10  8:28 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-10  8:27 Sergei Antonov [this message]
2022-08-10 10:08 ` [PATCH] net: dsa: mv88e6060: report max mtu 1536 Vladimir Oltean
2022-08-10 12:00   ` Sergei Antonov
2022-08-10 13:35     ` Vladimir Oltean
2022-08-10 15:56       ` Sergei Antonov
2022-08-10 19:38         ` Vladimir Oltean
2022-08-11  8:23           ` Sergei Antonov
2022-08-11 14:12             ` Andrew Lunn
2022-08-17 17:09               ` Sergei Antonov
2022-08-16 20:42             ` Vladimir Oltean

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=20220810082745.1466895-1-saproj@gmail.com \
    --to=saproj@gmail.com \
    --cc=f.fainelli@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.