From: Harini Katakam <harini.katakam@amd.com>
To: <nicolas.ferre@microchip.com>, <davem@davemloft.net>,
<richardcochran@gmail.com>, <claudiu.beznea@microchip.com>,
<andrei.pistirica@microchip.com>, <kuba@kernel.org>,
<edumazet@google.com>, <pabeni@redhat.com>
Cc: <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<michal.simek@amd.com>, <harinikatakamlinux@gmail.com>,
<harini.katakam@amd.com>
Subject: [PATCH net-next v5 3/3] net: macb: Optimize reading HW timestamp
Date: Tue, 11 Apr 2023 18:07:12 +0530 [thread overview]
Message-ID: <20230411123712.11459-4-harini.katakam@amd.com> (raw)
In-Reply-To: <20230411123712.11459-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>
---
v5 and v4:
No change
v3:
No change
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 f962a95068a0..51d26fa190d7 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
next prev parent reply other threads:[~2023-04-11 12:37 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-11 12:37 [PATCH net-next v5 0/3] Macb PTP minor updates Harini Katakam
2023-04-11 12:37 ` [PATCH net-next v5 1/3] net: macb: Update gem PTP support check Harini Katakam
2023-04-11 12:37 ` [PATCH net-next v5 2/3] net: macb: Enable PTP unicast Harini Katakam
2023-04-11 12:37 ` Harini Katakam [this message]
2023-04-14 5:20 ` [PATCH net-next v5 0/3] Macb PTP minor updates patchwork-bot+netdevbpf
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=20230411123712.11459-4-harini.katakam@amd.com \
--to=harini.katakam@amd.com \
--cc=andrei.pistirica@microchip.com \
--cc=claudiu.beznea@microchip.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=harinikatakamlinux@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=michal.simek@amd.com \
--cc=netdev@vger.kernel.org \
--cc=nicolas.ferre@microchip.com \
--cc=pabeni@redhat.com \
--cc=richardcochran@gmail.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