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]
Message-ID: <20230310152558.3ko7ufns4jexdkx7@skbuf>
Date:   Fri, 10 Mar 2023 17:25:58 +0200
From:   Vladimir Oltean <olteanv@...il.com>
To:     "Russell King (Oracle)" <linux@...linux.org.uk>
Cc:     Lukasz Majewski <lukma@...x.de>, Andrew Lunn <andrew@...n.ch>,
        Eric Dumazet <edumazet@...gle.com>,
        Florian Fainelli <f.fainelli@...il.com>,
        "David S. Miller" <davem@...emloft.net>,
        Jakub Kicinski <kuba@...nel.org>,
        Paolo Abeni <pabeni@...hat.com>,
        Alexander Duyck <alexander.duyck@...il.com>,
        netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 6/7] dsa: marvell: Correct value of max_frame_size
 variable after validation

On Fri, Mar 10, 2023 at 12:06:15PM +0000, Russell King (Oracle) wrote:
> It may be worth doing:
> 
> static int mv88e6xxx_g1_modify(struct mv88e6xxx_chip *chip, int reg,
> 			       u16 mask, u16 val)
> {
> 	int addr = chip->info->global1_addr;
> 	int err;
> 	u16 v;
> 
> 	err = mv88e6xxx_read(chip, addr, reg, &v);
> 	if (err < 0)
> 		return err;
> 
> 	v = (v & ~mask) | val;
> 
> 	return mv88e6xxx_write(chip, addr, reg, v);
> }
> 
> Then, mv88e6185_g1_set_max_frame_size() becomes:
> 
> int mv88e6185_g1_set_max_frame_size(struct mv88e6xxx_chip *chip, int mtu)
> {
> 	u16 val = 0;
> 
> 	if (mtu + ETH_HLEN + ETH_FCS_LEN > 1518)
> 		val = MV88E6185_G1_CTL1_MAX_FRAME_1632;
> 
> 	return mv88e6xxx_g1_modify(chip, MV88E6XXX_G1_CTL1,
> 				   MV88E6185_G1_CTL1_MAX_FRAME_1632, val);
> }
> 
> The 6250 variant becomes similar.

+1, sounds good to have separate mv88e6185_g1_set_max_frame_size() and
mv88e6250_g1_set_max_frame_size() with a common implementation. It is a
lot less confusing than the two driving a bit named in the same way but
meaning different things.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ