From: DENG Qingfang <dqfext@gmail.com>
To: netdev@vger.kernel.org
Cc: "René van Dorst" <opensource@vdorst.com>,
"John Crispin" <john@phrozen.org>,
"Vivien Didelot" <vivien.didelot@gmail.com>,
"Florian Fainelli" <f.fainelli@gmail.com>,
"Andrew Lunn" <andrew@lunn.ch>,
"Sean Wang" <sean.wang@mediatek.com>,
"Weijie Gao" <weijie.gao@mediatek.com>
Subject: [PATCH net-next] net: dsa: mt7530: enable jumbo frame
Date: Thu, 9 Apr 2020 23:54:09 +0800 [thread overview]
Message-ID: <20200409155409.12043-1-dqfext@gmail.com> (raw)
Enable jumbo frame for MT7530
It allows frames up to 15 KB (including FCS)
Signed-off-by: DENG Qingfang <dqfext@gmail.com>
---
drivers/net/dsa/mt7530.c | 16 ++++++++++++++++
drivers/net/dsa/mt7530.h | 7 +++++++
2 files changed, 23 insertions(+)
diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c
index 2d0d91db0ddb..ed080ded34a7 100644
--- a/drivers/net/dsa/mt7530.c
+++ b/drivers/net/dsa/mt7530.c
@@ -1284,6 +1284,19 @@ mtk_get_tag_protocol(struct dsa_switch *ds, int port,
}
}
+static void
+mt7530_set_jumbo(struct mt7530_priv *priv, u8 kilobytes)
+{
+ if (kilobytes > 15)
+ kilobytes = 15;
+
+ if (kilobytes > 1)
+ mt7530_rmw(priv, MT7530_GMACCR, MAX_RX_JUMBO_MASK | MAX_RX_PKT_LEN_MASK,
+ MAX_RX_JUMBO_KB(kilobytes) | MAX_RX_PKT_LEN_JMB);
+ else
+ mt7530_rmw(priv, MT7530_GMACCR, MAX_RX_PKT_LEN_MASK, MAX_RX_PKT_LEN_1536);
+}
+
static int
mt7530_setup(struct dsa_switch *ds)
{
@@ -1428,6 +1441,9 @@ mt7530_setup(struct dsa_switch *ds)
if (ret < 0)
return ret;
+ /* Enable jumbo frame up to 15 KB */
+ mt7530_set_jumbo(priv, 15);
+
return 0;
}
diff --git a/drivers/net/dsa/mt7530.h b/drivers/net/dsa/mt7530.h
index ef9b52f3152b..62f5ea64670d 100644
--- a/drivers/net/dsa/mt7530.h
+++ b/drivers/net/dsa/mt7530.h
@@ -223,6 +223,13 @@ enum mt7530_vlan_port_attr {
#define PMSR_DPX BIT(1)
#define PMSR_LINK BIT(0)
+#define MT7530_GMACCR 0x30e0
+#define MAX_RX_JUMBO_KB(x) ((x) << 2)
+#define MAX_RX_JUMBO_MASK MAX_RX_JUMBO_KB(0xf)
+#define MAX_RX_PKT_LEN_MASK 0x3
+#define MAX_RX_PKT_LEN_1536 0x1
+#define MAX_RX_PKT_LEN_JMB MAX_RX_PKT_LEN_MASK
+
/* Register for MIB */
#define MT7530_PORT_MIB_COUNTER(x) (0x4000 + (x) * 0x100)
#define MT7530_MIB_CCR 0x4fe0
--
2.26.0
next reply other threads:[~2020-04-09 15:54 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-09 15:54 DENG Qingfang [this message]
2020-04-09 17:20 ` [PATCH net-next] net: dsa: mt7530: enable jumbo frame David Miller
2020-04-10 2:19 ` DENG Qingfang
2020-04-10 2:27 ` Florian Fainelli
2020-04-10 2:49 ` DENG Qingfang
2020-04-10 10:46 ` Vladimir Oltean
2020-04-14 3:03 ` DENG Qingfang
2020-04-14 9:38 ` 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=20200409155409.12043-1-dqfext@gmail.com \
--to=dqfext@gmail.com \
--cc=andrew@lunn.ch \
--cc=f.fainelli@gmail.com \
--cc=john@phrozen.org \
--cc=netdev@vger.kernel.org \
--cc=opensource@vdorst.com \
--cc=sean.wang@mediatek.com \
--cc=vivien.didelot@gmail.com \
--cc=weijie.gao@mediatek.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).