linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Harini Katakam <harini.katakam@amd.com>
To: <robh+dt@kernel.org>, <andrew@lunn.ch>, <hkallweit1@gmail.com>,
	<linux@armlinux.org.uk>, <davem@davemloft.net>, <kuba@kernel.org>,
	<steen.hegelund@microchip.com>, <bjarni.jonasson@microchip.com>,
	<ioana.ciornei@nxp.com>, <likaige@loongson.cn>,
	<harini.katakam@xilinx.com>
Cc: <devicetree@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>, <harinikatakamlinux@gmail.com>,
	<michal.simek@xilinx.com>, <radhey.shyam.pandey@xilinx.com>
Subject: [PATCH net-next v2 2/2] net: macb: Optimize reading HW timestamp
Date: Tue, 21 Mar 2023 18:08:36 +0530	[thread overview]
Message-ID: <20230321123836.6906-3-harini.katakam@amd.com> (raw)
In-Reply-To: <20230321123836.6906-1-harini.katakam@amd.com>

From: Harini Katakam <harini.katakam@xilinx.com>

The seconds input from BD (6 bits) just needs to be ORed with the
upper bits from timer in this function. Avoid addition operation
every single time. Seconds rollover handling is left untouched.

Signed-off-by: Harini Katakam <harini.katakam@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Radhey Shyam Pandey <radhey.shyam.pandey@xilinx.com>
---
v2:
- Update HW timestamp logic to remove sec_rollover variable as per
Cladiu's comment
- Remove Richard Cochran's ACK on original patch as the patch changed

 drivers/net/ethernet/cadence/macb_ptp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/cadence/macb_ptp.c b/drivers/net/ethernet/cadence/macb_ptp.c
index e6cb20aaa76a..f9db4501b995 100644
--- a/drivers/net/ethernet/cadence/macb_ptp.c
+++ b/drivers/net/ethernet/cadence/macb_ptp.c
@@ -258,6 +258,8 @@ static int gem_hw_timestamp(struct macb *bp, u32 dma_desc_ts_1,
 	 */
 	gem_tsu_get_time(&bp->ptp_clock_info, &tsu, NULL);
 
+	ts->tv_sec |= ((~GEM_DMA_SEC_MASK) & tsu.tv_sec);
+
 	/* If the top bit is set in the timestamp,
 	 * but not in 1588 timer, it has rolled over,
 	 * so subtract max size
@@ -266,8 +268,6 @@ static int gem_hw_timestamp(struct macb *bp, u32 dma_desc_ts_1,
 	    !(tsu.tv_sec & (GEM_DMA_SEC_TOP >> 1)))
 		ts->tv_sec -= GEM_DMA_SEC_TOP;
 
-	ts->tv_sec += ((~GEM_DMA_SEC_MASK) & tsu.tv_sec);
-
 	return 0;
 }
 
-- 
2.17.1


  parent reply	other threads:[~2023-03-21 12:39 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-21 12:38 [PATCH net-next v2 0/2] Macb PTP minor updates Harini Katakam
2023-03-21 12:38 ` [PATCH net-next v2 1/2] net: macb: Enable PTP unicast Harini Katakam
2023-03-21 12:38 ` Harini Katakam [this message]
2023-03-21 12:40 [PATCH net-next v2 0/2] Macb PTP minor updates Harini Katakam
2023-03-21 12:40 ` [PATCH net-next v2 2/2] net: macb: Optimize reading HW timestamp Harini Katakam

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230321123836.6906-3-harini.katakam@amd.com \
    --to=harini.katakam@amd.com \
    --cc=andrew@lunn.ch \
    --cc=bjarni.jonasson@microchip.com \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=harini.katakam@xilinx.com \
    --cc=harinikatakamlinux@gmail.com \
    --cc=hkallweit1@gmail.com \
    --cc=ioana.ciornei@nxp.com \
    --cc=kuba@kernel.org \
    --cc=likaige@loongson.cn \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=michal.simek@xilinx.com \
    --cc=radhey.shyam.pandey@xilinx.com \
    --cc=robh+dt@kernel.org \
    --cc=steen.hegelund@microchip.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).