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, 16 Apr 2024 17:56:15 +0100
From: "Russell King (Oracle)" <linux@...linux.org.uk>
To: Matthias Schiffer <matthias.schiffer@...tq-group.com>
Cc: Andrew Lunn <andrew@...n.ch>, Florian Fainelli <f.fainelli@...il.com>,
	Vladimir Oltean <olteanv@...il.com>,
	"David S. Miller" <davem@...emloft.net>,
	Eric Dumazet <edumazet@...gle.com>,
	Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
	netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
	linux@...tq-group.com
Subject: Re: [PATCH net] net: dsa: mv88e6xx: fix supported_interfaces setup
 in mv88e6250_phylink_get_caps()

On Tue, Apr 16, 2024 at 05:50:54PM +0200, Matthias Schiffer wrote:
> +int mv88e6250_port_get_mode(struct mv88e6xxx_chip *chip, int port,
> +			    phy_interface_t *mode)
> +{
> +	int err;
> +	u16 reg;
> +
> +	if (port < 5) {
> +		*mode = PHY_INTERFACE_MODE_INTERNAL;
> +		return 0;
> +	}

Note that if mv88e6xxx_phy_is_internal() returns TRUE for the port,
then this will be handled automatically.

> +
> +	err = mv88e6xxx_port_read(chip, port, MV88E6XXX_PORT_STS, &reg);
> +	if (err)
> +		return err;
> +
> +	switch (reg & MV88E6250_PORT_STS_PORTMODE_MASK) {
> +	case MV88E6250_PORT_STS_PORTMODE_MII_10_HALF_PHY:
> +	case MV88E6250_PORT_STS_PORTMODE_MII_100_HALF_PHY:
> +	case MV88E6250_PORT_STS_PORTMODE_MII_10_FULL_PHY:
> +	case MV88E6250_PORT_STS_PORTMODE_MII_100_FULL_PHY:
> +		*mode = PHY_INTERFACE_MODE_REVMII;
> +		break;
> +
> +	case MV88E6250_PORT_STS_PORTMODE_MII_HALF:
> +	case MV88E6250_PORT_STS_PORTMODE_MII_FULL:
> +		*mode = PHY_INTERFACE_MODE_MII;
> +		break;
> +
> +	case MV88E6250_PORT_STS_PORTMODE_MII_DUAL_100_RMII_FULL_PHY:
> +	case MV88E6250_PORT_STS_PORTMODE_MII_200_RMII_FULL_PHY:
> +	case MV88E6250_PORT_STS_PORTMODE_MII_10_100_RMII_HALF_PHY:
> +	case MV88E6250_PORT_STS_PORTMODE_MII_10_100_RMII_FULL_PHY:
> +		*mode = PHY_INTERFACE_MODE_REVRMII;
> +		break;
> +
> +	case MV88E6250_PORT_STS_PORTMODE_MII_DUAL_100_RMII_FULL:
> +	case MV88E6250_PORT_STS_PORTMODE_MII_10_100_RMII_FULL:
> +		*mode = PHY_INTERFACE_MODE_RMII;
> +		break;
> +
> +	case MV88E6250_PORT_STS_PORTMODE_MII_100_RGMII:
> +		*mode = PHY_INTERFACE_MODE_RGMII;
> +		break;
> +
> +	default:
> +		*mode = PHY_INTERFACE_MODE_NA;

What does this mean? I don't allow PHY_INTERFACE_MODE_NA to be set in
the list of supported interfaces because it isn't an interface mode.
If it's invalid, then it's probably best to return an error.

I wonder whether it would just be better to pass the
supported_interfaces bitmap into this function and have it set the
appropriate bit itself, renaming the function to something more
better suited to that purpose.

Thanks.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ