Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp32514iob; Tue, 17 May 2022 17:51:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwIFMBZn+0D+2+k2HZpacjzo4GkmTyf9JGwexkma4Of29P1pzvN+PgckuYLwJ/0+sesfzla X-Received: by 2002:a05:6402:1113:b0:428:679e:f73f with SMTP id u19-20020a056402111300b00428679ef73fmr22145278edv.378.1652835065811; Tue, 17 May 2022 17:51:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652835065; cv=none; d=google.com; s=arc-20160816; b=TGWgSovel4H0EkQkPeSEqUE3RMS0P34RlaAm+MESNOP/2zIAEgXrvFCxl5Wb7RzeDI XxEBZde1iEWWoRd3fVlpgRHmL1+8QQFQSfi0K2060Ts+/PHWx93JBjNFx3pVQhzhzgaX SgwIU4QhXtAWryAN99yQ+2g2kuHseTaVa84TuTru677Z3rDWpPe0ALPmvJ/XX3jp0zMm 9dWdJg7S5KoKQYCHS6OlnU7T6X9bgR9n/Iai4VWTkSg33r8Dop2evpmrvcAPWToW0b/Z 8kX5m2vbhXWA22/l9za0dkGHwfuJ6Nvd22YxJlojyslgOMwLxESWbyO6pZ8lddI6SRkf +ZGw== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=d1n93CfhkyVzhEQlKg+hHYxckdzpZlfX6waTHyL8RlE=; b=K86I0iHpZcnjQoS6MZohSQ50xHxuRj15VSCyM4pexFvRevfJ1Y63S+L2FVcUWbC9Zl /osQyaafTET7AiI0dowyZwvd4f93WpbuYKQuR8eZQ5j5WB6TVl4lMzUv4EKax9fR+5aH u05YVqyC7x8MPqY/1uJR5BSchCaOApeoRgKKVOze2qHNs2qCvYOfpj3s4Dt0rBuvtv+e EKDxVxl/+8DJpZ5iVfdhlpHmkrsw21e7Ue8NqttL7o2cC/YvcCHashekcIJ8UqeR/95l +QuDo305H6uWHbH0Z/9TPGSV6oB5eadCbionQG+4yop90SDguPYnlE8eYVanYTWlY5Vm /heQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=TUP2ucCJ; 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=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bx26-20020a0564020b5a00b00423e1efca48si689902edb.198.2022.05.17.17.50.18; Tue, 17 May 2022 17:51:05 -0700 (PDT) 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=@linuxfoundation.org header.s=korg header.b=TUP2ucCJ; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348059AbiEPU1S (ORCPT + 99 others); Mon, 16 May 2022 16:27:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46776 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349708AbiEPUAV (ORCPT ); Mon, 16 May 2022 16:00:21 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4532243EEC; Mon, 16 May 2022 12:54:22 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4F3FD60ECF; Mon, 16 May 2022 19:53:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5AE65C385AA; Mon, 16 May 2022 19:53:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1652730822; bh=/5fSGM6N6EV85s8ReI6IjjWCeqnsuk4NSeXR+ofA39o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TUP2ucCJaNPJVEOQmlXDr26IUMYbCL0XgJjJi1wXUk29/P3ygYxgiomrpu2VF1Okl ZOJ4DbtjyYeMI3fkeqPtUro0hjfckg3NBNww8NGm9cDke3ZHPiO8QMe6DiGJ9SQbp2 E+R/7i5bOnYDXBeE9kXGYELu0geIWOmyy7fWdM34= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michal Michalik , Jacob Keller , Paul Menzel , Tony Nguyen , Sasha Levin , Gurucharan Subject: [PATCH 5.17 017/114] ice: fix PTP stale Tx timestamps cleanup Date: Mon, 16 May 2022 21:35:51 +0200 Message-Id: <20220516193625.990885627@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220516193625.489108457@linuxfoundation.org> References: <20220516193625.489108457@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 From: Michal Michalik [ Upstream commit a11b6c1a383ff092f432e040c20e032503785d47 ] Read stale PTP Tx timestamps from PHY on cleanup. After running out of Tx timestamps request handlers, hardware (HW) stops reporting finished requests. Function ice_ptp_tx_tstamp_cleanup() used to only clean up stale handlers in driver and was leaving the hardware registers not read. Not reading stale PTP Tx timestamps prevents next interrupts from arriving and makes timestamping unusable. Fixes: ea9b847cda64 ("ice: enable transmit timestamps for E810 devices") Signed-off-by: Michal Michalik Reviewed-by: Jacob Keller Reviewed-by: Paul Menzel Tested-by: Gurucharan (A Contingent worker at Intel) Signed-off-by: Tony Nguyen Signed-off-by: Sasha Levin --- drivers/net/ethernet/intel/ice/ice_ptp.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/intel/ice/ice_ptp.c b/drivers/net/ethernet/intel/ice/ice_ptp.c index 000c39d163a2..45ae97b8b97d 100644 --- a/drivers/net/ethernet/intel/ice/ice_ptp.c +++ b/drivers/net/ethernet/intel/ice/ice_ptp.c @@ -2279,6 +2279,7 @@ ice_ptp_init_tx_e810(struct ice_pf *pf, struct ice_ptp_tx *tx) /** * ice_ptp_tx_tstamp_cleanup - Cleanup old timestamp requests that got dropped + * @hw: pointer to the hw struct * @tx: PTP Tx tracker to clean up * * Loop through the Tx timestamp requests and see if any of them have been @@ -2287,7 +2288,7 @@ ice_ptp_init_tx_e810(struct ice_pf *pf, struct ice_ptp_tx *tx) * timestamp will never be captured. This might happen if the packet gets * discarded before it reaches the PHY timestamping block. */ -static void ice_ptp_tx_tstamp_cleanup(struct ice_ptp_tx *tx) +static void ice_ptp_tx_tstamp_cleanup(struct ice_hw *hw, struct ice_ptp_tx *tx) { u8 idx; @@ -2296,11 +2297,16 @@ static void ice_ptp_tx_tstamp_cleanup(struct ice_ptp_tx *tx) for_each_set_bit(idx, tx->in_use, tx->len) { struct sk_buff *skb; + u64 raw_tstamp; /* Check if this SKB has been waiting for too long */ if (time_is_after_jiffies(tx->tstamps[idx].start + 2 * HZ)) continue; + /* Read tstamp to be able to use this register again */ + ice_read_phy_tstamp(hw, tx->quad, idx + tx->quad_offset, + &raw_tstamp); + spin_lock(&tx->lock); skb = tx->tstamps[idx].skb; tx->tstamps[idx].skb = NULL; @@ -2322,7 +2328,7 @@ static void ice_ptp_periodic_work(struct kthread_work *work) ice_ptp_update_cached_phctime(pf); - ice_ptp_tx_tstamp_cleanup(&pf->ptp.port.tx); + ice_ptp_tx_tstamp_cleanup(&pf->hw, &pf->ptp.port.tx); /* Run twice a second */ kthread_queue_delayed_work(ptp->kworker, &ptp->work, -- 2.35.1