Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp1635185rwb; Thu, 19 Jan 2023 13:20:42 -0800 (PST) X-Google-Smtp-Source: AMrXdXtSrpm1Yvq4MlZOtGdpd4UVnOsHvYbHvZDr/VBLcMdsJN0pHGe8QDe7wCLWZIBcFSonpgRh X-Received: by 2002:a17:902:c3c5:b0:194:41aa:2131 with SMTP id j5-20020a170902c3c500b0019441aa2131mr32127208plj.25.1674163242248; Thu, 19 Jan 2023 13:20:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674163242; cv=none; d=google.com; s=arc-20160816; b=Gf7HUCa0HyTcxGhsss+/Nubwc7g7qUXc6ZE4S4QALEVEHGYYKQQudEYPccB3oh91+B 6EWw3Fs6L6XK5dHK7pePASZfkYMW02kzTxnzgR4Rqu4EG59pmOzJ1Lsf10bZrqQw1D4h 0wC1MgTAUsvxMCwmXeXpXvNe4ExdcYfM0Hb+id65WAncMCFz94EyjtqPh71LRxvkP7kn xr895lvwI0fCtFt6ScBU3L7hlf93RHhRekldChQBYoOoeOQCkg48IfX3/d2+M0Koi6XL AF+VZ0CIXf81XkMMfk7YDqElWAiKiQk48pSdgj5FOOTBTFkK6tY4LdryIeN5SwNj68nm 6F4g== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=chrJCnGKSxZ+Gqnkqp1hMJQsXXkdPAS4UelZoHmwcGY=; b=GHiucZ1m5tlId/VU0mJmIjkEff4t5cAfcN8I+/CQA35uVBAfNVkqp69QsrBy/C5BGB s9pXwkJYdfcwzczMMPGcf8QjOBfHUqvNb5xQpZjzakuORe5xebEY/m/+j9oBbRKBM/xg 0Pg50gGyKEQkQuejtrV+vuVzsccU89GYuPn7q6Uucz5p1RJcqArxNYxoB8nQNVym8khc pw2YM52c+02V9tz5ZXPFGLzTmEmvQxRoBh3fv8aGSpvg27r2ToeO/t4nNtokshAjid9+ kaB+PsN+bLp9sKV6AVCUvJ0AMsAGt4KJ5aG8aXytnrjpEGyWKi8b902qUIw2a5u15XS0 D/bg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=fNdizY8J; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r38-20020a63fc66000000b0049d0099742fsi38469408pgk.137.2023.01.19.13.20.35; Thu, 19 Jan 2023 13:20:42 -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=fNdizY8J; 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 S229991AbjASUYX (ORCPT + 46 others); Thu, 19 Jan 2023 15:24:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38702 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229710AbjASUYT (ORCPT ); Thu, 19 Jan 2023 15:24:19 -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 C77259B13D for ; Thu, 19 Jan 2023 12:23:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1674159812; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=chrJCnGKSxZ+Gqnkqp1hMJQsXXkdPAS4UelZoHmwcGY=; b=fNdizY8JDN+O5ERC0Nr0nOcJ8LW8D4eVD2yaVszdR3tnC5Zb1BGA/yIjUHPj3WvSM3PKhN +arVR5hhUAROajqq9Ozm9gM+gAe9i4EeCBjHv/QPg+1l0s9YPfqnyvbAzoKIup78Y5ST7F kprMqmer5IqCHQB3j6DKkjsReVSdhJE= 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-477-pXzxzMvAN1C6_QctN5KchA-1; Thu, 19 Jan 2023 15:23:29 -0500 X-MC-Unique: pXzxzMvAN1C6_QctN5KchA-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A1DE138149C1; Thu, 19 Jan 2023 20:23:28 +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 9336040C2064; Thu, 19 Jan 2023 20:23:26 +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 v3] ice/ptp: fix the PTP worker retrying indefinitely if the link went down Date: Thu, 19 Jan 2023 21:23:16 +0100 Message-Id: <20230119202317.2741092-1-neelx@redhat.com> In-Reply-To: <20230117181533.2350335-1-neelx@redhat.com> References: <20230117181533.2350335-1-neelx@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 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 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..3c39ae3ed2426 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 = ptp_port->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); -- 2.39.0