From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 767C31CCB32; Tue, 8 Oct 2024 12:38:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728391136; cv=none; b=D8kbYn5WlW6zULe9wGZNDaLNBxZv80yh8PY4BsIekHjEPVC7c+Akiv2RxmokKWbOz34MrRp/8ImJ+QzsZN0zpS4+uxYgOQXqpTabPmtGC2KPT3l2CggKgYeC/0gT+GSizPWmBg/MnB8GS00KX+0Rt36tw4mdmwVFjrvUK358wGc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728391136; c=relaxed/simple; bh=OPNccFTqk8g5w9RJ4+nMfKZ7+cD+bxltZdfeD5+YTGE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=O2ePs5NcN8YVhZLK2USTVtEPZ6U5LM/Olm5bL3tvbJDhWVZxhESad+Hwf2vZtpY94A2eaRiPX1C7z3Dl0l8a/iLcFlrwCyBGyOvr9JfD2V+Y0k2puHAUueiMdArL1Y9IZOoOQ+EeKCbW3ZWC2ROqQdAYhyPyjiLfY/J4GqzQDpI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=XkC1p6nJ; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="XkC1p6nJ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D539CC4CEC7; Tue, 8 Oct 2024 12:38:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1728391136; bh=OPNccFTqk8g5w9RJ4+nMfKZ7+cD+bxltZdfeD5+YTGE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XkC1p6nJL1gIxKZ5h1w6aXaJwyR0ko+VWwwy1BHzg4rwLWFtHmsiVFo8yZy3ZYUC/ UVvm4XDEGv52zJpv3qv+jXwYsm3oaabH18Uqz2GPNcFKbKxWpBHPCu9FJHuEHgCU7o yfZkVUS4ydY3AvLGnBMC6jkZSMnYJicf7MYqXjDE= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Aakash Menon , Horatiu Vultur , "David S. Miller" , Sasha Levin Subject: [PATCH 6.11 019/558] net: sparx5: Fix invalid timestamps Date: Tue, 8 Oct 2024 14:00:49 +0200 Message-ID: <20241008115702.979993339@linuxfoundation.org> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241008115702.214071228@linuxfoundation.org> References: <20241008115702.214071228@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.11-stable review patch. If anyone has any objections, please let me know. ------------------ From: Aakash Menon [ Upstream commit 151ac45348afc5b56baa584c7cd4876addf461ff ] Bit 270-271 are occasionally unexpectedly set by the hardware. This issue was observed with 10G SFPs causing huge time errors (> 30ms) in PTP. Only 30 bits are needed for the nanosecond part of the timestamp, clear 2 most significant bits before extracting timestamp from the internal frame header. Fixes: 70dfe25cd866 ("net: sparx5: Update extraction/injection for timestamping") Signed-off-by: Aakash Menon Reviewed-by: Horatiu Vultur Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/microchip/sparx5/sparx5_packet.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/microchip/sparx5/sparx5_packet.c b/drivers/net/ethernet/microchip/sparx5/sparx5_packet.c index f3f5fb4204689..70427643f777c 100644 --- a/drivers/net/ethernet/microchip/sparx5/sparx5_packet.c +++ b/drivers/net/ethernet/microchip/sparx5/sparx5_packet.c @@ -45,8 +45,12 @@ void sparx5_ifh_parse(u32 *ifh, struct frame_info *info) fwd = (fwd >> 5); info->src_port = FIELD_GET(GENMASK(7, 1), fwd); + /* + * Bit 270-271 are occasionally unexpectedly set by the hardware, + * clear bits before extracting timestamp + */ info->timestamp = - ((u64)xtr_hdr[2] << 24) | + ((u64)(xtr_hdr[2] & GENMASK(5, 0)) << 24) | ((u64)xtr_hdr[3] << 16) | ((u64)xtr_hdr[4] << 8) | ((u64)xtr_hdr[5] << 0); -- 2.43.0