Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2615667lqp; Mon, 25 Mar 2024 04:39:18 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWZKHuGu8UdUVUcRBnF5kmTnYPWGnAVR0KbzCpwkRJ4UnbgAMg4ijhTts51cbvSQ5W9xQuxge5lUC9qNw5upJHOTo5KfBbd/7/3g4RfNg== X-Google-Smtp-Source: AGHT+IHEz+SjtpE+bY3puNRM0QpNvyGFkHVjsQwSeNPTpTxdloshtYmWRbPwuMit6RjXgtI7zov1 X-Received: by 2002:a9d:4d14:0:b0:6e5:1ca9:f65a with SMTP id n20-20020a9d4d14000000b006e51ca9f65amr7642281otf.14.1711366757797; Mon, 25 Mar 2024 04:39:17 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711366757; cv=pass; d=google.com; s=arc-20160816; b=Iecw2rypBjlvmgClahtACermG7//UF8Z7U3TVKVxhBoyKqLKuwMlroPBOT/o5rgKv7 o9eDs7e6pwGdfD9F+8azErngqBF6hIivqX2w/DWNTXPwrlH5+NvLfU13P72t2f0FD9tm KNQcE6cat1UEq6EC3FYuBjzADmCQv21lwCMfkVRl1/DYOc9ZG152wObsoWunfTYTZvQQ OutzSNIJKwa2tbVABicdVnwq1wPDbBmmWJdn18TMOzx04aXEYKaMnRQFOBdM377IIodn x7baDOLDWvmtN2cqSctWOhqTQcduR+YeBvwNetPhNs0+iq/HSimG0OauF8VZevWd9yau gFsg== 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=nf9yxVUrtFN/WbEWpKzhH0ahedH94/QKPjFK9sV8ws8=; fh=/5s2GkpjZkZdVYuzgiU4iok3EiBCuQywL+upIups42Q=; b=JIjdbQy5K9/x84W9Y6eJr6mEvbR1I4ZZdWoc+nM3+RlpRb3xp+5tlMFy//TkdtDWFm 6ydeLWIFGP7UqHfXgen4cLN9l27efoHWJKlDUQ6ebVBSii27JBjlpauuVW+nrI+3EXsA 8cZ6+2ZuOov9YBbkCq9OAxCW64C9G5g1p87gWTKiRvkN3sRdNymiySoiZ6hOFaoN2jGK 3yrnfziDLSKSgSUF0XSzdZJlkp2VChCYhBz1rSTXdDvP+0gueN7Gw6mvnfiioize3+64 MgUFNch9D47RFITRtFaefD3YelaWKF5WrvwrJQzjrldlPSERiaNSNzkEzDdZsQBgEv9o udnQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=SMxBr9Vh; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-115926-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-115926-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id v21-20020a634815000000b005dbf1fcc429si7404340pga.162.2024.03.25.04.39.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 04:39:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-115926-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=SMxBr9Vh; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-115926-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-115926-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 456B7B45655 for ; Mon, 25 Mar 2024 09:48:03 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3AD6338C546; Mon, 25 Mar 2024 03:03:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="SMxBr9Vh" 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 BF6381F4194; Sun, 24 Mar 2024 23:15:18 +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=1711322119; cv=none; b=kPBNXSNQ4IXHNPR+DUaEA7n3gZMkGd/4JA+GMO1Q66MFlQvCOpUKe0JuW/IcrRy2RN9EsNaLz3z9F1N/NqNhwIE2iL9lLNuDQMeaxN/64gEwN+AnMdyUWuHq/ZnX3PDtnWUdwop5S5syygoLtzBlMShO93SbBj/afFt2TI0Zieo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711322119; c=relaxed/simple; bh=JfQVRWu86MG5UY3Me40QtV5j7ZXUVNsK3Z6ajm/oeoI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=b8dRQMLSnCocSBFX9byaGcRXrhNn+8AjwkJxSnHabPbQs/DbT7UYtYMGJNFN0pv77sX/m4vlheH0cvHj9qO4KPNL4MnPvf2SKuooMZtXDBRXReDoD7ta9QH3wVcQQJpZhfy9mUFVn5W6qAoiAkeCM2/aPbms/M29UGTBQKAtZ2s= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=SMxBr9Vh; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id D1699C43390; Sun, 24 Mar 2024 23:15:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711322118; bh=JfQVRWu86MG5UY3Me40QtV5j7ZXUVNsK3Z6ajm/oeoI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SMxBr9VhG97jDdDm9vv1pyokGZ6qqWL3xULJtSAUWtCCheY8I0kQNW7dNEXNe1mU9 mh+bDPdvl8jQUkF+diSqO7xqP3bTCnTESglFYcMGfZhtAmtzBK+PvQVnRnRqjqqWuC RHI/9kCaJEQFg8/6mStZFGdBOKM5B3e1llKnNjwn7v7/3btEYAc/f3wSskH9gTOoA6 NVcjvozP0X/PYMcymWXFrtrfI2uXosnhJjeGPmFN/uupRlLdSIDan2+F+x+ca5bJXw 02WUeFt/LWfqEOpf28lO6eVjRVEaZTAqRsvPf5Z+l2sC8aSMs/n18VmKu3giA4wQf+ HYEO+7UYmcNnQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Vinicius Costa Gomes , Richard Cochran , Pucha Himasekhar Reddy , Tony Nguyen , Sasha Levin Subject: [PATCH 6.1 193/451] igb: Fix missing time sync events Date: Sun, 24 Mar 2024 19:07:49 -0400 Message-ID: <20240324231207.1351418-194-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324231207.1351418-1-sashal@kernel.org> References: <20240324231207.1351418-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 ee14cc9ea19ba9678177e2224a9c58cce5937c73 ] Fix "double" clearing of interrupts, which can cause external events or timestamps to be missed. The E1000_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 E1000_TSIRC into 'tsicr'; 2. handle the interrupts present into 'tsirc' and mark them in 'ack'; 3. write 'ack' into E1000_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: 00c65578b47b ("igb: enable internal PPS for the i210") Acked-by: Richard Cochran Signed-off-by: Vinicius Costa Gomes Tested-by: Pucha Himasekhar Reddy (A Contingent worker at Intel) Signed-off-by: Tony Nguyen Signed-off-by: Sasha Levin --- drivers/net/ethernet/intel/igb/igb_main.c | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c index 45ce4ed16146e..81d9a5338be5e 100644 --- a/drivers/net/ethernet/intel/igb/igb_main.c +++ b/drivers/net/ethernet/intel/igb/igb_main.c @@ -6926,44 +6926,31 @@ static void igb_extts(struct igb_adapter *adapter, int tsintr_tt) static void igb_tsync_interrupt(struct igb_adapter *adapter) { struct e1000_hw *hw = &adapter->hw; - u32 ack = 0, tsicr = rd32(E1000_TSICR); + u32 tsicr = rd32(E1000_TSICR); struct ptp_clock_event event; if (tsicr & TSINTR_SYS_WRAP) { event.type = PTP_CLOCK_PPS; if (adapter->ptp_caps.pps) ptp_clock_event(adapter->ptp_clock, &event); - ack |= TSINTR_SYS_WRAP; } if (tsicr & E1000_TSICR_TXTS) { /* retrieve hardware timestamp */ schedule_work(&adapter->ptp_tx_work); - ack |= E1000_TSICR_TXTS; } - if (tsicr & TSINTR_TT0) { + if (tsicr & TSINTR_TT0) igb_perout(adapter, 0); - ack |= TSINTR_TT0; - } - if (tsicr & TSINTR_TT1) { + if (tsicr & TSINTR_TT1) igb_perout(adapter, 1); - ack |= TSINTR_TT1; - } - if (tsicr & TSINTR_AUTT0) { + if (tsicr & TSINTR_AUTT0) igb_extts(adapter, 0); - ack |= TSINTR_AUTT0; - } - if (tsicr & TSINTR_AUTT1) { + if (tsicr & TSINTR_AUTT1) igb_extts(adapter, 1); - ack |= TSINTR_AUTT1; - } - - /* acknowledge the interrupts */ - wr32(E1000_TSICR, ack); } static irqreturn_t igb_msix_other(int irq, void *data) -- 2.43.0