Message ID | 20240113131521.1051921-2-horatiu.vultur@microchip.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-25291-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2614:b0:101:6a76:bbe3 with SMTP id mm20csp754659dyc; Sat, 13 Jan 2024 05:18:07 -0800 (PST) X-Google-Smtp-Source: AGHT+IHiv5e5pkfZpngyNSvgOYo3swl2xC0SLbPR1G/z1TDgeUDHtpgYASCnEVHvcLx5DV0iTl2l X-Received: by 2002:a17:907:a4c8:b0:a2c:cf35:e5a0 with SMTP id vq8-20020a170907a4c800b00a2ccf35e5a0mr1299501ejc.153.1705151887299; Sat, 13 Jan 2024 05:18:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705151887; cv=none; d=google.com; s=arc-20160816; b=Y07ykbEJJ/07wQ+g3Ho61xtxwy0lUztnZYtDhSynoul0pvpIFzTf3W5KicwnjtY/kW ylPzMi+qglpSrN3BFkGaHwGwd+TB0XQ+rYXCsnWN75OPWmw6L+yfxu5uvPs2UmBuB2dq grdfBON5tWSkzIOR5dxXICPjvIlPnq583FC77Iqj+dD0niOttp6RKMjQAvNht5f/372L 1mbjWMYWYKFt6pZv3JQEOXoxNBdtgHsj94ZGQO/EfUx2f1J/8xr8/LZpTC/2PaLh/gwn q1Qbrsv0k4UKH4vO6q3XCLpJKnUZX2xFskMPyYOj4p2C8A/3/8A42HYP883wXj3Rxpm3 60pg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=+4wmH1bmqYd0DbvBj1h5WW23q/ybJFrLrmHzwiojlE4=; fh=AvnGohFr+OGsboGfuxL5SOJB3cob6ClVqo7Z+Qxg2R4=; b=dwYvr9cqsCeyhgyke7icSL2KK6xSpAVGW2/CXu65pZ30Al/ddt8QVk2zaxChFd4DD6 Uco2RYBZLAAiS1WcqQ8Wc0wr6cMyT0qW7ZCavHvGoM+VyXHYPyVwTZfUhikcE6SKvJbm PbDZHsfrXNpDLgFny1u2ZgBF4fW/L/e1DPDM5/hSNFmO1gTg+xl6+nDUXVwRPrDJoM2o yzMYvYNqFpCSIUVBZRdf5PnEPWZ34B13rGVG91NPVem9ewV6Rci7gV22V1r8R6iyFpF1 fnqVfzo1aFhiVE7pxbfypuXjnt2MMo28CyA8xym2vRNFV3Ssf8mumOQ+41JdK2vlI93U V5KQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=sH0cOpGH; spf=pass (google.com: domain of linux-kernel+bounces-25291-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-25291-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=REJECT dis=NONE) header.from=microchip.com Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id i7-20020a1709063c4700b00a29bac7a2c3si2223596ejg.953.2024.01.13.05.18.07 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 Jan 2024 05:18:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-25291-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=sH0cOpGH; spf=pass (google.com: domain of linux-kernel+bounces-25291-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-25291-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=REJECT dis=NONE) header.from=microchip.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id E381A1F22783 for <ouuuleilei@gmail.com>; Sat, 13 Jan 2024 13:18:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9DA5C21A13; Sat, 13 Jan 2024 13:17:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="sH0cOpGH" Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 386CE2136E; Sat, 13 Jan 2024 13:17:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=microchip.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=microchip.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1705151845; x=1736687845; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=abPbTNs1CsVgwLtFAdwl+WDAEAxIlyXeXILkvGReD2c=; b=sH0cOpGHq6e8sCNtatsTUroTd0Df+eXZlKXoQqcAv0GhwBsQCbgP/3P7 vcoZ61S5aDp24ziPPR/skkws6/a4r0rLDHf7sf7tcQzyIvzgwv5q92JQD wDRpFXwrihLftemV+JBTqRdnmHMsHoPtm+1wBBzp1fa7jn+qRlgZWrIqO Xy+nBBb8Isfv0zuwLlq82MZJLb0Vv4X6Ek5SeMMEjoClzBnPRm6uLaUmz 1DQ4Mk2h+EQiV0CEQ1EfYzjrTJa3S8+0VGsMN3Iedf0smEntK/c+HtrKm zQ+VvdK5l9qFrNXBLQ5AaHGU4o+fSeFyV99jcoI4OuGv/YSqcFTGaKY1a Q==; X-CSE-ConnectionGUID: IbxK4g7OS92kjFhowD7KHA== X-CSE-MsgGUID: /VvpAM8RRNOcuKNlJQ1zMQ== X-IronPort-AV: E=Sophos;i="6.04,192,1695711600"; d="scan'208";a="245432934" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa5.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 13 Jan 2024 06:17:24 -0700 Received: from chn-vm-ex04.mchp-main.com (10.10.85.152) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Sat, 13 Jan 2024 06:17:07 -0700 Received: from DEN-DL-M31836.microsemi.net (10.10.85.11) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server id 15.1.2507.35 via Frontend Transport; Sat, 13 Jan 2024 06:17:04 -0700 From: Horatiu Vultur <horatiu.vultur@microchip.com> To: <andrew@lunn.ch>, <hkallweit1@gmail.com>, <linux@armlinux.org.uk>, <davem@davemloft.net>, <edumazet@google.com>, <kuba@kernel.org>, <pabeni@redhat.com>, <richardcochran@gmail.com>, <Divya.Koppera@microchip.com> CC: <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>, <UNGLinuxDriver@microchip.com>, Horatiu Vultur <horatiu.vultur@microchip.com> Subject: [PATCH net 1/2] net: micrel: Fix PTP frame parsing for lan8814 Date: Sat, 13 Jan 2024 14:15:20 +0100 Message-ID: <20240113131521.1051921-2-horatiu.vultur@microchip.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240113131521.1051921-1-horatiu.vultur@microchip.com> References: <20240113131521.1051921-1-horatiu.vultur@microchip.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787981345109223139 X-GMAIL-MSGID: 1787981345109223139 |
Series |
net: micrel: Fixes for PHC for lan8814
|
|
Commit Message
Horatiu Vultur
Jan. 13, 2024, 1:15 p.m. UTC
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. This is exactly the same issue as on lan8841.
Fix this issue by removing this check so the userspace can decide on this.
Fixes: ece19502834d ("net: phy: micrel: 1588 support for LAN8814 phy")
Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
---
drivers/net/phy/micrel.c | 7 +++++++
1 file changed, 7 insertions(+)
Comments
Hello Horatiu, On Sat, 13 Jan 2024 14:15:20 +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. This is exactly the same issue as on lan8841. > Fix this issue by removing this check so the userspace can decide on this. > > Fixes: ece19502834d ("net: phy: micrel: 1588 support for LAN8814 phy") > Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com> > --- > drivers/net/phy/micrel.c | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c > index bf4053431dcb3..1752eaeadc42e 100644 > --- a/drivers/net/phy/micrel.c > +++ b/drivers/net/phy/micrel.c > @@ -120,6 +120,9 @@ > */ > #define LAN8814_1PPM_FORMAT 17179 > > +#define PTP_RX_VERSION 0x0248 > +#define PTP_TX_VERSION 0x0288 > + > #define PTP_RX_MOD 0x024F > #define PTP_RX_MOD_BAD_UDPV4_CHKSUM_FORCE_FCS_DIS_ BIT(3) > #define PTP_RX_TIMESTAMP_EN 0x024D > @@ -3150,6 +3153,10 @@ static void lan8814_ptp_init(struct phy_device *phydev) > lanphy_write_page_reg(phydev, 5, PTP_TX_PARSE_IP_ADDR_EN, 0); > lanphy_write_page_reg(phydev, 5, PTP_RX_PARSE_IP_ADDR_EN, 0); > > + /* Disable checking for minorVersionPTP field */ > + lanphy_write_page_reg(phydev, 5, PTP_RX_VERSION, 0xff00); > + lanphy_write_page_reg(phydev, 5, PTP_TX_VERSION, 0xff00); Small nit: This looks a bit like magic values, from the datasheet I understand the upper byte is the max supported version and the lower byte is the min supported version, maybe this could be wrapped in macros ? > + > skb_queue_head_init(&ptp_priv->tx_queue); > skb_queue_head_init(&ptp_priv->rx_queue); > INIT_LIST_HEAD(&ptp_priv->rx_ts_list); Besides that, Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com> Thanks, Maxime
> 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. This is > exactly the same issue as on lan8841. > Fix this issue by removing this check so the userspace can decide on this. > > Fixes: ece19502834d ("net: phy: micrel: 1588 support for LAN8814 phy") > Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com> Reviewed-by: Divya Koppera <divya.koppera@microchip.com>
The 01/15/2024 11:06, Maxime Chevallier wrote: > > Hello Horatiu, Hi Maxime, > > On Sat, 13 Jan 2024 14:15:20 +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. This is exactly the same issue as on lan8841. > > Fix this issue by removing this check so the userspace can decide on this. > > > > Fixes: ece19502834d ("net: phy: micrel: 1588 support for LAN8814 phy") > > Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com> > > --- > > drivers/net/phy/micrel.c | 7 +++++++ > > 1 file changed, 7 insertions(+) > > > > diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c > > index bf4053431dcb3..1752eaeadc42e 100644 > > --- a/drivers/net/phy/micrel.c > > +++ b/drivers/net/phy/micrel.c > > @@ -120,6 +120,9 @@ > > */ > > #define LAN8814_1PPM_FORMAT 17179 > > > > +#define PTP_RX_VERSION 0x0248 > > +#define PTP_TX_VERSION 0x0288 > > + > > #define PTP_RX_MOD 0x024F > > #define PTP_RX_MOD_BAD_UDPV4_CHKSUM_FORCE_FCS_DIS_ BIT(3) > > #define PTP_RX_TIMESTAMP_EN 0x024D > > @@ -3150,6 +3153,10 @@ static void lan8814_ptp_init(struct phy_device *phydev) > > lanphy_write_page_reg(phydev, 5, PTP_TX_PARSE_IP_ADDR_EN, 0); > > lanphy_write_page_reg(phydev, 5, PTP_RX_PARSE_IP_ADDR_EN, 0); > > > > + /* Disable checking for minorVersionPTP field */ > > + lanphy_write_page_reg(phydev, 5, PTP_RX_VERSION, 0xff00); > > + lanphy_write_page_reg(phydev, 5, PTP_TX_VERSION, 0xff00); > > Small nit: This looks a bit like magic values, from the datasheet I > understand the upper byte is the max supported version and the lower > byte is the min supported version, maybe this could be wrapped in > macros ? Your understanding is correct. Yes, I will update this in the next series. > > > + > > skb_queue_head_init(&ptp_priv->tx_queue); > > skb_queue_head_init(&ptp_priv->rx_queue); > > INIT_LIST_HEAD(&ptp_priv->rx_ts_list); > > Besides that, > > Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com> > > Thanks, > > Maxime
diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c index bf4053431dcb3..1752eaeadc42e 100644 --- a/drivers/net/phy/micrel.c +++ b/drivers/net/phy/micrel.c @@ -120,6 +120,9 @@ */ #define LAN8814_1PPM_FORMAT 17179 +#define PTP_RX_VERSION 0x0248 +#define PTP_TX_VERSION 0x0288 + #define PTP_RX_MOD 0x024F #define PTP_RX_MOD_BAD_UDPV4_CHKSUM_FORCE_FCS_DIS_ BIT(3) #define PTP_RX_TIMESTAMP_EN 0x024D @@ -3150,6 +3153,10 @@ static void lan8814_ptp_init(struct phy_device *phydev) lanphy_write_page_reg(phydev, 5, PTP_TX_PARSE_IP_ADDR_EN, 0); lanphy_write_page_reg(phydev, 5, PTP_RX_PARSE_IP_ADDR_EN, 0); + /* Disable checking for minorVersionPTP field */ + lanphy_write_page_reg(phydev, 5, PTP_RX_VERSION, 0xff00); + lanphy_write_page_reg(phydev, 5, PTP_TX_VERSION, 0xff00); + skb_queue_head_init(&ptp_priv->tx_queue); skb_queue_head_init(&ptp_priv->rx_queue); INIT_LIST_HEAD(&ptp_priv->rx_ts_list);