From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 35B86C433F5 for ; Fri, 19 Nov 2021 11:51:46 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E603061A7D for ; Fri, 19 Nov 2021 11:51:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org E603061A7D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linutronix.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:References :In-Reply-To:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=qQnQhpANHACiLjzfAKxFTmMaeMC73yS6DebQVcXPWg0=; b=Pr4NkwUGwC1V/R Wne+cXdNyHWKC4AqXpY8h+Yu1zSMZv/1UVPMMcrI/4V9mxSxeEndWYbv6nkye21jmYCRPjnylBMLO a4S9iG6HkRQjB3o7ruUTLiQYgPVeX7mbphErdjDouViwUxcq5iGsfL2w9dcWCEIDtBLdBxslBMuIm RLYWWEQUO8veEcO55k7El1VLCzkRNmspVffwHxlf3AShCq8sdbVNYmF7CdrMML/C0TQwLU2f9A1nQ Nv8rvLd6iIuh+UkEto/BwTKfRxRISH1kEu0XRtQNgoeBsA35o1qnGAl70MTS4fCsY0CrDUAqvJz2S MLdp8cS9mIvP2eTWm1Dw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mo2PW-00AIq3-PO; Fri, 19 Nov 2021 11:50:30 +0000 Received: from galois.linutronix.de ([193.142.43.55]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mo2PT-00AIoc-4n for linux-arm-kernel@lists.infradead.org; Fri, 19 Nov 2021 11:50:28 +0000 From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1637322622; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=W6POUtH0WDjnpAZtH7GQuxf8NJaaCIqaSsDxPmV6kD0=; b=lWRkikNjJqFLkzp8GfhLlK48dWK3PnwvmzuzmcLeugYBWXERU++QA5o3aodUozL/UU6Bk5 q4mkTxizBm3JsAWHrEjZYw1tfoI4YAPLHPyyErTkyh8IdsuuXN1T1P64mJULdpqO3XavSA K+TeZ2+0ReY64Z/pIx9AA3HEcK9YO5NOcbTk2V6jgZBAMzqn0uMr6Buw7LnB1Ca+/EwGT+ rfLh6dxKAKXlgF1Wz1HYQ24X86Wj7e+4dUgqGrV2azvmwfv+1/d/NLG9yt6mJdSUb3J2YH +shzf2Ayjz9QloPIYth0xdrawUF/2jWdW7YQaTbZeuS9PzOLg+wTrHD3Kqzxnw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1637322622; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=W6POUtH0WDjnpAZtH7GQuxf8NJaaCIqaSsDxPmV6kD0=; b=54dZLbDVlE9rd1vOqGyu5HTixoKcrtmVLROgHRGExJiS69IYlMpPi2uUTD2JrWUP0GuZMX glQETqFGnlGETCCQ== To: Kurt Kanzenbach , "David S. Miller" , Jakub Kicinski Cc: Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , Maxime Coquelin , Voon Weifeng , Ong Boon Leong , Wong Vee Khee , Tan Tee Min , "Wong, Vee Khee" , Xiaoliang Yang , netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, Benedikt Spranger , Kurt Kanzenbach Subject: Re: [PATCH net-next v1] net: stmmac: Caclucate clock domain crossing error only once In-Reply-To: <20211119081010.27084-1-kurt@linutronix.de> References: <20211119081010.27084-1-kurt@linutronix.de> Date: Fri, 19 Nov 2021 12:50:21 +0100 Message-ID: <87mtm0l5z6.ffs@tglx> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211119_035027_374216_C3C79D97 X-CRM114-Status: GOOD ( 11.36 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Kurt, On Fri, Nov 19 2021 at 09:10, Kurt Kanzenbach wrote: > The clock domain crossing error (CDC) is calculated at every fetch of Tx or Rx > timestamps. It includes a division. Especially on arm32 based systems it is > expensive. It also saves the two conditionals. This does not make sense. What you want to say here is: It also requires two conditionals in the hotpath. > Therefore, move the calculation to the PTP initialization code and just use the > cached value in the timestamp retrieval functions. Maybe: Add a compensation value cache to struct plat_stmmacenet_data and subtract it unconditionally in the RX/TX functions which spares the conditionals. The value is initialized to 0 and if supported calculated in the PTP initialization code. or something to that effect. > + /* Calculate the clock domain crossing (CDC) error if necessary */ > + priv->plat->cdc_error_adj = 0; > + if (priv->plat->has_gmac4 && priv->plat->clk_ptp_rate) > + priv->plat->cdc_error_adj = (2 * NSEC_PER_SEC) / > + priv->plat->clk_ptp_rate; Nit. Just let stick it out. We lifted the 80 char limitation some time ago. Thanks, tglx _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel