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:
 <AM5PR04MB3139B5D33C36819D51919A5088552@AM5PR04MB3139.eurprd04.prod.outlook.com>
Date: Fri, 23 Feb 2024 06:03:32 +0000
From: Wei Fang <wei.fang@....com>
To: Oleksij Rempel <o.rempel@...gutronix.de>, "David S. Miller"
	<davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>, Jakub Kicinski
	<kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>, Andrew Lunn
	<andrew@...n.ch>, Heiner Kallweit <hkallweit1@...il.com>, Russell King
	<linux@...linux.org.uk>
CC: "kernel@...gutronix.de" <kernel@...gutronix.de>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"netdev@...r.kernel.org" <netdev@...r.kernel.org>, Shenwei Wang
	<shenwei.wang@....com>, Clark Wang <xiaoning.wang@....com>, dl-linux-imx
	<linux-imx@....com>
Subject: RE: [PATCH net-next v5 7/8] net: fec: Move fec_enet_eee_mode_set()
 and helper earlier

> -----Original Message-----
> From: Oleksij Rempel <o.rempel@...gutronix.de>
> Sent: 2024年2月21日 14:21
> To: Wei Fang <wei.fang@....com>; David S. Miller <davem@...emloft.net>;
> Eric Dumazet <edumazet@...gle.com>; Jakub Kicinski <kuba@...nel.org>;
> Paolo Abeni <pabeni@...hat.com>; Andrew Lunn <andrew@...n.ch>;
> Heiner Kallweit <hkallweit1@...il.com>; Russell King
> <linux@...linux.org.uk>
> Cc: Oleksij Rempel <o.rempel@...gutronix.de>; kernel@...gutronix.de;
> linux-kernel@...r.kernel.org; netdev@...r.kernel.org; Shenwei Wang
> <shenwei.wang@....com>; Clark Wang <xiaoning.wang@....com>;
> dl-linux-imx <linux-imx@....com>
> Subject: [PATCH net-next v5 7/8] net: fec: Move fec_enet_eee_mode_set()
> and helper earlier
> 
> From: Andrew Lunn <andrew@...n.ch>
> 
> FEC is about to get its EEE code re-written. To allow this, move
> fec_enet_eee_mode_set() before fec_enet_adjust_link() which will need to
> call it.
> 
> Signed-off-by: Andrew Lunn <andrew@...n.ch>
> Signed-off-by: Oleksij Rempel <o.rempel@...gutronix.de>
> ---
>  drivers/net/ethernet/freescale/fec_main.c | 75 ++++++++++++-----------
>  1 file changed, 38 insertions(+), 37 deletions(-)
> 
> diff --git a/drivers/net/ethernet/freescale/fec_main.c
> b/drivers/net/ethernet/freescale/fec_main.c
> index 207f1f66c117..a2c786550342 100644
> --- a/drivers/net/ethernet/freescale/fec_main.c
> +++ b/drivers/net/ethernet/freescale/fec_main.c
> @@ -2017,6 +2017,44 @@ static int fec_get_mac(struct net_device *ndev)
>  /*
>   * Phy section
>   */
> +
> +/* LPI Sleep Ts count base on tx clk (clk_ref).
> + * The lpi sleep cnt value = X us / (cycle_ns).
> + */
> +static int fec_enet_us_to_tx_cycle(struct net_device *ndev, int us) {
> +	struct fec_enet_private *fep = netdev_priv(ndev);
> +
> +	return us * (fep->clk_ref_rate / 1000) / 1000; }
> +
> +static int fec_enet_eee_mode_set(struct net_device *ndev, bool enable)
> +{
> +	struct fec_enet_private *fep = netdev_priv(ndev);
> +	struct ethtool_keee *p = &fep->eee;
> +	unsigned int sleep_cycle, wake_cycle;
> +	int ret = 0;
> +
> +	if (enable) {
> +		ret = phy_init_eee(ndev->phydev, false);
> +		if (ret)
> +			return ret;
> +
> +		sleep_cycle = fec_enet_us_to_tx_cycle(ndev, p->tx_lpi_timer);
> +		wake_cycle = sleep_cycle;
> +	} else {
> +		sleep_cycle = 0;
> +		wake_cycle = 0;
> +	}
> +
> +	p->tx_lpi_enabled = enable;
> +
> +	writel(sleep_cycle, fep->hwp + FEC_LPI_SLEEP);
> +	writel(wake_cycle, fep->hwp + FEC_LPI_WAKE);
> +
> +	return 0;
> +}
> +
>  static void fec_enet_adjust_link(struct net_device *ndev)  {
>  	struct fec_enet_private *fep = netdev_priv(ndev); @@ -3121,43 +3159,6
> @@ static int fec_enet_set_coalesce(struct net_device *ndev,
>  	return 0;
>  }
> 
> -/* LPI Sleep Ts count base on tx clk (clk_ref).
> - * The lpi sleep cnt value = X us / (cycle_ns).
> - */
> -static int fec_enet_us_to_tx_cycle(struct net_device *ndev, int us) -{
> -	struct fec_enet_private *fep = netdev_priv(ndev);
> -
> -	return us * (fep->clk_ref_rate / 1000) / 1000;
> -}
> -
> -static int fec_enet_eee_mode_set(struct net_device *ndev, bool enable) -{
> -	struct fec_enet_private *fep = netdev_priv(ndev);
> -	struct ethtool_keee *p = &fep->eee;
> -	unsigned int sleep_cycle, wake_cycle;
> -	int ret = 0;
> -
> -	if (enable) {
> -		ret = phy_init_eee(ndev->phydev, false);
> -		if (ret)
> -			return ret;
> -
> -		sleep_cycle = fec_enet_us_to_tx_cycle(ndev, p->tx_lpi_timer);
> -		wake_cycle = sleep_cycle;
> -	} else {
> -		sleep_cycle = 0;
> -		wake_cycle = 0;
> -	}
> -
> -	p->tx_lpi_enabled = enable;
> -
> -	writel(sleep_cycle, fep->hwp + FEC_LPI_SLEEP);
> -	writel(wake_cycle, fep->hwp + FEC_LPI_WAKE);
> -
> -	return 0;
> -}
> -
>  static int
>  fec_enet_get_eee(struct net_device *ndev, struct ethtool_keee *edata)  {
> --
> 2.39.2

Reviewed-by: Wei Fang <wei.fang@....com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ