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-next>] [day] [month] [year] [list]
Message-Id: <20201115004151.12899-1-afaerber@suse.de>
Date:   Sun, 15 Nov 2020 01:41:51 +0100
From:   Andreas Färber <afaerber@...e.de>
To:     "David S . Miller" <davem@...emloft.net>,
        Thomas Petazzoni <thomas.petazzoni@...tlin.com>
Cc:     Uwe Kleine-König <uwe@...ine-koenig.org>,
        Michal Hrusecki <Michal.Hrusecky@....cz>,
        Tomas Hlavacek <tomas.hlavacek@....cz>,
        Bedřicha Košatu <bedrich.kosata@....cz>,
        Andreas Färber <afaerber@...e.de>,
        Sascha Hauer <s.hauer@...gutronix.de>,
        Marek Behún <kabel@...nel.org>,
        Andrew Lunn <andrew@...n.ch>,
        Jason Cooper <jason@...edaemon.net>,
        Gregory CLEMENT <gregory.clement@...tlin.com>,
        Jakub Kicinski <kuba@...nel.org>,
        Russell King <linux@...linux.org.uk>, netdev@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: [PATCH net-next] net: mvneta: Fix validation of 2.5G HSGMII without comphy

Commit 1a642ca7f38992b086101fe204a1ae3c90ed8016 (net: ethernet: mvneta:
Add 2500BaseX support for SoCs without comphy) added support for 2500BaseX.

In case a comphy is not provided, mvneta_validate()'s check
  state->interface == PHY_INTERFACE_MODE_2500BASEX
could never be true (it would've returned with empty bitmask before),
so that 2500baseT_Full and 2500baseX_Full do net get added to the mask.

This causes phylink_sfp_config() to fail validation of 2.5G SFP support.

Address this by adding 2500baseX_Full and 2500baseT_Full to the mask for
  state->interface == PHY_INTERFACE_MODE_NA
as well.

Also handle PHY_INTERFACE_MODE_2500BASEX in two checks for allowed modes
and update a comment.

Tested with 2.5G and 1G SFPs on Turris Omnia before assigning comphy.

Fixes: 1a642ca7f389 ("net: ethernet: mvneta: Add 2500BaseX support for SoCs without comphy")
Cc: Sascha Hauer <s.hauer@...gutronix.de>
Cc: David S. Miller <davem@...emloft.net>
Cc: Marek Behún <kabel@...nel.org>
Cc: Andrew Lunn <andrew@...n.ch>
Cc: Uwe Kleine-König <uwe@...ine-koenig.org>
Cc: Jason Cooper <jason@...edaemon.net>
Cc: Gregory CLEMENT <gregory.clement@...tlin.com>
Signed-off-by: Andreas Färber <afaerber@...e.de>
---
 drivers/net/ethernet/marvell/mvneta.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c
index 54b0bf574c05..c5016036de3a 100644
--- a/drivers/net/ethernet/marvell/mvneta.c
+++ b/drivers/net/ethernet/marvell/mvneta.c
@@ -3812,10 +3812,11 @@ static void mvneta_validate(struct phylink_config *config,
 	struct mvneta_port *pp = netdev_priv(ndev);
 	__ETHTOOL_DECLARE_LINK_MODE_MASK(mask) = { 0, };
 
-	/* We only support QSGMII, SGMII, 802.3z and RGMII modes */
+	/* We only support QSGMII, SGMII, HSGMII, 802.3z and RGMII modes */
 	if (state->interface != PHY_INTERFACE_MODE_NA &&
 	    state->interface != PHY_INTERFACE_MODE_QSGMII &&
 	    state->interface != PHY_INTERFACE_MODE_SGMII &&
+	    state->interface != PHY_INTERFACE_MODE_2500BASEX &&
 	    !phy_interface_mode_is_8023z(state->interface) &&
 	    !phy_interface_mode_is_rgmii(state->interface)) {
 		bitmap_zero(supported, __ETHTOOL_LINK_MODE_MASK_NBITS);
@@ -3834,7 +3835,8 @@ static void mvneta_validate(struct phylink_config *config,
 		phylink_set(mask, 1000baseT_Full);
 		phylink_set(mask, 1000baseX_Full);
 	}
-	if (pp->comphy || state->interface == PHY_INTERFACE_MODE_2500BASEX) {
+	if (pp->comphy || state->interface == PHY_INTERFACE_MODE_2500BASEX
+		       || state->interface == PHY_INTERFACE_MODE_NA) {
 		phylink_set(mask, 2500baseT_Full);
 		phylink_set(mask, 2500baseX_Full);
 	}
@@ -5038,6 +5040,7 @@ static int mvneta_port_power_up(struct mvneta_port *pp, int phy_mode)
 
 	if (phy_mode != PHY_INTERFACE_MODE_QSGMII &&
 	    phy_mode != PHY_INTERFACE_MODE_SGMII &&
+	    phy_mode != PHY_INTERFACE_MODE_2500BASEX &&
 	    !phy_interface_mode_is_8023z(phy_mode) &&
 	    !phy_interface_mode_is_rgmii(phy_mode))
 		return -EINVAL;
-- 
2.28.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ