Netdev List
 help / color / mirror / Atom feed
From: Marek Vasut <marex@nabladev.com>
To: Jakub Kicinski <kuba@kernel.org>
Cc: netdev@vger.kernel.org, davem@davemloft.net,
	andrew+netdev@lunn.ch, edumazet@google.com, pabeni@redhat.com,
	bigeasy@linutronix.de, yiconghui@gmail.com,
	kernel@dh-electronics.com, linux-kernel@vger.kernel.org
Subject: Re: [net,PATCH v1] net: ks8851: Fix receiver error in 100BASE-TX mode following software power-down
Date: Sat, 5 Sep 2026 03:16:12 +0200	[thread overview]
Message-ID: <f7149e71-2c32-4f53-86c9-d1c586218fc2@nabladev.com> (raw)
In-Reply-To: <20260904003712.3484001-1-kuba@kernel.org>

On 9/4/26 2:37 AM, Jakub Kicinski wrote:
> This is an AI-generated review of your patch.

Sigh, a wall of generated text.

> The human sending this
> email has considered the AI review valid, or at least plausible.
> ---
> net: ks8851: Fix receiver error in 100BASE-TX mode following software power-down
> 
> Per the KSZ8851 errata (DS80000716D, Module 3), a software power-down
> followed by a power-on can leave the receiver circuit non-functional. This
> patch implements the documented workaround by dropping both transitions into
> PMECR_PM_SOFTDOWN, in ks8851_write_mac_addr() and ks8851_net_stop().
> 
> Link: https://ww1.microchip.com/downloads/en/DeviceDoc/80000716D.pdf
> 
>> diff --git a/drivers/net/ethernet/micrel/ks8851_common.c b/drivers/net/ethernet/micrel/ks8851_common.c
>> index 4afbb40bc0e4a..cd8dfca22720b 100644
>> --- a/drivers/net/ethernet/micrel/ks8851_common.c
>> +++ b/drivers/net/ethernet/micrel/ks8851_common.c
>> @@ -143,9 +143,6 @@ static int ks8851_write_mac_addr(struct net_device *dev)
>>   		ks8851_wrreg16(ks, KS_MAR(i), val);
>>   	}
>>   
>> -	if (!netif_running(dev))
>> -		ks8851_set_powermode(ks, PMECR_PM_SOFTDOWN);
>> -
>>   	ks8851_unlock(ks);
>>   
>>   	return 0;
> 
> [Severity: Low]
> This isn't a bug

Aha ...

>, but should the two comments describing the software
> power-down state be updated in the same patch?
> 
> After this hunk, ks8851_write_mac_addr() still carries this comment above
> its remaining ks8851_set_powermode() call:
> 
> 	/*
> 	 * Wake up chip in case it was powered off when stopped; otherwise,
> 	 * the first write to the MAC address does not take effect.
> 	 */
> 	ks8851_set_powermode(ks, PMECR_PM_NORMAL);
> 
> Nothing in the driver can put the chip into software power-down anymore, so
> the "in case it was powered off when stopped" precondition can no longer
> occur. A grep of the tree confirms PMECR_PM_SOFTDOWN has no users left,
> only its definition in ks8851.h, and the two remaining
> ks8851_set_powermode() call sites in ks8851_write_mac_addr() and
> ks8851_net_start() both write PMECR_PM_NORMAL.

The driver obviously does not exist in a vacuum and prior stage before 
Linux could have easily left the MAC in whatever powered down state. 
This is bogus feedback.

> Since the commit message uses that very call site as the argument that
> dropping the power-down here is safe, would it help to note in the comment
> that the PM_NORMAL write is kept deliberately (e.g. referencing the errata),
> so a later cleanup does not remove it or reintroduce the SOFTDOWN
> transition?
> 
>> @@ -506,8 +503,6 @@ static int ks8851_net_stop(struct net_device *dev)
>>   	/* shutdown TX process */
>>   	ks8851_wrreg16(ks, KS_TXCR, 0x0000);
>>   
>> -	/* set powermode to soft power down to save power */
>> -	ks8851_set_powermode(ks, PMECR_PM_SOFTDOWN);
>>   	ks8851_unlock(ks);
> 
> [Severity: Low]
> Related to the above: the kernel-doc for ks8851_net_stop() just above this
> function still promises the low power transition that is being removed here:
> 
> 	/**
> 	 * ks8851_net_stop - close network device
> 	 * @dev: The device being closed.
> 	 *
> 	 * Called to close down a network device which has been active. Cancel any
> 	 * work, shutdown the RX and TX process and then place the chip into a low
> 	 * power state whilst it is not being used.
> 	 */
> 
> The post-patch body only masks IER/ISR, zeroes RXCR1/TXCR, drains ks->txq
> and calls free_irq(), with no PMECR access left. Should that last sentence
> be dropped or reworded to mention the errata, so readers of
> ks8851_suspend()->ks8851_net_stop() are not told a low power transition
> happens?

What exactly should I adjust in V2 ?

  reply	other threads:[~2026-09-05  1:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-01 17:39 [net,PATCH v1] net: ks8851: Fix receiver error in 100BASE-TX mode following software power-down Marek Vasut
2026-09-01 19:47 ` Sebastian Andrzej Siewior
2026-09-04  0:37 ` Jakub Kicinski
2026-09-05  1:16   ` Marek Vasut [this message]
2026-09-05  1:28     ` Jakub Kicinski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f7149e71-2c32-4f53-86c9-d1c586218fc2@nabladev.com \
    --to=marex@nabladev.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=bigeasy@linutronix.de \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kernel@dh-electronics.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=yiconghui@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox