netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vadim Fedorenko <vadim.fedorenko@linux.dev>
To: Simon Horman <horms@kernel.org>
Cc: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Egor Pomozov <epomozov@marvell.com>,
	Potnuri Bharat Teja <bharat@chelsio.com>,
	Dimitris Michailidis <dmichail@fungible.com>,
	MD Danish Anwar <danishanwar@ti.com>,
	Roger Quadros <rogerq@kernel.org>,
	Richard Cochran <richardcochran@gmail.com>,
	Russell King <linux@armlinux.org.uk>,
	Vladimir Oltean <vladimir.oltean@nxp.com>,
	netdev@vger.kernel.org
Subject: Re: [PATCH net-next v2 6/7] tsnep: convert to ndo_hwtstatmp API
Date: Wed, 15 Oct 2025 11:38:34 +0100	[thread overview]
Message-ID: <d160e924-dee1-46b9-8d24-71c3d9c00ea1@linux.dev> (raw)
In-Reply-To: <aO9xf0gW9F0qsaCz@horms.kernel.org>

On 15/10/2025 11:03, Simon Horman wrote:
> On Tue, Oct 14, 2025 at 10:42:15PM +0000, Vadim Fedorenko wrote:
>> Convert to .ndo_hwtstamp_get()/.ndo_hwtstamp_set() callbacks.
>> After conversions the rest of tsnep_netdev_ioctl() becomes pure
>> phy_do_ioctl_running(), so remove tsnep_netdev_ioctl() and replace
>> it with phy_do_ioctl_running() in .ndo_eth_ioctl.
>>
>> Signed-off-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>
> 
> ...
> 
>> diff --git a/drivers/net/ethernet/engleder/tsnep_ptp.c b/drivers/net/ethernet/engleder/tsnep_ptp.c
>> index 54fbf0126815..ae1308eb813d 100644
>> --- a/drivers/net/ethernet/engleder/tsnep_ptp.c
>> +++ b/drivers/net/ethernet/engleder/tsnep_ptp.c
>> @@ -19,57 +19,53 @@ void tsnep_get_system_time(struct tsnep_adapter *adapter, u64 *time)
>>   	*time = (((u64)high) << 32) | ((u64)low);
>>   }
>>   
>> -int tsnep_ptp_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
>> +int tsnep_ptp_hwtstamp_get(struct net_device *netdev,
>> +			   struct kernel_hwtstamp_config *config)
>>   {
>>   	struct tsnep_adapter *adapter = netdev_priv(netdev);
>> -	struct hwtstamp_config config;
>> -
>> -	if (!ifr)
>> -		return -EINVAL;
>> -
>> -	if (cmd == SIOCSHWTSTAMP) {
>> -		if (copy_from_user(&config, ifr->ifr_data, sizeof(config)))
>> -			return -EFAULT;
>> -
>> -		switch (config.tx_type) {
>> -		case HWTSTAMP_TX_OFF:
>> -		case HWTSTAMP_TX_ON:
>> -			break;
>> -		default:
>> -			return -ERANGE;
>> -		}
>> -
>> -		switch (config.rx_filter) {
>> -		case HWTSTAMP_FILTER_NONE:
>> -			break;
>> -		case HWTSTAMP_FILTER_ALL:
>> -		case HWTSTAMP_FILTER_PTP_V1_L4_EVENT:
>> -		case HWTSTAMP_FILTER_PTP_V1_L4_SYNC:
>> -		case HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ:
>> -		case HWTSTAMP_FILTER_PTP_V2_L4_EVENT:
>> -		case HWTSTAMP_FILTER_PTP_V2_L4_SYNC:
>> -		case HWTSTAMP_FILTER_PTP_V2_L4_DELAY_REQ:
>> -		case HWTSTAMP_FILTER_PTP_V2_L2_EVENT:
>> -		case HWTSTAMP_FILTER_PTP_V2_L2_SYNC:
>> -		case HWTSTAMP_FILTER_PTP_V2_L2_DELAY_REQ:
>> -		case HWTSTAMP_FILTER_PTP_V2_EVENT:
>> -		case HWTSTAMP_FILTER_PTP_V2_SYNC:
>> -		case HWTSTAMP_FILTER_PTP_V2_DELAY_REQ:
>> -		case HWTSTAMP_FILTER_NTP_ALL:
>> -			config.rx_filter = HWTSTAMP_FILTER_ALL;
>> -			break;
>> -		default:
>> -			return -ERANGE;
>> -		}
> 
> Hi Vadim,
> 
> I'm probably missing something obvious, but it's not clear to me why
> removing the inner switch statements above is ok. Or, perhaps more to the
> point, it seems inconsistent with other patches in this series.
> 
> OTOH, I do see why dropping the outer if conditions makes sense.

I believe it's just a question for git diff. It replaces original
tsnep_ptp_ioctl() function with get() callback. The only thing that new 
function does is copying actual config into reply.

The switch statement goes to set() callback where the logic is kept as
is. Original tsnep_ptp_ioctl() was serving both get and set operations,
but the logic was applied to set operation only.

> 
>> -
>> -		memcpy(&adapter->hwtstamp_config, &config,
>> -		       sizeof(adapter->hwtstamp_config));
>> +
>> +	*config = adapter->hwtstamp_config;
>> +	return 0;
>> +}
> 
> ...


  reply	other threads:[~2025-10-15 10:38 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-14 22:42 [PATCH net-next v2 0/7] convert net drivers to ndo_hwtstamp API part 1 Vadim Fedorenko
2025-10-14 22:42 ` [PATCH net-next v2 1/7] net: ti: am65-cpsw: move hw timestamping to ndo callback Vadim Fedorenko
2025-10-15 14:39   ` Simon Horman
2025-10-15 19:45   ` Jacob Keller
2025-10-14 22:42 ` [PATCH net-next v2 2/7] ti: icssg: convert to ndo_hwtstamp API Vadim Fedorenko
2025-10-15 14:39   ` Simon Horman
2025-10-15 19:46   ` Jacob Keller
2025-10-14 22:42 ` [PATCH net-next v2 3/7] amd-xgbe: convert to ndo_hwtstamp callbacks Vadim Fedorenko
2025-10-15 14:40   ` Simon Horman
2025-10-15 19:47   ` Jacob Keller
2025-10-15 19:58     ` Vadim Fedorenko
2025-10-15 20:23       ` Jacob Keller
2025-10-14 22:42 ` [PATCH net-next v2 4/7] net: atlantic: convert to ndo_hwtstamp API Vadim Fedorenko
2025-10-15 14:40   ` Simon Horman
2025-10-15 19:49   ` Jacob Keller
2025-10-14 22:42 ` [PATCH net-next v2 5/7] cxgb4: " Vadim Fedorenko
2025-10-15 10:05   ` Simon Horman
2025-10-15 10:33     ` Vadim Fedorenko
2025-10-15 14:37       ` Simon Horman
2025-10-15 20:05         ` Vadim Fedorenko
2025-10-16  8:10           ` Simon Horman
2025-10-15 20:18       ` Jacob Keller
2025-10-14 22:42 ` [PATCH net-next v2 6/7] tsnep: convert to ndo_hwtstatmp API Vadim Fedorenko
2025-10-15 10:03   ` Simon Horman
2025-10-15 10:38     ` Vadim Fedorenko [this message]
2025-10-15 14:38       ` Simon Horman
2025-10-14 22:42 ` [PATCH net-next v2 7/7] funeth: convert to ndo_hwtstamp API Vadim Fedorenko
2025-10-15 14:40   ` Simon Horman
2025-10-15 20:20   ` Jacob Keller

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=d160e924-dee1-46b9-8d24-71c3d9c00ea1@linux.dev \
    --to=vadim.fedorenko@linux.dev \
    --cc=Shyam-sundar.S-k@amd.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=bharat@chelsio.com \
    --cc=danishanwar@ti.com \
    --cc=davem@davemloft.net \
    --cc=dmichail@fungible.com \
    --cc=edumazet@google.com \
    --cc=epomozov@marvell.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=richardcochran@gmail.com \
    --cc=rogerq@kernel.org \
    --cc=vladimir.oltean@nxp.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).