[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f1d94667-e57d-48a4-a5b7-86706a24efe3@linux.dev>
Date: Wed, 19 Nov 2025 15:14:44 +0000
From: Vadim Fedorenko <vadim.fedorenko@...ux.dev>
To: Kory Maincent <kory.maincent@...tlin.com>
Cc: Andrew Lunn <andrew+netdev@...n.ch>,
Florian Fainelli <florian.fainelli@...adcom.com>,
Russell King <linux@...linux.org.uk>, Heiner Kallweit
<hkallweit1@...il.com>, "David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>, Andrei Botila <andrei.botila@....nxp.com>,
Richard Cochran <richardcochran@...il.com>, Andrew Lunn <andrew@...n.ch>,
Simon Horman <horms@...nel.org>, Vladimir Oltean <vladimir.oltean@....com>,
Jacob Keller <jacob.e.keller@...el.com>,
bcm-kernel-feedback-list@...adcom.com, netdev@...r.kernel.org
Subject: Re: [PATCH net-next v3 9/9] ptp: ptp_ines: add HW timestamp
configuration reporting
On 19/11/2025 14:59, Kory Maincent wrote:
> On Wed, 19 Nov 2025 12:47:25 +0000
> Vadim Fedorenko <vadim.fedorenko@...ux.dev> wrote:
>
>> The driver partially stores HW timestamping configuration, but missing
>> pieces can be read from HW. Add callback to report configuration.
>>
>> Signed-off-by: Vadim Fedorenko <vadim.fedorenko@...ux.dev>
>> ---
>> drivers/ptp/ptp_ines.c | 23 +++++++++++++++++++++++
>> 1 file changed, 23 insertions(+)
>>
>> diff --git a/drivers/ptp/ptp_ines.c b/drivers/ptp/ptp_ines.c
>> index 56c798e77f20..790eb42b78db 100644
>> --- a/drivers/ptp/ptp_ines.c
>> +++ b/drivers/ptp/ptp_ines.c
>> @@ -328,6 +328,28 @@ static u64 ines_find_txts(struct ines_port *port, struct
>> sk_buff *skb) return ns;
>> }
>>
>> +static int ines_hwtstamp_get(struct mii_timestamper *mii_ts,
>> + struct kernel_hwtstamp_config *cfg)
>> +{
>> + struct ines_port *port = container_of(mii_ts, struct ines_port,
>> mii_ts);
>> + unsigned long flags;
>> + u32 port_conf;
>> +
>> + cfg->rx_filter = port->rxts_enabled ? HWTSTAMP_FILTER_PTP_V2_EVENT
>> + : HWTSTAMP_FILTER_NONE;
>> + if (port->txts_enabled) {
>> + spin_lock_irqsave(&port->lock, flags);
>> + port_conf = ines_read32(port, port_conf);
>> + spin_unlock_irqrestore(&port->lock, flags);
>> + cfg->tx_type = (port_conf & CM_ONE_STEP) ?
>> HWTSTAMP_TX_ONESTEP_P2P
>> + : HWTSTAMP_TX_OFF;
>
> You could also update txts_enabled to int and save the tx type as you did in
> other patches. I don't know what the best approach is, but in either way, this
> is ok to me.
I was thinking of this, but it can be treated as logic change, which I
would like to avoid in this series. But I totally agree, there is no
real need to read register each time if we can store the config. Unless
the value can be changed by some event outside of kernel configuration
flow.
>
> Reviewed-by: Kory Maincent <kory.maincent@...tlin.com>
>
> Thank you!
Powered by blists - more mailing lists