netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] net: micrel: Fix PTP frame parsing for lan8841
@ 2024-01-10 11:37 Horatiu Vultur
  2024-01-11  7:34 ` Divya.Koppera
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Horatiu Vultur @ 2024-01-10 11:37 UTC (permalink / raw)
  To: andrew, hkallweit1, linux, davem, edumazet, kuba, pabeni,
	richardcochran, horatiu.vultur
  Cc: netdev, linux-kernel, UNGLinuxDriver

The HW has the capability to check each frame if it is a PTP frame,
which domain it is, which ptp frame type it is, different ip address in
the frame. And if one of these checks fail then the frame is not
timestamp. Most of these checks were disabled except checking the field
minorVersionPTP inside the PTP header. Meaning that once a partner sends
a frame compliant to 8021AS which has minorVersionPTP set to 1, then the
frame was not timestamp because the HW expected by default a value of 0
in minorVersionPTP.
Fix this issue by removing this check so the userspace can decide on this.

Fixes: cafc3662ee3f ("net: micrel: Add PHC support for lan8841")
Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
---
 drivers/net/phy/micrel.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c
index 9035c7f55d1bf..0f064d784e33b 100644
--- a/drivers/net/phy/micrel.c
+++ b/drivers/net/phy/micrel.c
@@ -3609,8 +3609,10 @@ static int lan8814_probe(struct phy_device *phydev)
 #define LAN8841_ADC_CHANNEL_MASK		198
 #define LAN8841_PTP_RX_PARSE_L2_ADDR_EN		370
 #define LAN8841_PTP_RX_PARSE_IP_ADDR_EN		371
+#define LAN8841_PTP_RX_VERSION			374
 #define LAN8841_PTP_TX_PARSE_L2_ADDR_EN		434
 #define LAN8841_PTP_TX_PARSE_IP_ADDR_EN		435
+#define LAN8841_PTP_TX_VERSION			438
 #define LAN8841_PTP_CMD_CTL			256
 #define LAN8841_PTP_CMD_CTL_PTP_ENABLE		BIT(2)
 #define LAN8841_PTP_CMD_CTL_PTP_DISABLE		BIT(1)
@@ -3654,6 +3656,12 @@ static int lan8841_config_init(struct phy_device *phydev)
 	phy_write_mmd(phydev, KSZ9131RN_MMD_COMMON_CTRL_REG,
 		      LAN8841_PTP_RX_PARSE_IP_ADDR_EN, 0);
 
+	/* Disable checking for minorVersionPTP field */
+	phy_write_mmd(phydev, KSZ9131RN_MMD_COMMON_CTRL_REG,
+		      LAN8841_PTP_RX_VERSION, 0xff00);
+	phy_write_mmd(phydev, KSZ9131RN_MMD_COMMON_CTRL_REG,
+		      LAN8841_PTP_TX_VERSION, 0xff00);
+
 	/* 100BT Clause 40 improvenent errata */
 	phy_write_mmd(phydev, LAN8841_MMD_ANALOG_REG,
 		      LAN8841_ANALOG_CONTROL_1,
-- 
2.34.1


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

* RE: [PATCH net] net: micrel: Fix PTP frame parsing for lan8841
  2024-01-10 11:37 [PATCH net] net: micrel: Fix PTP frame parsing for lan8841 Horatiu Vultur
@ 2024-01-11  7:34 ` Divya.Koppera
  2024-01-11 19:31 ` Rahul Rameshbabu
  2024-01-12 11:10 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Divya.Koppera @ 2024-01-11  7:34 UTC (permalink / raw)
  To: Horatiu.Vultur, andrew, hkallweit1, linux, davem, edumazet, kuba,
	pabeni, richardcochran
  Cc: netdev, linux-kernel, UNGLinuxDriver

> The HW has the capability to check each frame if it is a PTP frame, which
> domain it is, which ptp frame type it is, different ip address in the frame. And if
> one of these checks fail then the frame is not timestamp. Most of these checks
> were disabled except checking the field minorVersionPTP inside the PTP
> header. Meaning that once a partner sends a frame compliant to 8021AS
> which has minorVersionPTP set to 1, then the frame was not timestamp
> because the HW expected by default a value of 0 in minorVersionPTP.
> Fix this issue by removing this check so the userspace can decide on this.
> 
> Fixes: cafc3662ee3f ("net: micrel: Add PHC support for lan8841")
> Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>

Reviewed-by: Divya Koppera <divya.koppera@microchip.com>

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

* Re: [PATCH net] net: micrel: Fix PTP frame parsing for lan8841
  2024-01-10 11:37 [PATCH net] net: micrel: Fix PTP frame parsing for lan8841 Horatiu Vultur
  2024-01-11  7:34 ` Divya.Koppera
@ 2024-01-11 19:31 ` Rahul Rameshbabu
  2024-01-12 11:10 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Rahul Rameshbabu @ 2024-01-11 19:31 UTC (permalink / raw)
  To: Horatiu Vultur
  Cc: andrew, hkallweit1, linux, davem, edumazet, kuba, pabeni,
	richardcochran, netdev, linux-kernel, UNGLinuxDriver

On Wed, 10 Jan, 2024 12:37:30 +0100 Horatiu Vultur <horatiu.vultur@microchip.com> wrote:
> The HW has the capability to check each frame if it is a PTP frame,
> which domain it is, which ptp frame type it is, different ip address in
> the frame. And if one of these checks fail then the frame is not
> timestamp. Most of these checks were disabled except checking the field
> minorVersionPTP inside the PTP header. Meaning that once a partner sends
> a frame compliant to 8021AS which has minorVersionPTP set to 1, then the
> frame was not timestamp because the HW expected by default a value of 0
> in minorVersionPTP.
> Fix this issue by removing this check so the userspace can decide on this.
>
> Fixes: cafc3662ee3f ("net: micrel: Add PHC support for lan8841")
> Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
> ---

This is a good design decision.

Reviewed-by: Rahul Rameshbabu <rrameshbabu@nvidia.com>


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

* Re: [PATCH net] net: micrel: Fix PTP frame parsing for lan8841
  2024-01-10 11:37 [PATCH net] net: micrel: Fix PTP frame parsing for lan8841 Horatiu Vultur
  2024-01-11  7:34 ` Divya.Koppera
  2024-01-11 19:31 ` Rahul Rameshbabu
@ 2024-01-12 11:10 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-01-12 11:10 UTC (permalink / raw)
  To: Horatiu Vultur
  Cc: andrew, hkallweit1, linux, davem, edumazet, kuba, pabeni,
	richardcochran, netdev, linux-kernel, UNGLinuxDriver

Hello:

This patch was applied to netdev/net.git (main)
by David S. Miller <davem@davemloft.net>:

On Wed, 10 Jan 2024 12:37:30 +0100 you wrote:
> The HW has the capability to check each frame if it is a PTP frame,
> which domain it is, which ptp frame type it is, different ip address in
> the frame. And if one of these checks fail then the frame is not
> timestamp. Most of these checks were disabled except checking the field
> minorVersionPTP inside the PTP header. Meaning that once a partner sends
> a frame compliant to 8021AS which has minorVersionPTP set to 1, then the
> frame was not timestamp because the HW expected by default a value of 0
> in minorVersionPTP.
> Fix this issue by removing this check so the userspace can decide on this.
> 
> [...]

Here is the summary with links:
  - [net] net: micrel: Fix PTP frame parsing for lan8841
    https://git.kernel.org/netdev/net/c/acd66c2126eb

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2024-01-12 11:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-10 11:37 [PATCH net] net: micrel: Fix PTP frame parsing for lan8841 Horatiu Vultur
2024-01-11  7:34 ` Divya.Koppera
2024-01-11 19:31 ` Rahul Rameshbabu
2024-01-12 11:10 ` patchwork-bot+netdevbpf

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