netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] net: txgbe: remove wx_ptp_init() in device reset flow
@ 2025-11-05  2:07 Jiawen Wu
  2025-11-05 20:02 ` Vadim Fedorenko
  0 siblings, 1 reply; 5+ messages in thread
From: Jiawen Wu @ 2025-11-05  2:07 UTC (permalink / raw)
  To: netdev, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Richard Cochran, Simon Horman,
	Jacob Keller
  Cc: Mengyuan Lou, Jiawen Wu, stable

The functions txgbe_up() and txgbe_down() are called in pairs to reset
hardware configurations. PTP stop function is not called in
txgbe_down(), so there is no need to call PTP init function in
txgbe_up().

Fixes: 06e75161b9d4 ("net: wangxun: Add support for PTP clock")
Cc: stable@vger.kernel.org
Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com>
---
 drivers/net/ethernet/wangxun/txgbe/txgbe_main.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/net/ethernet/wangxun/txgbe/txgbe_main.c b/drivers/net/ethernet/wangxun/txgbe/txgbe_main.c
index daa761e48f9d..114d6f46139b 100644
--- a/drivers/net/ethernet/wangxun/txgbe/txgbe_main.c
+++ b/drivers/net/ethernet/wangxun/txgbe/txgbe_main.c
@@ -297,7 +297,6 @@ void txgbe_down(struct wx *wx)
 void txgbe_up(struct wx *wx)
 {
 	wx_configure(wx);
-	wx_ptp_init(wx);
 	txgbe_up_complete(wx);
 }
 
-- 
2.48.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH net] net: txgbe: remove wx_ptp_init() in device reset flow
  2025-11-05  2:07 [PATCH net] net: txgbe: remove wx_ptp_init() in device reset flow Jiawen Wu
@ 2025-11-05 20:02 ` Vadim Fedorenko
  2025-11-06  2:05   ` Jiawen Wu
  0 siblings, 1 reply; 5+ messages in thread
From: Vadim Fedorenko @ 2025-11-05 20:02 UTC (permalink / raw)
  To: Jiawen Wu, netdev, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Richard Cochran, Simon Horman,
	Jacob Keller
  Cc: Mengyuan Lou, stable

On 05/11/2025 02:07, Jiawen Wu wrote:
> The functions txgbe_up() and txgbe_down() are called in pairs to reset
> hardware configurations. PTP stop function is not called in
> txgbe_down(), so there is no need to call PTP init function in
> txgbe_up().
> 

txgbe_reset() is called during txgbe_down(), and it calls
wx_ptp_reset(), which I believe is the reason for wx_ptp_init() call

> Fixes: 06e75161b9d4 ("net: wangxun: Add support for PTP clock")
> Cc: stable@vger.kernel.org
> Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com>
> ---
>   drivers/net/ethernet/wangxun/txgbe/txgbe_main.c | 1 -
>   1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/wangxun/txgbe/txgbe_main.c b/drivers/net/ethernet/wangxun/txgbe/txgbe_main.c
> index daa761e48f9d..114d6f46139b 100644
> --- a/drivers/net/ethernet/wangxun/txgbe/txgbe_main.c
> +++ b/drivers/net/ethernet/wangxun/txgbe/txgbe_main.c
> @@ -297,7 +297,6 @@ void txgbe_down(struct wx *wx)
>   void txgbe_up(struct wx *wx)
>   {
>   	wx_configure(wx);
> -	wx_ptp_init(wx);
>   	txgbe_up_complete(wx);
>   }
>   


^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [PATCH net] net: txgbe: remove wx_ptp_init() in device reset flow
  2025-11-05 20:02 ` Vadim Fedorenko
@ 2025-11-06  2:05   ` Jiawen Wu
  2025-11-06 11:27     ` Vadim Fedorenko
  0 siblings, 1 reply; 5+ messages in thread
From: Jiawen Wu @ 2025-11-06  2:05 UTC (permalink / raw)
  To: 'Vadim Fedorenko', netdev, 'Andrew Lunn',
	'David S. Miller', 'Eric Dumazet',
	'Jakub Kicinski', 'Paolo Abeni',
	'Richard Cochran', 'Simon Horman',
	'Jacob Keller'
  Cc: 'Mengyuan Lou', stable

On Thu, Nov 6, 2025 4:03 AM, Vadim Fedorenko wrote:
> On 05/11/2025 02:07, Jiawen Wu wrote:
> > The functions txgbe_up() and txgbe_down() are called in pairs to reset
> > hardware configurations. PTP stop function is not called in
> > txgbe_down(), so there is no need to call PTP init function in
> > txgbe_up().
> >
> 
> txgbe_reset() is called during txgbe_down(), and it calls
> wx_ptp_reset(), which I believe is the reason for wx_ptp_init() call

wx_ptp_reset() just reset the hardware bits, but does not destroy the PTP clock.
wx_ptp_init() should be called after wx_ptp_stop() has been called.

> 
> > Fixes: 06e75161b9d4 ("net: wangxun: Add support for PTP clock")
> > Cc: stable@vger.kernel.org
> > Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com>
> > ---
> >   drivers/net/ethernet/wangxun/txgbe/txgbe_main.c | 1 -
> >   1 file changed, 1 deletion(-)
> >
> > diff --git a/drivers/net/ethernet/wangxun/txgbe/txgbe_main.c b/drivers/net/ethernet/wangxun/txgbe/txgbe_main.c
> > index daa761e48f9d..114d6f46139b 100644
> > --- a/drivers/net/ethernet/wangxun/txgbe/txgbe_main.c
> > +++ b/drivers/net/ethernet/wangxun/txgbe/txgbe_main.c
> > @@ -297,7 +297,6 @@ void txgbe_down(struct wx *wx)
> >   void txgbe_up(struct wx *wx)
> >   {
> >   	wx_configure(wx);
> > -	wx_ptp_init(wx);
> >   	txgbe_up_complete(wx);
> >   }
> >
 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net] net: txgbe: remove wx_ptp_init() in device reset flow
  2025-11-06  2:05   ` Jiawen Wu
@ 2025-11-06 11:27     ` Vadim Fedorenko
  2025-11-07  2:21       ` Jiawen Wu
  0 siblings, 1 reply; 5+ messages in thread
From: Vadim Fedorenko @ 2025-11-06 11:27 UTC (permalink / raw)
  To: Jiawen Wu, netdev, 'Andrew Lunn',
	'David S. Miller', 'Eric Dumazet',
	'Jakub Kicinski', 'Paolo Abeni',
	'Richard Cochran', 'Simon Horman',
	'Jacob Keller'
  Cc: 'Mengyuan Lou', stable

On 06/11/2025 02:05, Jiawen Wu wrote:
> On Thu, Nov 6, 2025 4:03 AM, Vadim Fedorenko wrote:
>> On 05/11/2025 02:07, Jiawen Wu wrote:
>>> The functions txgbe_up() and txgbe_down() are called in pairs to reset
>>> hardware configurations. PTP stop function is not called in
>>> txgbe_down(), so there is no need to call PTP init function in
>>> txgbe_up().
>>>
>>
>> txgbe_reset() is called during txgbe_down(), and it calls
>> wx_ptp_reset(), which I believe is the reason for wx_ptp_init() call
> 
> wx_ptp_reset() just reset the hardware bits, but does not destroy the PTP clock.
> wx_ptp_init() should be called after wx_ptp_stop() has been called.

wx_ptp_init()/wx_ptp_reset() recalculate shift/mul configuration based
on link speed. link down/link up sequence may bring new link speed,
where these values have to reconfigured, right? I kinda agree
that full procedure of wx_ptp_init() might not be needed, but we have to
be sure not to reuse old ptp configuration.

> 
>>
>>> Fixes: 06e75161b9d4 ("net: wangxun: Add support for PTP clock")
>>> Cc: stable@vger.kernel.org
>>> Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com>
>>> ---
>>>    drivers/net/ethernet/wangxun/txgbe/txgbe_main.c | 1 -
>>>    1 file changed, 1 deletion(-)
>>>
>>> diff --git a/drivers/net/ethernet/wangxun/txgbe/txgbe_main.c b/drivers/net/ethernet/wangxun/txgbe/txgbe_main.c
>>> index daa761e48f9d..114d6f46139b 100644
>>> --- a/drivers/net/ethernet/wangxun/txgbe/txgbe_main.c
>>> +++ b/drivers/net/ethernet/wangxun/txgbe/txgbe_main.c
>>> @@ -297,7 +297,6 @@ void txgbe_down(struct wx *wx)
>>>    void txgbe_up(struct wx *wx)
>>>    {
>>>    	wx_configure(wx);
>>> -	wx_ptp_init(wx);
>>>    	txgbe_up_complete(wx);
>>>    }
>>>
>   
> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [PATCH net] net: txgbe: remove wx_ptp_init() in device reset flow
  2025-11-06 11:27     ` Vadim Fedorenko
@ 2025-11-07  2:21       ` Jiawen Wu
  0 siblings, 0 replies; 5+ messages in thread
From: Jiawen Wu @ 2025-11-07  2:21 UTC (permalink / raw)
  To: 'Vadim Fedorenko', netdev, 'Andrew Lunn',
	'David S. Miller', 'Eric Dumazet',
	'Jakub Kicinski', 'Paolo Abeni',
	'Richard Cochran', 'Simon Horman',
	'Jacob Keller', netdev, 'Andrew Lunn',
	'David S. Miller', 'Eric Dumazet',
	'Jakub Kicinski', 'Paolo Abeni',
	'Richard Cochran', 'Simon Horman',
	'Jacob Keller'
  Cc: 'Mengyuan Lou', stable, 'Mengyuan Lou', stable

On Thu, Nov 6, 2025 7:27 PM, Vadim Fedorenko wrote:
> On 06/11/2025 02:05, Jiawen Wu wrote:
> > On Thu, Nov 6, 2025 4:03 AM, Vadim Fedorenko wrote:
> >> On 05/11/2025 02:07, Jiawen Wu wrote:
> >>> The functions txgbe_up() and txgbe_down() are called in pairs to reset
> >>> hardware configurations. PTP stop function is not called in
> >>> txgbe_down(), so there is no need to call PTP init function in
> >>> txgbe_up().
> >>>
> >>
> >> txgbe_reset() is called during txgbe_down(), and it calls
> >> wx_ptp_reset(), which I believe is the reason for wx_ptp_init() call
> >
> > wx_ptp_reset() just reset the hardware bits, but does not destroy the PTP clock.
> > wx_ptp_init() should be called after wx_ptp_stop() has been called.
> 
> wx_ptp_init()/wx_ptp_reset() recalculate shift/mul configuration based
> on link speed. link down/link up sequence may bring new link speed,
> where these values have to reconfigured, right? I kinda agree
> that full procedure of wx_ptp_init() might not be needed, but we have to
> be sure not to reuse old ptp configuration.

This indicates that the original approach was also wrong. wx_ptp_init() would
return here: if (wx_ptp_create_clock(wx)).

But for the changing of link speed, wx_ptp_reset_cyclecounter() is called in
.mac_link_up() and .mac_link_down().



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-11-07  2:23 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-05  2:07 [PATCH net] net: txgbe: remove wx_ptp_init() in device reset flow Jiawen Wu
2025-11-05 20:02 ` Vadim Fedorenko
2025-11-06  2:05   ` Jiawen Wu
2025-11-06 11:27     ` Vadim Fedorenko
2025-11-07  2:21       ` Jiawen Wu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).