From: Oleksij Rempel <o.rempel@pengutronix.de>
To: Jakub Kicinski <kuba@kernel.org>
Cc: Woojung Huh <woojung.huh@microchip.com>,
Andrew Lunn <andrew@lunn.ch>,
Florian Fainelli <f.fainelli@gmail.com>,
"David S. Miller" <davem@davemloft.net>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
UNGLinuxDriver@microchip.com, kernel@pengutronix.de,
Vladimir Oltean <olteanv@gmail.com>,
Vivien Didelot <vivien.didelot@gmail.com>
Subject: Re: [PATCH net-next v1 1/1] net: dsa: microchip: ksz9477: implement MTU configuration
Date: Wed, 23 Feb 2022 08:54:04 +0100 [thread overview]
Message-ID: <20220223075404.GA4594@pengutronix.de> (raw)
In-Reply-To: <20220222165217.62426462@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>
On Tue, Feb 22, 2022 at 04:52:17PM -0800, Jakub Kicinski wrote:
> On Mon, 21 Feb 2022 09:43:28 +0100 Oleksij Rempel wrote:
> > This chips supports two ways to configure max MTU size:
> > - by setting SW_LEGAL_PACKET_DISABLE bit: if this bit is 0 allowed packed size
> > will be between 64 and bytes 1518. If this bit is 1, it will accept
> > packets up to 2000 bytes.
> > - by setting SW_JUMBO_PACKET bit. If this bit is set, the chip will
> > ignore SW_LEGAL_PACKET_DISABLE value and use REG_SW_MTU__2 register to
> > configure MTU size.
> >
> > Current driver has disabled SW_JUMBO_PACKET bit and activates
> > SW_LEGAL_PACKET_DISABLE. So the switch will pass all packets up to 2000 without
> > any way to configure it.
> >
> > By providing port_change_mtu we are switch to SW_JUMBO_PACKET way and will
> > be able to configure MTU up to ~9000.
>
> And it has no negative side affects to always have jumbo enabled?
> Maybe the internal buffer will be carved up in a different way?
Hm I tested it with iperf3 on 4 of 7 ports on this switch without
noticeable changes before and after this patch. My setup looks as
following:
----`
| /- iperf -s
= port0
| \- iperf3 -c 172.17.0.11 -t 100
|
|
= port1 ... same as port0, ... -c 172.17.0.10
= port2 ... same as port0, ... -c 172.17.0.13
= port3 ... same as port0, ... -c 172.17.0.12
Each port was sending and receiving. Each instance reported 938 Mbits/sec
> > +static int ksz9477_change_mtu(struct dsa_switch *ds, int port, int mtu)
> > +{
> > + struct ksz_device *dev = ds->priv;
> > + u16 new_mtu, max_mtu = 0;
> > + int i;
> > +
> > + new_mtu = mtu + ETH_HLEN + VLAN_HLEN + ETH_FCS_LEN;
> > +
> > + if (dsa_is_cpu_port(ds, port))
> > + new_mtu += KSZ9477_INGRESS_TAG_LEN;
> > +
> > + /* Cache the per-port MTU setting */
> > + dev->ports[port].max_mtu = new_mtu;
> > +
> > + for (i = 0; i < dev->port_cnt; i++) {
> > + if (dev->ports[i].max_mtu > max_mtu)
> > + max_mtu = dev->ports[i].max_mtu;
> > + }
>
> nit:
>
> for (...)
> max_mtu = max(max_mtu, dev->ports[i].max_mtu)
>
> > @@ -41,6 +41,7 @@ struct ksz_port {
> >
> > struct ksz_port_mib mib;
> > phy_interface_t interface;
> > + unsigned int max_mtu;
> > };
>
> max_mtu already has two meanings in this patch, let's call this
> max_frame or max_len etc, instead of adding a third meaning.
Ok, thx. Will update the patch.
Regards,
Oleksij
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
prev parent reply other threads:[~2022-02-23 7:54 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-21 8:43 [PATCH net-next v1 1/1] net: dsa: microchip: ksz9477: implement MTU configuration Oleksij Rempel
2022-02-23 0:52 ` Jakub Kicinski
2022-02-23 7:54 ` Oleksij Rempel [this message]
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=20220223075404.GA4594@pengutronix.de \
--to=o.rempel@pengutronix.de \
--cc=UNGLinuxDriver@microchip.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=f.fainelli@gmail.com \
--cc=kernel@pengutronix.de \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=vivien.didelot@gmail.com \
--cc=woojung.huh@microchip.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