Message ID | 20240110113730.3704712-1-horatiu.vultur@microchip.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-22102-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2411:b0:101:2151:f287 with SMTP id m17csp731393dyi; Wed, 10 Jan 2024 03:38:15 -0800 (PST) X-Google-Smtp-Source: AGHT+IEW48MsqbeZhF0uWGfk9KGkimyIplR2QJIWRL9OzfgeTnV4SJmqsCvr1kGTNJa1l7qbqipw X-Received: by 2002:a50:d5d7:0:b0:557:dcf1:9321 with SMTP id g23-20020a50d5d7000000b00557dcf19321mr329975edj.40.1704886695169; Wed, 10 Jan 2024 03:38:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704886695; cv=none; d=google.com; s=arc-20160816; b=km7g9kB/SF4EprRKvov77e82bUmrzaJsZpdN0lzsxoeEnz4uHcbS2bz12V2AHN5x3O IDGi+X3C17uq0KQntkjO7DEGTbVXHWo+iOOG/1kToFJa+LLmV9f+ktPt6lN+WQrQV/Wy +bhsqjeCajPHjaXWO0s3HPCN2OBGJyEkZBsD7s5PTSZVVeHsVeP09cxvLpQS6XxKDaJv uYyjO9TJ83RC531SPIw6KHtl+v1T6QPtdSQuk8VyM5gxXE2OYGQtgNmTbs+ohLEnfe+4 w6XYEVREtO5tpvNuBNO6h6Mb617jif+ME8XB9OFZB4Yx212cbVXhObgpGT1xMlZlK8+/ m5Gg== 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:message-id:date:subject:cc:to :from:dkim-signature; bh=jL9jkCOFdcgimvVMPdk5UCoLl+NMEnzEaxsuo4ZHRao=; fh=btrBQ5TNG2t0NGX4dRnuM24b9PGxjIKvwpTQysMw40U=; b=NOB2PigetMJg//iXFzPooWSAOLbiSE9CvRU00Fqps7FE3jWY6cK8cDjtmnWcr9yqxC Slhj9je50K/Y/3moekd8fgiEADwIr8v+I3+1z+FmFVMT7mxI8SSgYMncD4etx7aKOxbl mx8LOGQ8/P48qYIOaC+CgACb8m+VjBURuoLogjN0MSbEyUShS3LfoFlWZgsPjcwuu46S Gs5uIw9lnwlGK39qGsA7wMfEjijAnOemFadRByZSxudrri6k9moIUxKFqKeGPDpJNfoW Dmcd7eeul79tX1jLV9X6uCS8deOst41Kyht6RjKkKrqi9Y97QQyK/bveo4Zl1wEjlwoR vU+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=cTr9mjEx; spf=pass (google.com: domain of linux-kernel+bounces-22102-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-22102-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 cw16-20020a056402229000b00557f63d399fsi1553496edb.177.2024.01.10.03.38.14 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jan 2024 03:38:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-22102-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=cTr9mjEx; spf=pass (google.com: domain of linux-kernel+bounces-22102-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-22102-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 BE8DF1F2300D for <ouuuleilei@gmail.com>; Wed, 10 Jan 2024 11:38:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1CDC647F60; Wed, 10 Jan 2024 11:37:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=microchip.com header.i=@microchip.com header.b="cTr9mjEx" Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) (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 8D6C447F40; Wed, 10 Jan 2024 11:37:52 +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=1704886672; x=1736422672; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=T78Tl1qTZBEDtDopMTraFY8YsyTlW8PPISWExCLGH0k=; b=cTr9mjEx4iSdjuj3up2agluOZslc1IfwidokV7fppHgonOy2qaRdqmYa 9UIAfMiqLHzfBqJTsSbdVi3N6wFdy/Euigqc8jD1gj2uPJvLKIdcKmF7M BLoanQxDSf5loe0dxmfVrT6MmOsGsUEkjvh0/w3cGZzV+dggZ7s3ViF8c GquN7mDZ4Uxpp7l5OdlB8hxB8llwdsQnH+yGaCvqFR9iWCL1Wf6BtrNI6 Z93jJUBTsxQ8EiLvPGg8/RgoX2PJZ1L91UthixVbA9XdB2RNuAUCZPuV4 2jyOmTrsI+VoMXiw3xgoV1dys2tBuQ8khD3qiZs3vCnkqV4GKtF8zK57g Q==; X-CSE-ConnectionGUID: /AVVYdDBSmGfb5OcBoykfA== X-CSE-MsgGUID: O5IgCn1lRnC2SJLAFDZmAQ== X-ThreatScanner-Verdict: Negative X-IronPort-AV: E=Sophos;i="6.04,184,1695711600"; d="scan'208";a="14975477" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa2.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 10 Jan 2024 04:37:49 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Wed, 10 Jan 2024 04:37:36 -0700 Received: from DEN-DL-M31836.microsemi.net (10.10.85.11) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server id 15.1.2507.35 via Frontend Transport; Wed, 10 Jan 2024 04:37:34 -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>, <horatiu.vultur@microchip.com> CC: <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>, <UNGLinuxDriver@microchip.com> Subject: [PATCH net] net: micrel: Fix PTP frame parsing for lan8841 Date: Wed, 10 Jan 2024 12:37:30 +0100 Message-ID: <20240110113730.3704712-1-horatiu.vultur@microchip.com> X-Mailer: git-send-email 2.34.1 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: 1787703271165299430 X-GMAIL-MSGID: 1787703271165299430 |
Series |
[net] net: micrel: Fix PTP frame parsing for lan8841
|
|
Commit Message
Horatiu Vultur
Jan. 10, 2024, 11:37 a.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.
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(+)
Comments
> 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>
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>
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!
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,