Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp6090207rwd; Mon, 19 Jun 2023 02:03:17 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7/gtHQIOwIhfIdG9XlKf0Fyfwk8TmImKe82SpWX8gR9sklA6zOD5xa5B8lkGW4t25B8RZn X-Received: by 2002:a05:6808:14d1:b0:39e:e41:b461 with SMTP id f17-20020a05680814d100b0039e0e41b461mr7891973oiw.39.1687165397777; Mon, 19 Jun 2023 02:03:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687165397; cv=none; d=google.com; s=arc-20160816; b=r++p7EJQ9TGPeojvjARy/57foLpAgIvXKJ8+19OUgd1PzHpoYA7y3ltz58o2e4hd5K RLXy31xIYZuJuVNWlGqARgXGVnraOEjIyFBi2RyJ5rM/j95mX59b6demLKBy9HdAge5Z OVT+tMNxAbAgSeF1W8MNya7vkP/Kbo4ft3I4piYojnU+HZEIuWi1AJtbeJBW+cqs1uTo tN1HAPf1LYbh/5IuRSm4du3ZEplyAEV/fEeuuiGlV8OYmjRUNMDPApc8kpZ6rvxY8CP1 rHoZjGa/cZPd+3fJ1ASV/6NH7XUQ25pv/OG6Fdh72kVOaGnWwAu8OUosulOOO5z83rT3 uwmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Tm2HHAdUeTUM3N0Fp4w81wl4GuNoXSTBn3OJNNMhc/M=; b=C0RblHlxELqv8XvtR8bYgP++SeOszqdnSjcXlwYoeOb5TrZnU802gbs8+wyzKMTbgE bZu1pIg0gCPFw0eXkcwaFzDE38TA3Y9ouOkKLuC7RAdFoEbSQzz/b1LJssaMebYxn2EU ADwZMGebiIi7VvZ76vXU0eIkziR7bpDgjvbprTsplMSG4tQOYENCfoVmX5FMkzRMDxEd IOroIHfQj+WQfmhUcr6vspwlMRg7E/G3a7a5ozwmSn/JqdZYHcAQm+IsIGx7y7mAr0Fy 1SG+9hhA4CfY11qBeWGepC79Ahvu92Qs/U7+/VULGh44CiYbNAe8/tKaxUYNoGWEQKku bUBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=dfsTaXir; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c17-20020a170903235100b001b212ecbd17si22004118plh.233.2023.06.19.02.02.54; Mon, 19 Jun 2023 02:03:17 -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=@microchip.com header.s=mchp header.b=dfsTaXir; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230474AbjFSIvg (ORCPT + 99 others); Mon, 19 Jun 2023 04:51:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53116 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229830AbjFSIvT (ORCPT ); Mon, 19 Jun 2023 04:51:19 -0400 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C82F9E60; Mon, 19 Jun 2023 01:49:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1687164592; x=1718700592; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=U4uDbW+Uf+4W45dZBBl8ZXGzRv4EdQrMLloH/ZuNHac=; b=dfsTaXirnTOjd6tpwfZaBD7Q2CO7DWYIr1P6DdLGZIlNEq83K7LkrzwT 9sTBnsVrMiViPQb7U2aHqzAqjVCaIieN6d+NyVI7pdt6CLpUhGLVoo/e3 ARhK9FC5xvH+DuH3k6taBnoUyzE2SbWI3o0Fp/TNrz5M9Oiqro2fe2LC8 x+CHUFYNIAbW1vtLsQyh07QnaqPY6s0Fefsy1Nj6mimy5xmglsdJi5c/P GD7dqJdtHER6zzuTBsvmdXQ7OrOiuMTTGd9HgyLPpu3pMIPZubvP7pCr8 BxvOLkce03qBRpXH9JHBDH8A1W1rr26gos4ASrZqHj5BxIRMpPTF9k56R A==; X-IronPort-AV: E=Sophos;i="6.00,254,1681196400"; d="scan'208";a="218582394" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa3.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 19 Jun 2023 01:49:44 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Mon, 19 Jun 2023 01:49:42 -0700 Received: from localhost (10.10.115.15) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server id 15.1.2507.21 via Frontend Transport; Mon, 19 Jun 2023 01:49:41 -0700 Date: Mon, 19 Jun 2023 10:49:41 +0200 From: Horatiu Vultur To: "Radu Pirea (NXP OSS)" CC: , , , , , , , , , , Subject: Re: [PATCH net-next v1 12/14] net: phy: nxp-c45-tja11xx: read ext trig ts TJA1120 Message-ID: <20230619084941.q6c26zhf4ssnseiu@soft-dev3-1> References: <20230616135323.98215-1-radu-nicolae.pirea@oss.nxp.com> <20230616135323.98215-13-radu-nicolae.pirea@oss.nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline In-Reply-To: <20230616135323.98215-13-radu-nicolae.pirea@oss.nxp.com> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_NONE,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 The 06/16/2023 16:53, Radu Pirea (NXP OSS) wrote: Hi Radu, > > static void nxp_c45_read_egress_ts(struct nxp_c45_phy *priv, > @@ -628,12 +648,12 @@ static long nxp_c45_do_aux_work(struct ptp_clock_info *ptp) > bool reschedule = false; > struct timespec64 ts; > struct sk_buff *skb; > - bool txts_valid; > + bool ts_valid; > u32 ts_raw; > > while (!skb_queue_empty_lockless(&priv->tx_queue) && poll_txts) { > - txts_valid = data->get_egressts(priv, &hwts); > - if (unlikely(!txts_valid)) { > + ts_valid = data->get_egressts(priv, &hwts); > + if (unlikely(!ts_valid)) { > /* Still more skbs in the queue */ > reschedule = true; > break; > @@ -654,9 +674,9 @@ static long nxp_c45_do_aux_work(struct ptp_clock_info *ptp) > netif_rx(skb); > } > > - if (priv->extts) { > - nxp_c45_get_extts(priv, &ts); > - if (timespec64_compare(&ts, &priv->extts_ts) != 0) { > + if (priv->extts && data->get_extts) { The data->get_extts can't be null. So I don't think you need this check. > + ts_valid = data->get_extts(priv, &ts); > + if (ts_valid && timespec64_compare(&ts, &priv->extts_ts) != 0) { > priv->extts_ts = ts; > event.index = priv->extts_index; > event.type = PTP_CLOCK_EXTTS; > @@ -1702,6 +1722,7 @@ static const struct nxp_c45_phy_data tja1103_phy_data = { > .ack_ptp_irq = false, > .counters_enable = tja1103_counters_enable, > .get_egressts = nxp_c45_get_hwtxts, > + .get_extts = nxp_c45_get_extts, > .ptp_init = tja1103_ptp_init, > .ptp_enable = tja1103_ptp_enable, > .nmi_handler = tja1103_nmi_handler, > @@ -1816,6 +1837,7 @@ static const struct nxp_c45_phy_data tja1120_phy_data = { > .ack_ptp_irq = true, > .counters_enable = tja1120_counters_enable, > .get_egressts = tja1120_get_hwtxts, > + .get_extts = tja1120_get_extts, > .ptp_init = tja1120_ptp_init, > .ptp_enable = tja1120_ptp_enable, > .nmi_handler = tja1120_nmi_handler, > -- > 2.34.1 > > -- /Horatiu