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] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 22 Feb 2022 16:52:17 -0800
From:   Jakub Kicinski <kuba@...nel.org>
To:     Oleksij Rempel <o.rempel@...gutronix.de>
Cc:     Woojung Huh <woojung.huh@...rochip.com>,
        UNGLinuxDriver@...rochip.com, Andrew Lunn <andrew@...n.ch>,
        Florian Fainelli <f.fainelli@...il.com>,
        Vivien Didelot <vivien.didelot@...il.com>,
        Vladimir Oltean <olteanv@...il.com>,
        "David S. Miller" <davem@...emloft.net>, kernel@...gutronix.de,
        netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH net-next v1 1/1] net: dsa: microchip: ksz9477: implement
 MTU configuration

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?

> +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.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ