Received: by 10.192.165.148 with SMTP id m20csp557369imm; Wed, 25 Apr 2018 04:13:44 -0700 (PDT) X-Google-Smtp-Source: AB8JxZr0+0c/F0oKZhDK+BlbfC7gNNfj0pu22fXYANXSEaS35pRyrzvq1Q887FYfRJRW/JGNbqak X-Received: by 10.98.251.20 with SMTP id x20mr1377140pfm.48.1524654824670; Wed, 25 Apr 2018 04:13:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524654824; cv=none; d=google.com; s=arc-20160816; b=Eq/8JJDFmN+kfMtwz4XLVDivg8ZhCxJ72WnKyfDyruPolQNB1PAgXnqGyLgtniDs2Z kq01Rx/idufbaz6wR9FiXRAJpQ1XC08BGw9DpLdZxHRH1sLJphwN26uE7EzaWUlxY6AK nVpp7pVdppfRoQVwzmdnka4I8CbtPs6LglYEzJnwS70fDppwVLTlTiuczrMAQFcCdfjQ CuQlzwwZjDAqg295l5dd9Mz0zSgUQRaro5o0s8bk/6RxIGVoTj8VoMteNaQkw1cvH7+l s0KiFE7DIJaIFJMMpcEkYKhObDOd1CcrwW4XUoToKAF5U5iti4Pt4KhMEQXPhgu15+af mW6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=4U2ka1yawhmjZS9dQgYJKdlGzQnnd9fJzFVM0vcAUM4=; b=jUyY6W08zZeL/hnX1UV2KYH7q+sGG51lV3zLK/aeu4SrJOYpLAAXIlkmytaPr3qN/j oZmjMCePXZ7SilylWS/DAh6SB5d+VRrR7uUiYtXULp7zO3Skmn53gRt9wxG63HN2E3w3 0pXCN7jIrlgq9LP+09ijA+7y4DSeVa0DFFZbQ6SknPORwR6PDZ7uG1g4h0oeyM0M32D6 zozLOh+2szyFFE9sjuxJmhjX3VohTS9wJt0o6cSWz033qkW0UBwGmZu6NSQ+G+1q0rSp ypuz0anW5S7K/qrJFepYOV1ORvWXwXIXO67wkbCHU8feSv02WNgl9kqOyChEhJT+P1rO oNzA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u65si3869478pgc.137.2018.04.25.04.13.30; Wed, 25 Apr 2018 04:13:44 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753854AbeDYKks (ORCPT + 99 others); Wed, 25 Apr 2018 06:40:48 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:52134 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753433AbeDYKk3 (ORCPT ); Wed, 25 Apr 2018 06:40:29 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id C64F536; Wed, 25 Apr 2018 10:40:28 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Hua , Aaron Brown , Jeff Kirsher , Sasha Levin Subject: [PATCH 4.14 085/183] igb: Clear TXSTMP when ptp_tx_work() is timeout Date: Wed, 25 Apr 2018 12:35:05 +0200 Message-Id: <20180425103245.913696020@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180425103242.532713678@linuxfoundation.org> References: <20180425103242.532713678@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Daniel Hua [ Upstream commit 3a53285228165225a7f76c7d5ff1ddc0213ce0e4 ] Problem description: After ethernet cable connect and disconnect for several iterations on a device with i210, tx timestamp will stop being put into the socket. Steps to reproduce: 1. Setup a device with i210 and wire it to a 802.1AS capable switch ( Extreme Networks Summit x440 is used in our case) 2. Have the gptp daemon running on the device and make sure it is synced with the switch 3. Have the switch disable and enable the port, wait for the device gets resynced with the switch 4. Iterates step 3 until the device is not albe to get resynced 5. Review the log in dmesg and you will see warning message "igb : clearing Tx timestamp hang" Root cause: If ptp_tx_work() gets scheduled just before the port gets disabled, a LINK DOWN event will be processed before ptp_tx_work(), which may cause timeout in ptp_tx_work(). In the timeout logic, the TSYNCTXCTL's TXTT bit (Transmit timestamp valid bit) is not cleared, causing no new timestamp loaded to TXSTMP register. Consequently therefore, no new interrupt is triggerred by TSICR.TXTS bit and no more Tx timestamp send to the socket. Signed-off-by: Daniel Hua Tested-by: Aaron Brown Signed-off-by: Jeff Kirsher Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/intel/igb/igb_ptp.c | 9 +++++++++ 1 file changed, 9 insertions(+) --- a/drivers/net/ethernet/intel/igb/igb_ptp.c +++ b/drivers/net/ethernet/intel/igb/igb_ptp.c @@ -643,6 +643,10 @@ static void igb_ptp_tx_work(struct work_ adapter->ptp_tx_skb = NULL; clear_bit_unlock(__IGB_PTP_TX_IN_PROGRESS, &adapter->state); adapter->tx_hwtstamp_timeouts++; + /* Clear the tx valid bit in TSYNCTXCTL register to enable + * interrupt + */ + rd32(E1000_TXSTMPH); dev_warn(&adapter->pdev->dev, "clearing Tx timestamp hang\n"); return; } @@ -717,6 +721,7 @@ void igb_ptp_rx_hang(struct igb_adapter */ void igb_ptp_tx_hang(struct igb_adapter *adapter) { + struct e1000_hw *hw = &adapter->hw; bool timeout = time_is_before_jiffies(adapter->ptp_tx_start + IGB_PTP_TX_TIMEOUT); @@ -736,6 +741,10 @@ void igb_ptp_tx_hang(struct igb_adapter adapter->ptp_tx_skb = NULL; clear_bit_unlock(__IGB_PTP_TX_IN_PROGRESS, &adapter->state); adapter->tx_hwtstamp_timeouts++; + /* Clear the tx valid bit in TSYNCTXCTL register to enable + * interrupt + */ + rd32(E1000_TXSTMPH); dev_warn(&adapter->pdev->dev, "clearing Tx timestamp hang\n"); } }