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: <20200728150611.GO1551@shell.armlinux.org.uk>
Date:   Tue, 28 Jul 2020 16:06:11 +0100
From:   Russell King - ARM Linux admin <linux@...linux.org.uk>
To:     Ioana Ciornei <ioana.ciornei@....com>
Cc:     davem@...emloft.net, netdev@...r.kernel.org,
        vladimir.oltean@....com, claudiu.manoil@....com,
        alexandru.marginean@....com, andrew@...n.ch, f.fainelli@...il.com,
        olteanv@...il.com
Subject: Re: [PATCH net-next v4 1/5] net: phylink: add helper function to
 decode USXGMII word

On Fri, Jul 24, 2020 at 11:01:39AM +0300, Ioana Ciornei wrote:
> With the new addition of the USXGMII link partner ability constants we
> can now introduce a phylink helper that decodes the USXGMII word and
> populates the appropriate fields in the phylink_link_state structure
> based on them.
> 
> Signed-off-by: Ioana Ciornei <ioana.ciornei@....com>

Looks good, thanks.

Reviewed-by: Russell King <rmk+kernel@...linux.org.uk>

> ---
> Changes in v4:
>  - patch added
> 
>  drivers/net/phy/phylink.c | 43 +++++++++++++++++++++++++++++++++++++++
>  include/linux/phylink.h   |  3 +++
>  2 files changed, 46 insertions(+)
> 
> diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
> index 32b4bd6a5b55..d7810c908bb3 100644
> --- a/drivers/net/phy/phylink.c
> +++ b/drivers/net/phy/phylink.c
> @@ -2318,6 +2318,49 @@ static void phylink_decode_sgmii_word(struct phylink_link_state *state,
>  		state->duplex = DUPLEX_HALF;
>  }
>  
> +/**
> + * phylink_decode_usxgmii_word() - decode the USXGMII word from a MAC PCS
> + * @state: a pointer to a struct phylink_link_state.
> + * @lpa: a 16 bit value which stores the USXGMII auto-negotiation word
> + *
> + * Helper for MAC PCS supporting the USXGMII protocol and the auto-negotiation
> + * code word.  Decode the USXGMII code word and populate the corresponding fields
> + * (speed, duplex) into the phylink_link_state structure.
> + */
> +void phylink_decode_usxgmii_word(struct phylink_link_state *state,
> +				 uint16_t lpa)
> +{
> +	switch (lpa & MDIO_USXGMII_SPD_MASK) {
> +	case MDIO_USXGMII_10:
> +		state->speed = SPEED_10;
> +		break;
> +	case MDIO_USXGMII_100:
> +		state->speed = SPEED_100;
> +		break;
> +	case MDIO_USXGMII_1000:
> +		state->speed = SPEED_1000;
> +		break;
> +	case MDIO_USXGMII_2500:
> +		state->speed = SPEED_2500;
> +		break;
> +	case MDIO_USXGMII_5000:
> +		state->speed = SPEED_5000;
> +		break;
> +	case MDIO_USXGMII_10G:
> +		state->speed = SPEED_10000;
> +		break;
> +	default:
> +		state->link = false;
> +		return;
> +	}
> +
> +	if (lpa & MDIO_USXGMII_FULL_DUPLEX)
> +		state->duplex = DUPLEX_FULL;
> +	else
> +		state->duplex = DUPLEX_HALF;
> +}
> +EXPORT_SYMBOL_GPL(phylink_decode_usxgmii_word);
> +
>  /**
>   * phylink_mii_c22_pcs_get_state() - read the MAC PCS state
>   * @pcs: a pointer to a &struct mdio_device.
> diff --git a/include/linux/phylink.h b/include/linux/phylink.h
> index 1aad2aea4610..83fc149a7bd7 100644
> --- a/include/linux/phylink.h
> +++ b/include/linux/phylink.h
> @@ -485,4 +485,7 @@ void phylink_mii_c22_pcs_an_restart(struct mdio_device *pcs);
>  
>  void phylink_mii_c45_pcs_get_state(struct mdio_device *pcs,
>  				   struct phylink_link_state *state);
> +
> +void phylink_decode_usxgmii_word(struct phylink_link_state *state,
> +				 uint16_t lpa);
>  #endif
> -- 
> 2.25.1
> 
> 

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ