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: Thu, 14 Dec 2023 22:41:53 +0300
From: Sergey Shtylyov <s.shtylyov@....ru>
To: Claudiu <claudiu.beznea@...on.dev>, <davem@...emloft.net>,
	<edumazet@...gle.com>, <kuba@...nel.org>, <pabeni@...hat.com>,
	<claudiu.beznea.uj@...renesas.com>, <yoshihiro.shimoda.uh@...esas.com>,
	<wsa+renesas@...g-engineering.com>, <niklas.soderlund+renesas@...natech.se>,
	<biju.das.jz@...renesas.com>, <prabhakar.mahadev-lad.rj@...renesas.com>,
	<mitsuhiro.kimura.kc@...esas.com>, <geert+renesas@...der.be>
CC: <netdev@...r.kernel.org>, <linux-renesas-soc@...r.kernel.org>,
	<linux-kernel@...r.kernel.org>
Subject: Re: [PATCH net 1/2] net: ravb: Wait for operation mode to be applied

resetOn 12/14/23 2:31 PM, Claudiu wrote:

> From: Claudiu Beznea <claudiu.beznea.uj@...renesas.com>
> 
> CSR.OPS bits specify the current operating mode and (according to
> documentation) they are updated when the operating mode change request
> is processed. Thus, check CSR.OPS before proceeding.

   The manuals I have indeed say we need to check CSR.OPS... But we only
need to wait iff we transfer from the operation mode to the config mode...

> Fixes: 568b3ce7a8ef ("ravb: factor out register bit twiddling code")
> Fixes: 0184165b2f42 ("ravb: add sleep PM suspend/resume support")
> Fixes: 7e09a052dc4e ("ravb: Exclude gPTP feature support for RZ/G2L")
> Fixes: 3e3d647715d4 ("ravb: add wake-on-lan support via magic packet")
> Fixes: c156633f1353 ("Renesas Ethernet AVB driver proper")

   Hm, that long list does look weird...

> Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@...renesas.com>
> ---
>  drivers/net/ethernet/renesas/ravb_main.c | 47 ++++++++++++++++++++----
>  1 file changed, 39 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
> index 9178f6d60e74..ce95eb5af354 100644
> --- a/drivers/net/ethernet/renesas/ravb_main.c
> +++ b/drivers/net/ethernet/renesas/ravb_main.c
> @@ -683,8 +683,11 @@ static int ravb_dmac_init(struct net_device *ndev)
>  
>  	/* Setting the control will start the AVB-DMAC process. */
>  	ravb_modify(ndev, CCC, CCC_OPC, CCC_OPC_OPERATION);
> +	error = ravb_wait(ndev, CSR, CSR_OPS, CSR_OPS_OPERATION);
> +	if (error)
> +		netdev_err(ndev, "failed to switch device to operation mode\n");

   It doesn't look like ravb_wait() is needed here...
   And besides, this pattern seems repetitive and worth factoring out into
a single function.

[...]
> @@ -1744,6 +1747,18 @@ static inline int ravb_hook_irq(unsigned int irq, irq_handler_t handler,
>  	return error;
>  }
>  
> +static int ravb_set_reset_mode(struct net_device *ndev)
> +{
> +	int error;
> +
> +	ravb_write(ndev, CCC_OPC_RESET, CCC);
> +	error = ravb_wait(ndev, CSR, CSR_OPS, CSR_OPS_RESET);
> +	if (error)
> +		netdev_err(ndev, "failed to switch device to reset mode\n");
> +
> +	return error;
> +}
> +

   Again, ravb_wait() call doesn't seem necessary here...

[...]

MBR, Sergey

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ