lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20220223075404.GA4594@pengutronix.de>
Date:   Wed, 23 Feb 2022 08:54:04 +0100
From:   Oleksij Rempel <o.rempel@...gutronix.de>
To:     Jakub Kicinski <kuba@...nel.org>
Cc:     Woojung Huh <woojung.huh@...rochip.com>,
        Andrew Lunn <andrew@...n.ch>,
        Florian Fainelli <f.fainelli@...il.com>,
        "David S. Miller" <davem@...emloft.net>, netdev@...r.kernel.org,
        linux-kernel@...r.kernel.org, UNGLinuxDriver@...rochip.com,
        kernel@...gutronix.de, Vladimir Oltean <olteanv@...il.com>,
        Vivien Didelot <vivien.didelot@...il.com>
Subject: Re: [PATCH net-next v1 1/1] net: dsa: microchip: ksz9477: implement
 MTU configuration

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 |

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ