lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Tue, 16 Apr 2024 14:05:59 +0530
From: Chintan Vankar <c-vankar@...com>
To: Paolo Abeni <pabeni@...hat.com>, Dan Carpenter <dan.carpenter@...aro.org>,
        Siddharth Vadapalli <s-vadapalli@...com>,
        Heiner Kallweit
	<hkallweit1@...il.com>, Andrew Lunn <andrew@...n.ch>,
        Roger Quadros
	<rogerq@...nel.org>,
        Richard Cochran <richardcochran@...il.com>,
        Jakub
 Kicinski <kuba@...nel.org>, Eric Dumazet <edumazet@...gle.com>,
        "David S.
 Miller" <davem@...emloft.net>
CC: <linux-kernel@...r.kernel.org>, <netdev@...r.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



On 04/04/24 16:10, Paolo Abeni wrote:
> 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@...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.
> 

Moving to a lockless schema is complex for now, but I will make the
changes suggested by you in next version.

>> +	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.
> 
Okay. I will update that too.

> Cheers,
> 
> Paolo
> 
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ