diff mbox series

[net,v2] net: dsa: microchip: fix PTP config failure when using multiple ports

Message ID 20240817094141.3332-1-foss@martin-whitaker.me.uk (mailing list archive)
State Accepted
Delegated to: Netdev Maintainers
Headers show
Series [net,v2] net: dsa: microchip: fix PTP config failure when using multiple ports | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag present in non-next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 16 this patch: 16
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers fail 3 blamed authors not CCed: olteanv@gmail.com ceggers@arri.de arun.ramadoss@microchip.com; 12 maintainers not CCed: pabeni@redhat.com kuba@kernel.org andrew@lunn.ch edumazet@google.com netdev@vger.kernel.org richardcochran@gmail.com olteanv@gmail.com UNGLinuxDriver@microchip.com f.fainelli@gmail.com arun.ramadoss@microchip.com ceggers@arri.de woojung.huh@microchip.com
netdev/build_clang success Errors and warnings before: 16 this patch: 16
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 16 this patch: 16
netdev/checkpatch warning WARNING: Please use correct Fixes: style 'Fixes: <12 chars of sha1> ("<title line>")' - ie: 'Fixes: bb01ad30570b ("net: dsa: microchip: ptp: manipulating absolute time using ptp hw clock")'
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-08-20--09-00 (tests: 712)

Commit Message

Martin Whitaker Aug. 17, 2024, 9:41 a.m. UTC
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(-)

--
2.41.1

Comments

Andrew Lunn Aug. 17, 2024, 6:57 p.m. UTC | #1
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
Martin Whitaker Aug. 18, 2024, 10:21 a.m. UTC | #2
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.
Arun Ramadoss Aug. 19, 2024, 2:40 a.m. UTC | #3
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>
Jakub Kicinski Aug. 21, 2024, 1:52 a.m. UTC | #4
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!
diff mbox series

Patch

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);
 	}