From: Paolo Abeni <pabeni@redhat.com>
To: Chintan Vankar <c-vankar@ti.com>,
Dan Carpenter <dan.carpenter@linaro.org>,
Siddharth Vadapalli <s-vadapalli@ti.com>,
Heiner Kallweit <hkallweit1@gmail.com>,
Andrew Lunn <andrew@lunn.ch>, Roger Quadros <rogerq@kernel.org>,
Richard Cochran <richardcochran@gmail.com>,
Jakub Kicinski <kuba@kernel.org>,
Eric Dumazet <edumazet@google.com>,
"David S. Miller" <davem@davemloft.net>
Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org
Subject: Re: [PATCH net-next v5 1/2] net: ethernet: ti: am65-cpts: Enable RX HW timestamp for PTP packets using CPTS FIFO
Date: Thu, 04 Apr 2024 12:40:38 +0200 [thread overview]
Message-ID: <7c8be16329668d343a971e265e923543cba5e304.camel@redhat.com> (raw)
In-Reply-To: <20240402114405.219100-2-c-vankar@ti.com>
On Tue, 2024-04-02 at 17:14 +0530, Chintan Vankar wrote:
> Add a new function "am65_cpts_rx_timestamp()" which checks for PTP
> packets from header and timestamps them.
>
> Add another function "am65_cpts_find_rx_ts()" which finds CPTS FIFO
> Event to get the timestamp of received PTP packet.
>
> Signed-off-by: Chintan Vankar <c-vankar@ti.com>
> ---
>
> Link to v4:
> https://lore.kernel.org/r/20240327054234.1906957-1-c-vankar@ti.com/
>
> Changes from v4 to v5:
> - Updated commit message.
> - Replaced "list_del_entry()" and "list_add()" functions with equivalent
> "list_move()" function.
>
> drivers/net/ethernet/ti/am65-cpts.c | 64 +++++++++++++++++++++++++++++
> drivers/net/ethernet/ti/am65-cpts.h | 6 +++
> 2 files changed, 70 insertions(+)
>
> diff --git a/drivers/net/ethernet/ti/am65-cpts.c b/drivers/net/ethernet/ti/am65-cpts.c
> index c66618d91c28..bc0bfda1db12 100644
> --- a/drivers/net/ethernet/ti/am65-cpts.c
> +++ b/drivers/net/ethernet/ti/am65-cpts.c
> @@ -906,6 +906,70 @@ static int am65_skb_get_mtype_seqid(struct sk_buff *skb, u32 *mtype_seqid)
> return 1;
> }
>
> +static u64 am65_cpts_find_rx_ts(struct am65_cpts *cpts, u32 skb_mtype_seqid)
> +{
> + struct list_head *this, *next;
> + struct am65_cpts_event *event;
> + unsigned long flags;
> + u32 mtype_seqid;
> + u64 ns = 0;
> +
> + am65_cpts_fifo_read(cpts);
> + spin_lock_irqsave(&cpts->lock, flags);
am65_cpts_fifo_read() acquires and releases this same lock. If moving
to a lockless schema is too complex, you should at least try to acquire
the lock only once. e.g. factor out a lockless __am65_cpts_fifo_read
variant and explicitly acquire the lock before invoke it.
> + list_for_each_safe(this, next, &cpts->events) {
> + event = list_entry(this, struct am65_cpts_event, list);
> + if (time_after(jiffies, event->tmo)) {
> + list_del_init(&event->list);
> + list_add(&event->list, &cpts->pool);
Jakub suggested to use list_move() in v4, you should apply that here,
too.
Cheers,
Paolo
next prev parent reply other threads:[~2024-04-04 10:40 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-02 11:44 [PATCH net-next v5 0/2] " Chintan Vankar
2024-04-02 11:44 ` [PATCH net-next v5 1/2] net: ethernet: ti: am65-cpts: " Chintan Vankar
2024-04-04 10:40 ` Paolo Abeni [this message]
2024-04-16 8:35 ` Chintan Vankar
2024-04-02 11:44 ` [PATCH net-next v5 2/2] net: ethernet: ti: am65-cpsw/ethtool: Enable RX HW timestamp only for PTP packets Chintan Vankar
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=7c8be16329668d343a971e265e923543cba5e304.camel@redhat.com \
--to=pabeni@redhat.com \
--cc=andrew@lunn.ch \
--cc=c-vankar@ti.com \
--cc=dan.carpenter@linaro.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hkallweit1@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=richardcochran@gmail.com \
--cc=rogerq@kernel.org \
--cc=s-vadapalli@ti.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
all inboxes | Powered by JetHome®