Re: [PATCH net-next 0/3] Document more PTP timestamping known quirks

2020-07-18 Thread Sergey Organov
Vladimir Oltean writes: > On Sat, Jul 18, 2020 at 01:54:11PM +0300, Sergey Organov wrote: >> Vladimir Oltean writes: >> >> > On Sat, Jul 18, 2020 at 12:13:42AM +0300, Sergey Organov wrote: >> >> Vladimir Oltean writes: >> >> >> >> &g

Re: [PATCH net-next 0/3] Document more PTP timestamping known quirks

2020-07-18 Thread Sergey Organov
Vladimir Oltean writes: > I've tried to collect and summarize the conclusions of these discussions: > https://patchwork.ozlabs.org/project/netdev/patch/20200711120842.2631-1-sorga...@gmail.com/ > https://patchwork.ozlabs.org/project/netdev/patch/20200710113611.3398-5-k...@linutronix.de/ > which w

Re: [PATCH net-next 0/3] Document more PTP timestamping known quirks

2020-07-18 Thread Sergey Organov
Vladimir Oltean writes: > On Sat, Jul 18, 2020 at 12:13:42AM +0300, Sergey Organov wrote: >> Vladimir Oltean writes: >> >> > I've tried to collect and summarize the conclusions of these discussions: >> > https://patchwork.ozlabs.org/project/netdev/patch/20

Re: [PATCH net-next 0/3] Document more PTP timestamping known quirks

2020-07-17 Thread Sergey Organov
Vladimir Oltean writes: > I've tried to collect and summarize the conclusions of these discussions: > https://patchwork.ozlabs.org/project/netdev/patch/20200711120842.2631-1-sorga...@gmail.com/ > https://patchwork.ozlabs.org/project/netdev/patch/20200710113611.3398-5-k...@linutronix.de/ > which w

Re: [PATCH v3 net] net: fec: fix hardware time stamping by external devices

2020-07-16 Thread Sergey Organov
Jakub Kicinski writes: > On Thu, 16 Jul 2020 23:38:13 +0300 Sergey Organov wrote: >> > Applied, and added to the stable queue, thanks! >> >> Thanks, and I've also got a no-brainer patch that lets this bug fix >> compile as-is with older kernels, w

Re: [PATCH v3 net] net: fec: fix hardware time stamping by external devices

2020-07-16 Thread Sergey Organov
Jakub Kicinski writes: > On Tue, 14 Jul 2020 19:28:02 +0300 Sergey Organov wrote: >> Fix support for external PTP-aware devices such as DSA or PTP PHY: >> >> Make sure we never time stamp tx packets when hardware time stamping >> is disabled. >> >> Check

[PATCH net] net: dp83640: fix SIOCSHWTSTAMP to update the struct with actual configuration

2020-07-15 Thread Sergey Organov
Added a clock driver for the National Semiconductor PHYTER.") Signed-off-by: Sergey Organov --- drivers/net/phy/dp83640.c | 4 1 file changed, 4 insertions(+) diff --git a/drivers/net/phy/dp83640.c b/drivers/net/phy/dp83640.c index ecbd5e0d685c..acb0aae60755 100644 --- a/drivers/net/

[PATCH net-next v2 3/4] net: fec: get rid of redundant code in fec_ptp_set()

2020-07-15 Thread Sergey Organov
Code of the form "if(x) x = 0" replaced with "x = 0". Code of the form "if(x == a) x = a" removed. Acked-by: Fugang Duan Signed-off-by: Sergey Organov --- drivers/net/ethernet/freescale/fec_ptp.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) dif

[PATCH net-next v2 2/4] net: fec: initialize clock with 0 rather than current kernel time

2020-07-15 Thread Sergey Organov
initialization happens, as these time scales differ in a small integer number of seconds (37 at the time of writing.) Signed-off-by: Sergey Organov --- drivers/net/ethernet/freescale/fec_ptp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/freescale

[PATCH net-next v2 0/4] net: fec: a few improvements

2020-07-15 Thread Sergey Organov
the changes. NOTE: the patches are developed and tested on 4.9.146, and rebased on top of recent 'net-next/master', where, besides visual inspection, I only tested that they do compile. Sergey Organov (4): net: fec: enable to use PPS feature without time stamping net: fec: initia

[PATCH net-next v2 1/4] net: fec: enable to use PPS feature without time stamping

2020-07-15 Thread Sergey Organov
PPS feature could be useful even when hardware time stamping of network packets is not in use, so remove offending check for this condition from fec_ptp_enable_pps(). Signed-off-by: Sergey Organov --- drivers/net/ethernet/freescale/fec_ptp.c | 5 - 1 file changed, 5 deletions(-) diff --git

[PATCH net-next v2 4/4] net: fec: replace snprintf() with strlcpy() in fec_ptp_init()

2020-07-15 Thread Sergey Organov
No need to use snprintf() on a constant string, nor using magic constant in the fixed code was a good idea. Signed-off-by: Sergey Organov --- drivers/net/ethernet/freescale/fec_ptp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/freescale/fec_ptp.c b

[PATCH v3 net] net: fec: fix hardware time stamping by external devices

2020-07-14 Thread Sergey Organov
. In addition, disable our own hardware time stamping in this case. Fixes: 6605b730c061 ("FEC: Add time stamping code and a PTP hardware clock") Signed-off-by: Sergey Organov Acked-by: Richard Cochran Acked-by: Vladimir Oltean --- v3: - Fixed SHA1 length of Fixes: tag - Added Acke

Re: [PATCH v2 net] net: fec: fix hardware time stamping by external devices

2020-07-14 Thread Sergey Organov
Vladimir Oltean writes: [...] >> Acked-by: Vladimir Oltean >> >> Thanks, >> -Vladimir > > Of course, it would be good if you sent a new version with the sha1sum > of the Fixes: tag having the right length, otherwise people will > complain. Ah, thanks for reminding! I entirely forgot about it

Re: [PATCH v2 net] net: fec: fix hardware time stamping by external devices

2020-07-14 Thread Sergey Organov
Vladimir Oltean writes: > On Tue, Jul 14, 2020 at 03:39:04PM +0300, Sergey Organov wrote: >> Vladimir Oltean writes: >> >> > On Mon, Jul 13, 2020 at 01:32:09AM +0300, Sergey Organov wrote: >> >> [...] >> >> >> > From the

Re: [PATCH v2 net] net: fec: fix hardware time stamping by external devices

2020-07-14 Thread Sergey Organov
Richard Cochran writes: > On Sat, Jul 11, 2020 at 03:08:42PM +0300, Sergey Organov wrote: >> Fix support for external PTP-aware devices such as DSA or PTP PHY: >> >> Make sure we never time stamp tx packets when hardware time stamping >> is disabled. >> >

Re: [PATCH v2 net] net: fec: fix hardware time stamping by external devices

2020-07-14 Thread Sergey Organov
Vladimir Oltean writes: > On Mon, Jul 13, 2020 at 01:32:09AM +0300, Sergey Organov wrote: [...] >> > From the perspective of the mainline kernel, that can never happen. >> >> Yet in happened to me, and in some way because of the UAPI deficiencies >> I've

Re: [PATCH v2 net] net: fec: fix hardware time stamping by external devices

2020-07-12 Thread Sergey Organov
Vladimir Oltean writes: > On Sun, Jul 12, 2020 at 08:29:46PM +0300, Sergey Organov wrote: >> Vladimir Oltean writes: >> >> > As far as I understand. the reason why SKBTX_IN_PROGRESS exists is for >> > skb_tx_timestamp() to only provide a software timestamp

Re: [PATCH v2 net] net: fec: fix hardware time stamping by external devices

2020-07-12 Thread Sergey Organov
Vladimir Oltean writes: > On Sun, Jul 12, 2020 at 05:16:56PM +0300, Sergey Organov wrote: >> Vladimir Oltean writes: >> >> > Hi Sergey, >> > >> > On Sat, Jul 11, 2020 at 03:08:42PM +0300, Sergey Organov wrote: >> >> Fix support

Re: [PATCH v2 net] net: fec: fix hardware time stamping by external devices

2020-07-12 Thread Sergey Organov
Vladimir Oltean writes: > Hi Sergey, > > On Sat, Jul 11, 2020 at 03:08:42PM +0300, Sergey Organov wrote: >> Fix support for external PTP-aware devices such as DSA or PTP PHY: >> >> Make sure we never time stamp tx packets when hardware time stamping >> is d

[PATCH v2 net] net: fec: fix hardware time stamping by external devices

2020-07-11 Thread Sergey Organov
. In addition, disable our own hardware time stamping in this case. Fixes: 6605b73 ("FEC: Add time stamping code and a PTP hardware clock") Signed-off-by: Sergey Organov --- v2: - Extracted from larger patch series - Description/comments updated according to discussions - Added

Re: [PATCH] docs: networking: timestamping: add section for stacked PHC devices

2020-07-09 Thread Sergey Organov
Vladimir Oltean writes: > The concept of timestamping DSA switches / Ethernet PHYs is becoming > more and more popular, however the Linux kernel timestamping code has > evolved quite organically and there's layers upon layers of new and old > code that need to work together for things to behave a

Re: [PATCH 3/5] net: fec: initialize clock with 0 rather than current kernel time

2020-07-08 Thread Sergey Organov
Richard Cochran writes: > On Wed, Jul 08, 2020 at 03:37:29PM +0300, Sergey Organov wrote: >> Richard Cochran writes: >> >> > On Mon, Jul 06, 2020 at 06:27:21PM +0300, Vladimir Oltean wrote: >> >> There's no correct answer, I'm afraid. Whatever the

Re: [PATCH 3/5] net: fec: initialize clock with 0 rather than current kernel time

2020-07-08 Thread Sergey Organov
Richard Cochran writes: > On Mon, Jul 06, 2020 at 06:27:21PM +0300, Vladimir Oltean wrote: >> There's no correct answer, I'm afraid. Whatever the default value of the >> clock may be, it's bound to be confusing for some reason, _if_ the >> reason why you're investigating it in the first place is

Re: [EXT] [PATCH 4/5] net: fec: get rid of redundant code in fec_ptp_set()

2020-07-08 Thread Sergey Organov
Andy Duan writes: > From: Sergey Organov Sent: Wednesday, July 8, 2020 4:49 > PM >> Andy Duan writes: >> >> > From: Sergey Organov Sent: Tuesday, July 7, 2020 >> > 10:43 PM >> >> Andy Duan writes: >> >> >> >> &

Re: [PATCH 3/5] net: fec: initialize clock with 0 rather than current kernel time

2020-07-08 Thread Sergey Organov
Richard Cochran writes: > On Mon, Jul 06, 2020 at 06:27:21PM +0300, Vladimir Oltean wrote: >> There's no correct answer, I'm afraid. Whatever the default value of the >> clock may be, it's bound to be confusing for some reason, _if_ the >> reason why you're investigating it in the first place is

Re: [PATCH 3/5] net: fec: initialize clock with 0 rather than current kernel time

2020-07-08 Thread Sergey Organov
Richard Cochran writes: > On Tue, Jul 07, 2020 at 08:56:41PM +0300, Sergey Organov wrote: >> It won't. Supposedly it'd force clock (that doesn't tick by default and >> stays at 0) to start ticking. > > No existing clockid_t has this behavior. Consider

Re: [EXT] [PATCH 4/5] net: fec: get rid of redundant code in fec_ptp_set()

2020-07-08 Thread Sergey Organov
Andy Duan writes: > From: Sergey Organov Sent: Tuesday, July 7, 2020 10:43 PM >> Andy Duan writes: >> >> > From: Sergey Organov Sent: Monday, July 6, 2020 >> 10:26 PM >> >> Code of the form "if(x) x = 0" replaced with "x = 0&

Re: [PATCH 3/5] net: fec: initialize clock with 0 rather than current kernel time

2020-07-07 Thread Sergey Organov
Vladimir Oltean writes: > On Tue, Jul 07, 2020 at 08:09:07PM +0300, Sergey Organov wrote: >> Vladimir Oltean writes: >> >> > On Tue, Jul 07, 2020 at 07:07:08PM +0300, Sergey Organov wrote: >> >> Vladimir Oltean writes: >> >> > >> &g

Re: [PATCH 3/5] net: fec: initialize clock with 0 rather than current kernel time

2020-07-07 Thread Sergey Organov
Vladimir Oltean writes: > On Tue, Jul 07, 2020 at 07:07:08PM +0300, Sergey Organov wrote: >> Vladimir Oltean writes: >> > >> > What do you mean 'no ticking', and what do you mean by 'non-initialized >> > clock' exactly? I don't know i

Re: [PATCH 3/5] net: fec: initialize clock with 0 rather than current kernel time

2020-07-07 Thread Sergey Organov
Vladimir Oltean writes: > On Mon, Jul 06, 2020 at 09:24:24PM +0300, Sergey Organov wrote: >> Vladimir Oltean writes: >> >> > Hi Sergey, >> > >> > On Mon, Jul 06, 2020 at 05:26:14PM +0300, Sergey Organov wrote: >> >> Initializing wi

Re: [PATCH 1/5] net: fec: properly support external PTP PHY for hardware time stamping

2020-07-07 Thread Sergey Organov
Vladimir Oltean writes: > On Mon, Jul 06, 2020 at 09:33:30PM +0300, Sergey Organov wrote: [...] > >> I'll then make these 2 changes separate in v2 indeed, though I'm not >> aware about Fixes: tag and if I should do something about it. Any clues? >> > &

Re: [EXT] [PATCH 4/5] net: fec: get rid of redundant code in fec_ptp_set()

2020-07-07 Thread Sergey Organov
Andy Duan writes: > From: Sergey Organov Sent: Monday, July 6, 2020 10:26 PM >> Code of the form "if(x) x = 0" replaced with "x = 0". >> >> Code of the form "if(x == a) x = a" removed. >> >> Signed-off-by: Sergey Organov >>

Re: [EXT] [PATCH 2/5] net: fec: enable to use PPS feature without time stamping

2020-07-07 Thread Sergey Organov
Andy Duan writes: > From: Sergey Organov Sent: Monday, July 6, 2020 10:26 PM >> PPS feature could be useful even when hardware time stamping of network >> packets is not in use, so remove offending check for this condition from >> fec_ptp_enable_pps(). > > If hardwa

Re: [PATCH 1/5] net: fec: properly support external PTP PHY for hardware time stamping

2020-07-06 Thread Sergey Organov
Vladimir Oltean writes: > On Mon, Jul 06, 2020 at 06:21:59PM +0300, Sergey Organov wrote: >> Vladimir Oltean writes: >> > Hi Sergey, >> > >> > On Mon, Jul 06, 2020 at 05:26:12PM +0300, Sergey Organov wrote: >> >> When external PTP-aware PHY is i

Re: [PATCH 3/5] net: fec: initialize clock with 0 rather than current kernel time

2020-07-06 Thread Sergey Organov
Vladimir Oltean writes: > Hi Sergey, > > On Mon, Jul 06, 2020 at 05:26:14PM +0300, Sergey Organov wrote: >> Initializing with 0 makes it much easier to identify time stamps from >> otherwise uninitialized clock. >> >> Initialization of PTP clock with current

Re: [PATCH 1/5] net: fec: properly support external PTP PHY for hardware time stamping

2020-07-06 Thread Sergey Organov
Vladimir Oltean writes: > Hi Sergey, > > On Mon, Jul 06, 2020 at 05:26:12PM +0300, Sergey Organov wrote: >> When external PTP-aware PHY is in use, it's that PHY that is to time >> stamp network packets, and it's that PHY where configuration requests >> of ti

[PATCH 0/5] net: fec: fix external PTP PHY support

2020-07-06 Thread Sergey Organov
kernel.org/netdev/87r1uqtybr@osv.gnss.ru/ Sergey Organov (5): net: fec: properly support external PTP PHY for hardware time stamping net: fec: enable to use PPS feature without time stamping net: fec: initialize clock with 0 rather than current kernel time net: fec: get rid of redunda

[PATCH 1/5] net: fec: properly support external PTP PHY for hardware time stamping

2020-07-06 Thread Sergey Organov
2. Make sure we redirect ioctl() related to time stamping of Ethernet packets to connected PTP PHY rather than handle them ourselves Signed-off-by: Sergey Organov --- drivers/net/ethernet/freescale/fec.h | 1 + drivers/net/ethernet/freescale/fec_main.c | 18 ++ drive

[PATCH 4/5] net: fec: get rid of redundant code in fec_ptp_set()

2020-07-06 Thread Sergey Organov
Code of the form "if(x) x = 0" replaced with "x = 0". Code of the form "if(x == a) x = a" removed. Signed-off-by: Sergey Organov --- drivers/net/ethernet/freescale/fec_ptp.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/net/e

[PATCH 2/5] net: fec: enable to use PPS feature without time stamping

2020-07-06 Thread Sergey Organov
PPS feature could be useful even when hardware time stamping of network packets is not in use, so remove offending check for this condition from fec_ptp_enable_pps(). Signed-off-by: Sergey Organov --- drivers/net/ethernet/freescale/fec_ptp.c | 5 - 1 file changed, 5 deletions(-) diff --git

[PATCH 5/5] net: fec: replace snprintf() with strlcpy() in fec_ptp_init()

2020-07-06 Thread Sergey Organov
No need to use snprintf() on a constant string, nor using magic constant in the fixed code was a good idea. Signed-off-by: Sergey Organov --- drivers/net/ethernet/freescale/fec_ptp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/freescale/fec_ptp.c b

[PATCH 3/5] net: fec: initialize clock with 0 rather than current kernel time

2020-07-06 Thread Sergey Organov
initialization happens, as these time scales differ in a small integer number of seconds (37 at the time of writing.) Signed-off-by: Sergey Organov --- drivers/net/ethernet/freescale/fec_ptp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/freescale

iMX 6SX FEC: broken hardware timestamping using external PTP PHY

2020-06-07 Thread Sergey Organov
Hello, I'm using DP83640 PTP PHY connected to builtin fec1 (that has its own PTP support) of the iMX 6SX microcontroller. Almost everything works fine out of the box, except hardware timestamping. The problems are that I apparently get timestamps from fec built-in PTP instead of external PHY, and