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: <20250114125739.sgegfxibbzpc2uor@skbuf>
Date: Tue, 14 Jan 2025 14:57:39 +0200
From: Vladimir Oltean <olteanv@...il.com>
To: "Russell King (Oracle)" <rmk+kernel@...linux.org.uk>
Cc: Andrew Lunn <andrew@...n.ch>, Heiner Kallweit <hkallweit1@...il.com>,
	Alexander Couzens <lynxis@...0.eu>,
	Alexander Duyck <alexanderduyck@...com>,
	Andrew Lunn <andrew+netdev@...n.ch>,
	AngeloGioacchino Del Regno <angelogioacchino.delregno@...labora.com>,
	"Chester A. Unal" <chester.a.unal@...nc9.com>,
	Claudiu Beznea <claudiu.beznea@...on.dev>,
	Daniel Golle <daniel@...rotopia.org>,
	Daniel Machon <daniel.machon@...rochip.com>,
	"David S. Miller" <davem@...emloft.net>,
	DENG Qingfang <dqfext@...il.com>,
	Eric Dumazet <edumazet@...gle.com>,
	Florian Fainelli <florian.fainelli@...adcom.com>,
	Horatiu Vultur <horatiu.vultur@...rochip.com>,
	Ioana Ciornei <ioana.ciornei@....com>,
	Jakub Kicinski <kuba@...nel.org>, kernel-team@...a.com,
	linux-arm-kernel@...ts.infradead.org,
	linux-mediatek@...ts.infradead.org,
	Madalin Bucur <madalin.bucur@....com>,
	Marcin Wojtas <marcin.s.wojtas@...il.com>,
	Matthias Brugger <matthias.bgg@...il.com>,
	Michal Simek <michal.simek@....com>, netdev@...r.kernel.org,
	Nicolas Ferre <nicolas.ferre@...rochip.com>,
	Paolo Abeni <pabeni@...hat.com>,
	Radhey Shyam Pandey <radhey.shyam.pandey@....com>,
	Sean Anderson <sean.anderson@...o.com>,
	Sean Wang <sean.wang@...iatek.com>,
	Steen Hegelund <Steen.Hegelund@...rochip.com>,
	Taras Chornyi <taras.chornyi@...ision.eu>,
	UNGLinuxDriver@...rochip.com, Eric Woudstra <ericwouds@...il.com>
Subject: Re: [PATCH net-next v2 5/5] net: phylink: provide fixed state for
 1000base-X and 2500base-X

On Mon, Jan 13, 2025 at 09:22:44AM +0000, Russell King (Oracle) wrote:
> When decoding clause 22 state, if in-band is disabled and using either
> 1000base-X or 2500base-X, rather than reporting link-down, we know the
> speed, and we only support full duplex. Pause modes taken from XPCS.
> 
> This fixes a problem reported by Eric Woudstra.
> 
> Signed-off-by: Russell King (Oracle) <rmk+kernel@...linux.org.uk>
> ---
>  drivers/net/phy/phylink.c | 29 +++++++++++++++++++----------
>  1 file changed, 19 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
> index b79f975bc164..ff0efb52189f 100644
> --- a/drivers/net/phy/phylink.c
> +++ b/drivers/net/phy/phylink.c
> @@ -3882,27 +3882,36 @@ void phylink_mii_c22_pcs_decode_state(struct phylink_link_state *state,
>  	if (!state->link)
>  		return;
>  
> -	/* If in-band is disabled, then the advertisement data is not
> -	 * meaningful.
> -	 */
> -	if (neg_mode != PHYLINK_PCS_NEG_INBAND_ENABLED)
> -		return;
> -
>  	switch (state->interface) {
>  	case PHY_INTERFACE_MODE_1000BASEX:
> -		phylink_decode_c37_word(state, lpa, SPEED_1000);
> +		if (neg_mode == PHYLINK_PCS_NEG_INBAND_ENABLED) {
> +			phylink_decode_c37_word(state, lpa, SPEED_1000);
> +		} else {
> +			state->speed = SPEED_1000;
> +			state->duplex = DUPLEX_FULL;
> +			state->pause |= MLO_PAUSE_TX | MLO_PAUSE_RX;
> +		}
>  		break;
>  
>  	case PHY_INTERFACE_MODE_2500BASEX:
> -		phylink_decode_c37_word(state, lpa, SPEED_2500);
> +		if (neg_mode == PHYLINK_PCS_NEG_INBAND_ENABLED) {
> +			phylink_decode_c37_word(state, lpa, SPEED_2500);
> +		} else {
> +			state->speed = SPEED_2500;
> +			state->duplex = DUPLEX_FULL;
> +			state->pause |= MLO_PAUSE_TX | MLO_PAUSE_RX;
> +		}
>  		break;

Are the "else" branches necessary, given the "else" branch from
phylink_mac_pcs_get_state?

static void phylink_mac_pcs_get_state(struct phylink *pl,
				      struct phylink_link_state *state)
{
	struct phylink_pcs *pcs;
	bool autoneg;

	linkmode_copy(state->advertising, pl->link_config.advertising);
	linkmode_zero(state->lp_advertising);
	state->interface = pl->link_config.interface;
	state->rate_matching = pl->link_config.rate_matching;
	state->an_complete = 0;
	state->link = 1;

	pcs = pl->pcs;
	if (!pcs || pcs->neg_mode)
		autoneg = pl->pcs_neg_mode == PHYLINK_PCS_NEG_INBAND_ENABLED;
	else
		autoneg = linkmode_test_bit(ETHTOOL_LINK_MODE_Autoneg_BIT,
					    state->advertising);

	if (autoneg) {
		state->speed = SPEED_UNKNOWN;
		state->duplex = DUPLEX_UNKNOWN;
		state->pause = MLO_PAUSE_NONE;
	} else {						|
		state->speed =  pl->link_config.speed;		|
		state->duplex = pl->link_config.duplex;		| this
		state->pause = pl->link_config.pause;		|
	}							|

	if (pcs)
		pcs->ops->pcs_get_state(pcs, pl->pcs_neg_mode, state);
	else
		state->link = 0;
}

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ