From patchwork Wed Jan 18 16:17:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vacek X-Patchwork-Id: 45373 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2432231wrn; Wed, 18 Jan 2023 08:28:13 -0800 (PST) X-Google-Smtp-Source: AMrXdXsoNFnCTiB2YhevwtwpxL9gxKnlvRHB5Tcs7/0V6+UC4nlT0QFUPOHEc2+frfqk78EgjCd/ X-Received: by 2002:a05:6a20:a009:b0:b8:b0fe:cd40 with SMTP id p9-20020a056a20a00900b000b8b0fecd40mr10662544pzj.39.1674059293165; Wed, 18 Jan 2023 08:28:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674059293; cv=none; d=google.com; s=arc-20160816; b=zuwmCJINgDvgg0nGrK63txH8dHwJxTrZKpBjiaEK3Vlh591ldwR/2LchmKE6t/tJBK ATSD1JeCjEgeZz4v4vl7kuAWfhV+NXhJZT0mLC0oEfvAqM+sGuSk7FAjt4xUrhtg9JTU fFcrl0mn3syRlxzylgwBfukQBsjhInEQcgvAR4cooPOPy5Mo4KyIPx7MtmOKRWe+u9yS PZbhOP7xSufN0+SWILQbhBqCuqG/0z3JAB7JpFRhJwNVhlneYhzzQKPHpRNZSGEaOn2L diI24Qrxjpd+Kp3pS8o6XlTSdx+0aEL9Qd/LlJ2IXNvq8Rlq10AS+QTFlWA9N7B50/4R CtrQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version:reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=pU6AC9cRWg3g9Q98YLxAbBqb6BOxub7aw+UutKP+hlQ=; b=X7PQjzLIjojG4zkfZmFjI+W5ldOBkdZGYk1kw/7nEzDXzippY9hzBhku+pN3t1AxIs rhm6RD9HUzEsmrfS5CMuLTIXjs7WOfhTevBPypnQ71GMm6yh79uxT1RaMigMYD9EJ+Ml X4NVAi0fKES363awCPl8RTTF7UGhiAFkwwvMh1Iioq+bXx7KSwCg3l6HY18YZK2zjYMi omFyQXGZiHzecDkGAPdwstrO+On2dsYXmdVRShCedbqK2WClRa82Mi9llX0w0xf+VboS xv9PORS4i3H/EIbIq0KM0+Zr1/MIVdkbOqff+H3kI8BLmP4MqNJ6LuaPObEix0QOkU3p Di2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=gG+pQyrm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k62-20020a633d41000000b004991efb7281si36536791pga.423.2023.01.18.08.28.00; Wed, 18 Jan 2023 08:28:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=gG+pQyrm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230064AbjARQWM (ORCPT + 99 others); Wed, 18 Jan 2023 11:22:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52924 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229879AbjARQVs (ORCPT ); Wed, 18 Jan 2023 11:21:48 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 72A5F59242 for ; Wed, 18 Jan 2023 08:17:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1674058670; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=pU6AC9cRWg3g9Q98YLxAbBqb6BOxub7aw+UutKP+hlQ=; b=gG+pQyrmCSfMJhA+AUtBa7AVJtOyzt8bKZce8QwzaEhrL+7Gc8fN8IuR01CCqI+DLuDK/w v8bahqG7BmxCoND8lmTVbltGtJIxvyBgBOW/CXOtnDZg/hKiASDx7x/EAyEsMBd/poTKla H+MoIz2dhMTbznhZj1+urnBs3V/gQ/s= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-435-ZFMX-FN7OVCPNumI5uwNgg-1; Wed, 18 Jan 2023 11:17:47 -0500 X-MC-Unique: ZFMX-FN7OVCPNumI5uwNgg-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id AE2B91C05AB7; Wed, 18 Jan 2023 16:17:46 +0000 (UTC) Received: from metal.redhat.com (ovpn-192-69.brq.redhat.com [10.40.192.69]) by smtp.corp.redhat.com (Postfix) with ESMTP id 531EE2026D4B; Wed, 18 Jan 2023 16:17:44 +0000 (UTC) From: Daniel Vacek To: Jesse Brandeburg , Tony Nguyen , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Richard Cochran Cc: Daniel Vacek , intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2] ice/ptp: fix the PTP worker retrying indefinitely if the link went down Date: Wed, 18 Jan 2023 17:17:26 +0100 Message-Id: <20230118161727.2485457-1-neelx@redhat.com> Reply-To: 20230117181533.2350335-1-neelx@redhat.com MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1755297193307428739?= X-GMAIL-MSGID: =?utf-8?q?1755378397010182095?= When the link goes down the ice_ptp_tx_tstamp() may loop re-trying to process the packets till the 2 seconds timeout finally drops them. In such a case it makes sense to just drop them right away. Signed-off-by: Daniel Vacek --- drivers/net/ethernet/intel/ice/ice_ptp.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/intel/ice/ice_ptp.c b/drivers/net/ethernet/intel/ice/ice_ptp.c index d63161d73eb16..cb776a7199839 100644 --- a/drivers/net/ethernet/intel/ice/ice_ptp.c +++ b/drivers/net/ethernet/intel/ice/ice_ptp.c @@ -680,6 +680,7 @@ static bool ice_ptp_tx_tstamp(struct ice_ptp_tx *tx) struct ice_pf *pf; struct ice_hw *hw; u64 tstamp_ready; + bool link_up; int err; u8 idx; @@ -695,11 +696,14 @@ static bool ice_ptp_tx_tstamp(struct ice_ptp_tx *tx) if (err) return false; + /* Drop packets if the link went down */ + link_up = hw->port_info->phy.link_info.link_info & ICE_AQ_LINK_UP; + for_each_set_bit(idx, tx->in_use, tx->len) { struct skb_shared_hwtstamps shhwtstamps = {}; u8 phy_idx = idx + tx->offset; u64 raw_tstamp = 0, tstamp; - bool drop_ts = false; + bool drop_ts = !link_up; struct sk_buff *skb; /* Drop packets which have waited for more than 2 seconds */ @@ -728,7 +732,7 @@ static bool ice_ptp_tx_tstamp(struct ice_ptp_tx *tx) ice_trace(tx_tstamp_fw_req, tx->tstamps[idx].skb, idx); err = ice_read_phy_tstamp(hw, tx->block, phy_idx, &raw_tstamp); - if (err) + if (err && !drop_ts) continue; ice_trace(tx_tstamp_fw_done, tx->tstamps[idx].skb, idx);