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 X-Spam-Level: X-Spam-Status: No, score=-5.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DFCF3C43460 for ; Sat, 10 Apr 2021 13:18:19 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 77A79610F7 for ; Sat, 10 Apr 2021 13:18:19 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 77A79610F7 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=osZW7BwLIe7q/e3cssljnpZoilbmfozrl9QQGPrUV/w=; b=YzaP5N7GkaNXxiHM3i0vWlrJE Xx7wg7RzuBk0EVus+qiZo55uIqmy1PfYFvqnt1fbxX4Uq1EhseQsSr+py6tHxvPyu47T8JRffZAR/ XqkLYUPvyKe+55JU4z1eKHJ353BtTcd94HOi8sk+l/GUrlRVvnkDGnm+ICkNvHIMP9N5Prxlyn0mM NjUyF28GB88dgbbfkGoqK+I7Dx4oAqVkH6Tb6r380Qd7HB+CSqbDylg9nahhN7ZjAqsN7pQDDCZz0 0EeYvvko7Wpve5USbeJftfaxzyid1C5Fj4RqTP+zXF6XPdyN/bfkzDxmNXJS/RF2/F9sQHKRQUi0V olnk0gmXA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lVDTR-002rEJ-Pp; Sat, 10 Apr 2021 13:16:30 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lVDTP-002rEA-3V for linux-arm-kernel@desiato.infradead.org; Sat, 10 Apr 2021 13:16:27 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=g/40/oe7RC6Fg9hKfgChqIF/keHOENRToz/+cDh1I28=; b=wHw5SKDz2JADlwv/U1iGqQiZt2 1XpTbVkiIp1iNNzKifHWrR0G7+QZXa3/04ugNwkFD87jofFM4Erp6yh/DQsgU+juRz/OJc68Ijy9t E4RBmaRw05YhAH9xL0DJs0M87c+Rjt3a0oZLod2ilRgiFe6s+8IQM68oo1d3+UiaWPTm0DKlqZ2EW fUZ92nwecaDEzOZTcs42L7sZGGF8fd04xTG38cJc1wRdXjaAFvNWMbi6yL8iDYosOBOAkZLeoAMD3 CX/c/mUaWeD4Nbr6ffMvdMrRg5q8gv4py/QUfrOa/itoqIJI90BA97T+YG+rnemhgoNjNL6FU13vP tT0kgXxw==; Received: from mga07.intel.com ([134.134.136.100]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lVDTI-0056il-My for linux-arm-kernel@lists.infradead.org; Sat, 10 Apr 2021 13:16:25 +0000 IronPort-SDR: RaqUmyiv292W3ST1QB5r869R/PIDUOnm8tlNXT5al56KPb3N1+WUXxgdeo5rLUzeUUdRo2qgS2 rS7WGNmi7t/Q== X-IronPort-AV: E=McAfee;i="6000,8403,9950"; a="257902274" X-IronPort-AV: E=Sophos;i="5.82,210,1613462400"; d="scan'208";a="257902274" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Apr 2021 06:16:16 -0700 IronPort-SDR: K9zar4f0vNOGus1eGQXEBDsrvlbQ2NnorowaLzI/5TOGNIA6PF243l/U4Mkiep86Z7go7fx+s8 60kNxwsxmwgg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.82,210,1613462400"; d="scan'208";a="388085254" Received: from linux.intel.com ([10.54.29.200]) by fmsmga007.fm.intel.com with ESMTP; 10 Apr 2021 06:16:15 -0700 Received: from linux.intel.com (unknown [10.88.229.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by linux.intel.com (Postfix) with ESMTPS id 862245808EA; Sat, 10 Apr 2021 06:16:12 -0700 (PDT) Date: Sat, 10 Apr 2021 21:16:09 +0800 From: Wong Vee Khee To: Jakub Kicinski Cc: Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , "David S . Miller" , Maxime Coquelin , Voon Weifeng , Ong Boon Leong , netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, Richard Cochran , linux-kernel@vger.kernel.org Subject: Re: [PATCH net-next v2 1/1] net: stmmac: Add support for external trigger timestamping Message-ID: <20210410131609.GA12931@linux.intel.com> References: <20210407170442.1641-1-vee.khee.wong@linux.intel.com> <20210409175004.2fceacdd@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210409175004.2fceacdd@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210410_061620_823504_68BD6767 X-CRM114-Status: GOOD ( 22.67 ) 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 On Fri, Apr 09, 2021 at 05:50:04PM -0700, Jakub Kicinski wrote: > Other than the minor nit below LGTM. Let's give Richard one more day. > > On Thu, 8 Apr 2021 01:04:42 +0800 Wong Vee Khee wrote: > > +static void timestamp_interrupt(struct stmmac_priv *priv) > > +{ > > + struct ptp_clock_event event; > > + unsigned long flags; > > + u32 num_snapshot; > > + u32 ts_status; > > + u32 tsync_int; > > + u64 ptp_time; > > + int i; > > + > > + tsync_int = readl(priv->ioaddr + GMAC_INT_STATUS) & GMAC_INT_TSIE; > > + > > + if (!tsync_int) > > + return; > > + > > + /* Read timestamp status to clear interrupt from either external > > + * timestamp or start/end of PPS. > > + */ > > + ts_status = readl(priv->ioaddr + GMAC_TIMESTAMP_STATUS); > > + > > + if (priv->plat->ext_snapshot_en) { > > Are you intending to add more code after this if? Otherwise you could > flip the condition and return early instead of having the extra level > of indentation. > Thanks fo the suggestion. There's no plan to add more code after this as per STMMAC features that required this interrupt. I will flip the condition. > > + num_snapshot = (ts_status & GMAC_TIMESTAMP_ATSNS_MASK) >> > > + GMAC_TIMESTAMP_ATSNS_SHIFT; > > + > > + for (i = 0; i < num_snapshot; i++) { > > + spin_lock_irqsave(&priv->ptp_lock, flags); > > + get_ptptime(priv->ptpaddr, &ptp_time); > > + spin_unlock_irqrestore(&priv->ptp_lock, flags); > > + event.type = PTP_CLOCK_EXTTS; > > + event.index = 0; > > + event.timestamp = ptp_time; > > + ptp_clock_event(priv->ptp_clock, &event); > > + } > > + } > > +} > > Not really related to this patch but how does stmmac set IRQF_SHARED > and yet not track if it indeed generated the interrupt? Isn't that > against the rules? > Good point! Thanks for pointing that out. I looked at how STMMAC interrupt handlers are coded, and indeed there are no tracking. Will work on that and send as a seperate patch in near future. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel