Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2377245lqp; Sun, 24 Mar 2024 16:40:20 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV56vtQuObpuhw0GJXH74jRA30MPGuzpGFMOySrQoAoYiybPRwzzPhEsarPROEWCuHGcBx9Q7q8tLmFPETYRdUGanMVa5zW2ubEeYv29w== X-Google-Smtp-Source: AGHT+IFFmsGu9V9VvG2PCtH7qhmaHrKlGeAqP/ZIM4PSjzVFTG7Qj49jUGAWnpBPmQRMM+Ip+UNM X-Received: by 2002:a05:622a:1716:b0:431:1df3:6c3e with SMTP id h22-20020a05622a171600b004311df36c3emr7360249qtk.34.1711323619878; Sun, 24 Mar 2024 16:40:19 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711323619; cv=pass; d=google.com; s=arc-20160816; b=DljxAPjCEUiA/7XRlXG5N479EXskW781g0bm7+S+ba2bhmuPeyozczVA5FNrV3lsBc rgqGJQOXrz62GHyYUtz/Nh+/PVYrEormEIwNbi1+MMeakFIK9f9cP90u6XeQSJ46B/sG YzlmT1iYOFrts+95fybl0OP2lsQU0lKSte89mhtz1z82J/LgJPEyTdQy4xZ+aWLO48Fv yhTfCveGbigqm5n2z5pIzn9pHEVZBson9uYwTnx6YvPcaEh3A9ppgAQAq3uIxduhUn8o ROtFo/0S5dWHcdNu4t5s/dxUUd3c8TaC/Xx4j4AoVreDAOR2Pxhw0pqYa5YalpfUBp9M Uk4g== ARC-Message-Signature: i=2; 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=030LBLfKtLu9l0L6+AEdHaKkomiM/T+Ef+spRmrBl30=; fh=M09wjVRTiQyMAYJtRnazP4Wnt/K4NDtwIy0lcmW15KY=; b=m9C+2+irtA8aUinKlHL+OTz3/7JWQ3e2cB2V52Bxpsmnc9qLQ1VFS8uH1dfJA3OaAj 3Bpy4BPrbzjscADe7cekYi4nCiuxKghwFPKjuXbj8pZdp+092hlgSvuwWtE0Rpn46kgh qAU754VFfrmoTpEbJBfhSaZY7U6pau39ueEKi9Ne2i5Wlaat/Qb+/S0jrYGRkS+6PsQf 6lfCHBi57xkRyM0e36DnKp/gHgFTZnVlRUBboqaWZvWi8zpmVZnT8XHBpDkFfYHKGdrR QK2wGfXqIQqgXWVJoMHWIdZyGgUYIBieelLbppJHQhwIbktn8LqhngrnvTijrq6IMLsy v29Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ecHk2n1J; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-113190-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-113190-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id ex16-20020a05622a519000b004313b42c1e8si4201882qtb.283.2024.03.24.16.40.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Mar 2024 16:40:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-113190-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ecHk2n1J; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-113190-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-113190-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 9A8361C225A3 for ; Sun, 24 Mar 2024 23:40:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BA26E17966E; Sun, 24 Mar 2024 22:39:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ecHk2n1J" 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 B5B7717964E; Sun, 24 Mar 2024 22:39:53 +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=1711319993; cv=none; b=fhmwaxX4FrADEUJJN8oJCqgl2LGHv8Q7VdL42txRXT7BYpCMEkbp13xuDc5jn0fwF/CAw0ngtXnOjkypKb7g1h/821mbIQa12wYlYxLgJbLwo7aNkaxKqiHbgngOJxCXV1J8OqV2V+zk5jH0EASZvaI2tiX2eVJRi/T/MMgFoEs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711319993; c=relaxed/simple; bh=rMlIlxnxaYsH4cN4S0jrQRcDKJX2g/yoQOCqfN/YUjg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=nS/K8b4ShdBAEBPJEb5FuKb846RdrqaD9XXN5o78u9kgs6gwvF6ZD7S8lBIlSVl0cjz3NSKfacl7g09BRd1stFD0L0QbtcdBeaJSuqSYzUtMoEZ+iWAZx4zjI/bvvT0edaGAh6g7v0LA5bXXNjl7aiSUTrx+QuM4sp1pcNtICg8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ecHk2n1J; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id C050CC43399; Sun, 24 Mar 2024 22:39:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711319993; bh=rMlIlxnxaYsH4cN4S0jrQRcDKJX2g/yoQOCqfN/YUjg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ecHk2n1J9WIJuW1D3VRa0R1wm1o0uvCqZxDSOOXqTM/kjYulNNvLSI0MwfFQ4CDNR VFZ14hwtQlYZLI0W0UO0vPCD4FjnnayiJJrGIKse39N6H/XjGmj4pIvwMojktFpjL3 P8rRiJ4rHgW3GcCm82y6s6zCc1krsS5gHT2h9CV9wj9lO7fkDNBdtbF9CYhDTUS1Y2 zykbHtLc8j9mUAwC4XCyzklslMM1TRcSjz1lIQmFOCSG07hfD4UcS9lrLc0FPP9Edd 5A5aiQA+kEIVhrVNEHGGHtFITvDuSqFMx4gMdkmc3WNeG7SJpDrdiGdHb4x3ZGyx+X vTc4AnUQT0UFg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Vinicius Costa Gomes , Kurt Kanzenbach , Naama Meir , Tony Nguyen , Sasha Levin Subject: [PATCH 6.8 299/715] igc: Fix missing time sync events Date: Sun, 24 Mar 2024 18:27:58 -0400 Message-ID: <20240324223455.1342824-300-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324223455.1342824-1-sashal@kernel.org> References: <20240324223455.1342824-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit From: Vinicius Costa Gomes [ Upstream commit 244ae992e3e80e5c9c272c77324c831148457f95 ] Fix "double" clearing of interrupts, which can cause external events or timestamps to be missed. The IGC_TSIRC Time Sync Interrupt Cause register can be cleared in two ways, by either reading it or by writing '1' into the specific cause bit. This is documented in section 8.16.1. The following flow was used: 1. read IGC_TSIRC into 'tsicr'; 2. handle the interrupts present in 'tsirc' and mark them in 'ack'; 3. write 'ack' into IGC_TSICR; As both (1) and (3) will clear the interrupt cause, if the same interrupt happens again between (1) and (3) it will be ignored, causing events to be missed. Remove the extra clear in (3). Fixes: 2c344ae24501 ("igc: Add support for TX timestamping") Reviewed-by: Kurt Kanzenbach Tested-by: Kurt Kanzenbach # Intel i225 Signed-off-by: Vinicius Costa Gomes Tested-by: Naama Meir Signed-off-by: Tony Nguyen Signed-off-by: Sasha Levin --- drivers/net/ethernet/intel/igc/igc_main.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/drivers/net/ethernet/intel/igc/igc_main.c b/drivers/net/ethernet/intel/igc/igc_main.c index 81c21a893ede9..e447ba0370568 100644 --- a/drivers/net/ethernet/intel/igc/igc_main.c +++ b/drivers/net/ethernet/intel/igc/igc_main.c @@ -5302,25 +5302,22 @@ igc_features_check(struct sk_buff *skb, struct net_device *dev, static void igc_tsync_interrupt(struct igc_adapter *adapter) { - u32 ack, tsauxc, sec, nsec, tsicr; struct igc_hw *hw = &adapter->hw; + u32 tsauxc, sec, nsec, tsicr; struct ptp_clock_event event; struct timespec64 ts; tsicr = rd32(IGC_TSICR); - ack = 0; if (tsicr & IGC_TSICR_SYS_WRAP) { event.type = PTP_CLOCK_PPS; if (adapter->ptp_caps.pps) ptp_clock_event(adapter->ptp_clock, &event); - ack |= IGC_TSICR_SYS_WRAP; } if (tsicr & IGC_TSICR_TXTS) { /* retrieve hardware timestamp */ igc_ptp_tx_tstamp_event(adapter); - ack |= IGC_TSICR_TXTS; } if (tsicr & IGC_TSICR_TT0) { @@ -5334,7 +5331,6 @@ static void igc_tsync_interrupt(struct igc_adapter *adapter) wr32(IGC_TSAUXC, tsauxc); adapter->perout[0].start = ts; spin_unlock(&adapter->tmreg_lock); - ack |= IGC_TSICR_TT0; } if (tsicr & IGC_TSICR_TT1) { @@ -5348,7 +5344,6 @@ static void igc_tsync_interrupt(struct igc_adapter *adapter) wr32(IGC_TSAUXC, tsauxc); adapter->perout[1].start = ts; spin_unlock(&adapter->tmreg_lock); - ack |= IGC_TSICR_TT1; } if (tsicr & IGC_TSICR_AUTT0) { @@ -5358,7 +5353,6 @@ static void igc_tsync_interrupt(struct igc_adapter *adapter) event.index = 0; event.timestamp = sec * NSEC_PER_SEC + nsec; ptp_clock_event(adapter->ptp_clock, &event); - ack |= IGC_TSICR_AUTT0; } if (tsicr & IGC_TSICR_AUTT1) { @@ -5368,11 +5362,7 @@ static void igc_tsync_interrupt(struct igc_adapter *adapter) event.index = 1; event.timestamp = sec * NSEC_PER_SEC + nsec; ptp_clock_event(adapter->ptp_clock, &event); - ack |= IGC_TSICR_AUTT1; } - - /* acknowledge the interrupts */ - wr32(IGC_TSICR, ack); } /** -- 2.43.0