netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net v2] net: dsa: microchip: fix PTP config failure when using multiple ports
@ 2024-08-17  9:41 Martin Whitaker
  2024-08-17 18:57 ` Andrew Lunn
  2024-08-19  2:40 ` Arun.Ramadoss
  0 siblings, 2 replies; 5+ messages in thread
From: Martin Whitaker @ 2024-08-17  9:41 UTC (permalink / raw)
  To: netdev
  Cc: UNGLinuxDriver, Woojung.Huh, ceggers, arun.ramadoss, andrew,
	Martin Whitaker, stable

When performing the port_hwtstamp_set operation, ptp_schedule_worker()
will be called if hardware timestamoing is enabled on any of the ports.
When using multiple ports for PTP, port_hwtstamp_set is executed for
each port. When called for the first time ptp_schedule_worker() returns
0. On subsequent calls it returns 1, indicating the worker is already
scheduled. Currently the ksz driver treats 1 as an error and fails to
complete the port_hwtstamp_set operation, thus leaving the timestamping
configuration for those ports unchanged.

This patch fixes this by ignoring the ptp_schedule_worker() return
value.

Link: https://lore.kernel.org/netdev/7aae307a-35ca-4209-a850-7b2749d40f90@martin-whitaker.me.uk/
Fixes: bb01ad30570b0 ("net: dsa: microchip: ptp: manipulating absolute time using ptp hw clock")
Signed-off-by: Martin Whitaker <foss@martin-whitaker.me.uk>
Cc: stable@stable@vger.kernel.org
---
v2: https://lore.kernel.org/netdev/f335b2b8-aec7-4679-993a-3e147bf65d1d@lunn.ch/
  - add Fixes: and Cc: stable
v1: https://lore.kernel.org/netdev/20240815083814.4273-1-foss@martin-whitaker.me.uk/
---
 drivers/net/dsa/microchip/ksz_ptp.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/net/dsa/microchip/ksz_ptp.c b/drivers/net/dsa/microchip/ksz_ptp.c
index f0bd46e5d4ec..050f17c43ef6 100644
--- a/drivers/net/dsa/microchip/ksz_ptp.c
+++ b/drivers/net/dsa/microchip/ksz_ptp.c
@@ -266,7 +266,6 @@ static int ksz_ptp_enable_mode(struct ksz_device *dev)
 	struct ksz_port *prt;
 	struct dsa_port *dp;
 	bool tag_en = false;
-	int ret;

 	dsa_switch_for_each_user_port(dp, dev->ds) {
 		prt = &dev->ports[dp->index];
@@ -277,9 +276,7 @@ static int ksz_ptp_enable_mode(struct ksz_device *dev)
 	}

 	if (tag_en) {
-		ret = ptp_schedule_worker(ptp_data->clock, 0);
-		if (ret)
-			return ret;
+		ptp_schedule_worker(ptp_data->clock, 0);
 	} else {
 		ptp_cancel_worker_sync(ptp_data->clock);
 	}
--
2.41.1


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

* Re: [PATCH net v2] net: dsa: microchip: fix PTP config failure when using multiple ports
  2024-08-17  9:41 [PATCH net v2] net: dsa: microchip: fix PTP config failure when using multiple ports Martin Whitaker
@ 2024-08-17 18:57 ` Andrew Lunn
  2024-08-18 10:21   ` Martin Whitaker
  2024-08-19  2:40 ` Arun.Ramadoss
  1 sibling, 1 reply; 5+ messages in thread
From: Andrew Lunn @ 2024-08-17 18:57 UTC (permalink / raw)
  To: Martin Whitaker
  Cc: netdev, UNGLinuxDriver, Woojung.Huh, ceggers, arun.ramadoss

On Sat, Aug 17, 2024 at 10:41:41AM +0100, Martin Whitaker wrote:
> When performing the port_hwtstamp_set operation, ptp_schedule_worker()
> will be called if hardware timestamoing is enabled on any of the ports.
> When using multiple ports for PTP, port_hwtstamp_set is executed for
> each port. When called for the first time ptp_schedule_worker() returns
> 0. On subsequent calls it returns 1, indicating the worker is already
> scheduled. Currently the ksz driver treats 1 as an error and fails to
> complete the port_hwtstamp_set operation, thus leaving the timestamping
> configuration for those ports unchanged.
> 
> This patch fixes this by ignoring the ptp_schedule_worker() return
> value.
> 
> Link: https://lore.kernel.org/netdev/7aae307a-35ca-4209-a850-7b2749d40f90@martin-whitaker.me.uk/
> Fixes: bb01ad30570b0 ("net: dsa: microchip: ptp: manipulating absolute time using ptp hw clock")
> Signed-off-by: Martin Whitaker <foss@martin-whitaker.me.uk>
> Cc: stable@stable@vger.kernel.org

One stable@ is sufficient. Did i mess that up when i asked you to add
it?

Apart from that:

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

It is better to put your Signed-off-by last, because each Maintainer
handling the patch appends there own. So it keeps them together. But
there is no need to repost.

    Andrew

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

* Re: [PATCH net v2] net: dsa: microchip: fix PTP config failure when using multiple ports
  2024-08-17 18:57 ` Andrew Lunn
@ 2024-08-18 10:21   ` Martin Whitaker
  2024-08-21  1:52     ` Jakub Kicinski
  0 siblings, 1 reply; 5+ messages in thread
From: Martin Whitaker @ 2024-08-18 10:21 UTC (permalink / raw)
  To: Andrew Lunn; +Cc: netdev, UNGLinuxDriver, Woojung.Huh, ceggers, arun.ramadoss

On 17/08/2024 19:57, Andrew Lunn wrote:
> On Sat, Aug 17, 2024 at 10:41:41AM +0100, Martin Whitaker wrote:
>> When performing the port_hwtstamp_set operation, ptp_schedule_worker()
>> will be called if hardware timestamoing is enabled on any of the ports.
>> When using multiple ports for PTP, port_hwtstamp_set is executed for
>> each port. When called for the first time ptp_schedule_worker() returns
>> 0. On subsequent calls it returns 1, indicating the worker is already
>> scheduled. Currently the ksz driver treats 1 as an error and fails to
>> complete the port_hwtstamp_set operation, thus leaving the timestamping
>> configuration for those ports unchanged.
>>
>> This patch fixes this by ignoring the ptp_schedule_worker() return
>> value.
>>
>> Link: https://lore.kernel.org/netdev/7aae307a-35ca-4209-a850-7b2749d40f90@martin-whitaker.me.uk/
>> Fixes: bb01ad30570b0 ("net: dsa: microchip: ptp: manipulating absolute time using ptp hw clock")
>> Signed-off-by: Martin Whitaker <foss@martin-whitaker.me.uk>
>> Cc: stable@stable@vger.kernel.org
>
> One stable@ is sufficient. Did i mess that up when i asked you to add
> it?

Yes. Annoyingly I noticed it when I first read your reply, but forgot
when I later copy/pasted it into the commit message.

> Apart from that:
>
> Reviewed-by: Andrew Lunn <andrew@lunn.ch>
>
> It is better to put your Signed-off-by last, because each Maintainer
> handling the patch appends there own. So it keeps them together. But
> there is no need to repost.

Thanks.


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

* Re: [PATCH net v2] net: dsa: microchip: fix PTP config failure when using multiple ports
  2024-08-17  9:41 [PATCH net v2] net: dsa: microchip: fix PTP config failure when using multiple ports Martin Whitaker
  2024-08-17 18:57 ` Andrew Lunn
@ 2024-08-19  2:40 ` Arun.Ramadoss
  1 sibling, 0 replies; 5+ messages in thread
From: Arun.Ramadoss @ 2024-08-19  2:40 UTC (permalink / raw)
  To: netdev, foss; +Cc: stable, Woojung.Huh, UNGLinuxDriver, ceggers, andrew

On Sat, 2024-08-17 at 10:41 +0100, Martin Whitaker wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you
> know the content is safe
> 
> When performing the port_hwtstamp_set operation,
> ptp_schedule_worker()
> will be called if hardware timestamoing is enabled on any of the
> ports.
> When using multiple ports for PTP, port_hwtstamp_set is executed for
> each port. When called for the first time ptp_schedule_worker()
> returns
> 0. On subsequent calls it returns 1, indicating the worker is already
> scheduled. Currently the ksz driver treats 1 as an error and fails to
> complete the port_hwtstamp_set operation, thus leaving the
> timestamping
> configuration for those ports unchanged.
> 
> This patch fixes this by ignoring the ptp_schedule_worker() return
> value.
> 
> Link: 
> https://lore.kernel.org/netdev/7aae307a-35ca-4209-a850-7b2749d40f90@martin-whitaker.me.uk/
> Fixes: bb01ad30570b0 ("net: dsa: microchip: ptp: manipulating
> absolute time using ptp hw clock")
> Signed-off-by: Martin Whitaker <foss@martin-whitaker.me.uk>

Acked-by: Arun Ramadoss <arun.ramadoss@microchip.com>

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

* Re: [PATCH net v2] net: dsa: microchip: fix PTP config failure when using multiple ports
  2024-08-18 10:21   ` Martin Whitaker
@ 2024-08-21  1:52     ` Jakub Kicinski
  0 siblings, 0 replies; 5+ messages in thread
From: Jakub Kicinski @ 2024-08-21  1:52 UTC (permalink / raw)
  To: Martin Whitaker
  Cc: Andrew Lunn, netdev, UNGLinuxDriver, Woojung.Huh, ceggers,
	arun.ramadoss

On Sun, 18 Aug 2024 11:21:54 +0100 Martin Whitaker wrote:
> > One stable@ is sufficient. Did i mess that up when i asked you to add
> > it?  
> 
> Yes. Annoyingly I noticed it when I first read your reply, but forgot
> when I later copy/pasted it into the commit message.

Fixed and applied, thanks!

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

end of thread, other threads:[~2024-08-21  1:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-17  9:41 [PATCH net v2] net: dsa: microchip: fix PTP config failure when using multiple ports Martin Whitaker
2024-08-17 18:57 ` Andrew Lunn
2024-08-18 10:21   ` Martin Whitaker
2024-08-21  1:52     ` Jakub Kicinski
2024-08-19  2:40 ` Arun.Ramadoss

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).