Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp2051152rdb; Tue, 20 Feb 2024 15:57:50 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVh0UqTHSQi5DAe85MOicTdT8f6tHkK2zjC4LdWQFi/on5J34iOYEYv4p2TFS5eaSqV8mNgNRy9v+jKSGaaDs4FfuMBsqRjOuhgg9bdLQ== X-Google-Smtp-Source: AGHT+IEszBqojeWqonuDoq1Lh4XG0ULWcHv1YRowPLfNxymeyvfUOtNf4VhWg25FF61tZe1nnyMD X-Received: by 2002:a05:6402:2055:b0:564:f3c2:85b2 with SMTP id bc21-20020a056402205500b00564f3c285b2mr239832edb.25.1708473470776; Tue, 20 Feb 2024 15:57:50 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708473470; cv=pass; d=google.com; s=arc-20160816; b=CbtBhN57Ydumvdwq3Mn71MWDJlMEO2FQH0w/RB1K+NHUItCmF95Mo3RIUWy/2HNw+/ sMV5ngt0H2vl/KZZbAqnHYBtUOnzJG6a6c16juMsbr8VbpV+o9m/Jvtgz4gWadgFhsqj Fs5UBKHggYH9wIJTmGN3b6Eu1kAx4wo5ighEXMYek7Wwwc6xgfbjhkkz3Gr5kus2bXaq S38/jxkC1cWN36wfJg4butYo5ZxW78hJJw3D4e0UN2h37mcfiqGQRnyEx+QnKGm7TQuq wUURkE/rOMNkO3IyMLv3onJjWETNhdgRzxglDhlQyMypdplzn7W0SN7DXH2uVk1WD/mQ Ncaw== 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=uwhXeMFvnwzLRRCY4uk8mHwPXTisk+CveRfGO0MWYMU=; fh=sx1XCHPhD0iuduWE5Tfj8rY1Qob6EMfcOhY8fn8NFQU=; b=ZCNFgKUhKlYPefIf876ERGho5qV2iosADTlaYWT2NMuo0sPhemBa+nrHV2odDpNIjz dEFW9Q8wHj2YBWPri9mTe91bm4G3DECLRbplOr2r0Y2i9CyoN7+3TuOkEABi/2BKJqiD DVZoucWk/RehXi4UdTdOaY5OcNRaUrJanRLVUFtBKkXrvT3xRHG1UcRxKXl2TaHqi3UP 4mQELmh48BbyXtnermfN91fz7m39yoooGdXdG4E0qACxpvD1iw+6lvmMnhin0ImMbabH H7hIVdeX3rWD737voKASNJ1BMsnNZV3Ec53izrTaMJIcONSfiQCfT7aF6epJvzJHTZs+ nfVQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=bdL7ETPT; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-73841-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-73841-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id t21-20020a056402525500b0056486da5b2asi2141306edd.131.2024.02.20.15.57.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Feb 2024 15:57:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-73841-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=bdL7ETPT; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-73841-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-73841-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.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 87B121F22305 for ; Tue, 20 Feb 2024 23:57:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 29FB8155310; Tue, 20 Feb 2024 23:57:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="bdL7ETPT" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.10]) (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 6C2C31552E0; Tue, 20 Feb 2024 23:57:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.10 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708473445; cv=none; b=QaakS5cZ7qYu8U0lWgAlHk6aPW2DFg5TOZQYsMU44WV/PKmdXh5m+2Y8/aVGyayXYSKavPZJpogJldn3Vo5KuOQbw/VK1+8yH35hXMhXv0Dszd8z60K5PshLccvhkx3WU4FXdnA1Uk1Mc9t+2SCdcjJIHNR8jeDpuZHxib8gfzk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708473445; c=relaxed/simple; bh=j7Zixg1QER2i+fNcEEtAoe4JXGnkdFEd25ICHCfBynA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=o2pY9b9UypTAIybrPcetT0DqEL1eetj7eQyhZSguPRdgKo/tC3J4U2r3AUgerT3hE5AzZhskicZybvkqn7FWsd1Qvc2CqHuYDdbM6JwnW1Zc4CoeRUhig9VQltJro1V0wlGYGYY334dKiTfRWa13KZRVjXCICTMUcllvgT2df9E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=bdL7ETPT; arc=none smtp.client-ip=198.175.65.10 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1708473444; x=1740009444; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=j7Zixg1QER2i+fNcEEtAoe4JXGnkdFEd25ICHCfBynA=; b=bdL7ETPTBbI36X/aZsFP+S4wbUQojbg9fRAubwfXYhW7fpQaRJJSzRaS XzcYLC117jzuRawkkaU1sRJ8KI6IqmW69nXVhrcusX4e1a/E/pes6m1ho MiD2arPzbEWUeIA3KV0czcMYj5sZwjXcDO1YWMub0gMpytm2LqrbCYrlX cc06ce49hc4qlxr8rOvb+qhFG5UCryA0eNE79ZyY3qJVkBvQBtMmR4syg jnLVMAZU+feS5NCaY+nMN3K6x7XaUip2OEU9JYBHnZxuiv+QVDaCLgruf TnJwJW7dfUWUqRwTbphybnGmD4Xrl8LELeQPInGXelFSg0RwEy0S+XkB/ w==; X-IronPort-AV: E=McAfee;i="6600,9927,10990"; a="20041771" X-IronPort-AV: E=Sophos;i="6.06,174,1705392000"; d="scan'208";a="20041771" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Feb 2024 15:57:21 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.06,174,1705392000"; d="scan'208";a="5092390" Received: from vcostago-mobl3.jf.intel.com ([10.24.14.83]) by fmviesa008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Feb 2024 15:57:20 -0800 From: Vinicius Costa Gomes To: intel-wired-lan@lists.osuosl.org Cc: sasha.neftin@intel.com, richardcochran@gmail.com, kurt@linutronix.de, anthony.l.nguyen@intel.com, jesse.brandeburg@intel.com, netdev@vger.kernel.org, Vinicius Costa Gomes , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Jeff Kirsher , linux-kernel@vger.kernel.org Subject: [iwl-net v2 2/2] igb: Fix missing time sync events Date: Tue, 20 Feb 2024 15:57:11 -0800 Message-ID: <20240220235712.241552-3-vinicius.gomes@intel.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240220235712.241552-1-vinicius.gomes@intel.com> References: <20240220235712.241552-1-vinicius.gomes@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 --- 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 cebb44f51d5f..7662c42e35c1 100644 --- a/drivers/net/ethernet/intel/igb/igb_main.c +++ b/drivers/net/ethernet/intel/igb/igb_main.c @@ -6985,44 +6985,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.2