linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Jacob Keller <jacob.e.keller@intel.com>
Cc: "Andrew Lunn" <andrew@lunn.ch>,
	"Vladimir Oltean" <olteanv@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	"Eric Dumazet" <edumazet@google.com>,
	"Paolo Abeni" <pabeni@redhat.com>,
	"Tony Nguyen" <anthony.l.nguyen@intel.com>,
	"Przemek Kitszel" <przemyslaw.kitszel@intel.com>,
	"Saeed Mahameed" <saeedm@nvidia.com>,
	"Leon Romanovsky" <leon@kernel.org>,
	"Tariq Toukan" <tariqt@nvidia.com>,
	"Bryan Whitehead" <bryan.whitehead@microchip.com>,
	UNGLinuxDriver@microchip.com,
	"Horatiu Vultur" <horatiu.vultur@microchip.com>,
	"Paul Barker" <paul.barker.ct@bp.renesas.com>,
	"Niklas Söderlund" <niklas.soderlund@ragnatech.se>,
	"Richard Cochran" <richardcochran@gmail.com>,
	"Heiner Kallweit" <hkallweit1@gmail.com>,
	"Russell King" <linux@armlinux.org.uk>,
	"Andrei Botila" <andrei.botila@oss.nxp.com>,
	"Claudiu Manoil" <claudiu.manoil@nxp.com>,
	"Alexandre Belloni" <alexandre.belloni@bootlin.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	intel-wired-lan@lists.osuosl.org, linux-rdma@vger.kernel.org,
	linux-renesas-soc@vger.kernel.org
Subject: Re: [PATCH net-next 1/2] net: ptp: introduce .supported_extts_flags to ptp_clock_info
Date: Fri, 11 Apr 2025 18:20:44 -0700	[thread overview]
Message-ID: <20250411182044.0ee40963@kernel.org> (raw)
In-Reply-To: <20250408-jk-supported-perout-flags-v1-1-d2f8e3df64f3@intel.com>

Sorry for the late nit but the conversion is pretty inconsistent..

On Tue, 08 Apr 2025 13:55:14 -0700 Jacob Keller wrote:
> diff --git a/drivers/net/dsa/mv88e6xxx/ptp.c b/drivers/net/dsa/mv88e6xxx/ptp.c
> index aed4a4b07f34b1643a8bf51c2501d1f61ef0cf0b..4c037d4853fdbb86b5082437efe2ae7308559d66 100644
> --- a/drivers/net/dsa/mv88e6xxx/ptp.c
> +++ b/drivers/net/dsa/mv88e6xxx/ptp.c
> @@ -332,13 +332,6 @@ static int mv88e6352_ptp_enable_extts(struct mv88e6xxx_chip *chip,
>  	int pin;
>  	int err;
>  
> -	/* Reject requests with unsupported flags */
> -	if (rq->extts.flags & ~(PTP_ENABLE_FEATURE |
> -				PTP_RISING_EDGE |
> -				PTP_FALLING_EDGE |
> -				PTP_STRICT_FLAGS))
> -		return -EOPNOTSUPP;
> -
>  	/* Reject requests to enable time stamping on both edges. */
>  	if ((rq->extts.flags & PTP_STRICT_FLAGS) &&
>  	    (rq->extts.flags & PTP_ENABLE_FEATURE) &&
> @@ -566,6 +559,11 @@ int mv88e6xxx_ptp_setup(struct mv88e6xxx_chip *chip)
>  	chip->ptp_clock_info.verify	= ptp_ops->ptp_verify;
>  	chip->ptp_clock_info.do_aux_work = mv88e6xxx_hwtstamp_work;
>  
> +	chip->ptp_clock_info.supported_extts_flags = PTP_ENABLE_FEATURE |
> +						     PTP_RISING_EDGE |
> +						     PTP_FALLING_EDGE |
> +						     PTP_STRICT_FLAGS;

Sometimes you leave all the flags be..

>  	if (ptp_ops->set_ptp_cpu_port) {
>  		struct dsa_port *dp;
>  		int upstream = 0;
> diff --git a/drivers/net/dsa/sja1105/sja1105_ptp.c b/drivers/net/dsa/sja1105/sja1105_ptp.c
> index 08b45fdd1d2482b0f1f922aae4ff18db8e279f09..a7e9f9ab7a19a8413f2f450c3b4b3f636a177c67 100644
> --- a/drivers/net/dsa/sja1105/sja1105_ptp.c
> +++ b/drivers/net/dsa/sja1105/sja1105_ptp.c
> @@ -820,13 +820,6 @@ static int sja1105_extts_enable(struct sja1105_private *priv,
>  	if (extts->index != 0)
>  		return -EOPNOTSUPP;
>  
> -	/* Reject requests with unsupported flags */
> -	if (extts->flags & ~(PTP_ENABLE_FEATURE |
> -			     PTP_RISING_EDGE |
> -			     PTP_FALLING_EDGE |
> -			     PTP_STRICT_FLAGS))
> -		return -EOPNOTSUPP;
> -
>  	/* We can only enable time stamping on both edges, sadly. */
>  	if ((extts->flags & PTP_STRICT_FLAGS) &&
>  	    (extts->flags & PTP_ENABLE_FEATURE) &&
> @@ -912,6 +905,9 @@ int sja1105_ptp_clock_register(struct dsa_switch *ds)
>  		.n_pins		= 1,
>  		.n_ext_ts	= 1,
>  		.n_per_out	= 1,
> +		.supported_extts_flags = PTP_ENABLE_FEATURE |
> +					 PTP_EXTTS_EDGES |
> +					 PTP_STRICT_FLAGS,

..sometimes you combine FALLNIG|RISING -> EDGES ..

>  	};
>  
>  	/* Only used on SJA1105 */
> diff --git a/drivers/net/ethernet/intel/ice/ice_ptp.c b/drivers/net/ethernet/intel/ice/ice_ptp.c
> index 1fd1ae03eb90960d1e3e20acb0638baecaa995f5..96f68c356fe81b6954653f8903faf433ef6018f5 100644
> --- a/drivers/net/ethernet/intel/ice/ice_ptp.c
> +++ b/drivers/net/ethernet/intel/ice/ice_ptp.c
> @@ -1624,14 +1624,6 @@ static int ice_ptp_cfg_extts(struct ice_pf *pf, struct ptp_extts_request *rq,
>  	int pin_desc_idx;
>  	u8 tmr_idx;
>  
> -	/* Reject requests with unsupported flags */
> -
> -	if (rq->flags & ~(PTP_ENABLE_FEATURE |
> -			  PTP_RISING_EDGE |
> -			  PTP_FALLING_EDGE |
> -			  PTP_STRICT_FLAGS))
> -		return -EOPNOTSUPP;
> -
>  	tmr_idx = hw->func_caps.ts_func_info.tmr_index_owned;
>  	chan = rq->index;
>  
> @@ -2737,6 +2729,10 @@ static void ice_ptp_set_caps(struct ice_pf *pf)
>  	info->enable = ice_ptp_gpio_enable;
>  	info->verify = ice_verify_pin;
>  
> +	info->supported_extts_flags = PTP_RISING_EDGE |
> +				      PTP_FALLING_EDGE |
> +				      PTP_STRICT_FLAGS;

sometimes you drop ENABLE

> +
>  	switch (pf->hw.mac_type) {
>  	case ICE_MAC_E810:
>  		ice_ptp_set_funcs_e810(pf);
> diff --git a/drivers/net/ethernet/intel/igb/igb_ptp.c b/drivers/net/ethernet/intel/igb/igb_ptp.c
> index f323e1c1989f1bfbbf1f04043c2c0f14ae8c716f..7dd5bf02ca32506666ce422ae3da23e66b0adfca 100644
> --- a/drivers/net/ethernet/intel/igb/igb_ptp.c
> +++ b/drivers/net/ethernet/intel/igb/igb_ptp.c
> @@ -502,13 +502,6 @@ static int igb_ptp_feature_enable_82580(struct ptp_clock_info *ptp,
>  
>  	switch (rq->type) {
>  	case PTP_CLK_REQ_EXTTS:
> -		/* Reject requests with unsupported flags */
> -		if (rq->extts.flags & ~(PTP_ENABLE_FEATURE |
> -					PTP_RISING_EDGE |
> -					PTP_FALLING_EDGE |
> -					PTP_STRICT_FLAGS))
> -			return -EOPNOTSUPP;
> -
>  		/* Both the rising and falling edge are timestamped */
>  		if (rq->extts.flags & PTP_STRICT_FLAGS &&
>  		    (rq->extts.flags & PTP_ENABLE_FEATURE) &&
> @@ -658,13 +651,6 @@ static int igb_ptp_feature_enable_i210(struct ptp_clock_info *ptp,
>  
>  	switch (rq->type) {
>  	case PTP_CLK_REQ_EXTTS:
> -		/* Reject requests with unsupported flags */
> -		if (rq->extts.flags & ~(PTP_ENABLE_FEATURE |
> -					PTP_RISING_EDGE |
> -					PTP_FALLING_EDGE |
> -					PTP_STRICT_FLAGS))
> -			return -EOPNOTSUPP;
> -
>  		/* Reject requests failing to enable both edges. */
>  		if ((rq->extts.flags & PTP_STRICT_FLAGS) &&
>  		    (rq->extts.flags & PTP_ENABLE_FEATURE) &&
> @@ -1356,6 +1342,10 @@ void igb_ptp_init(struct igb_adapter *adapter)
>  		adapter->ptp_caps.n_per_out = IGB_N_PEROUT;
>  		adapter->ptp_caps.n_pins = IGB_N_SDP;
>  		adapter->ptp_caps.pps = 0;
> +		adapter->ptp_caps.supported_extts_flags = PTP_ENABLE_FEATURE |
> +							  PTP_RISING_EDGE |
> +							  PTP_FALLING_EDGE |
> +							  PTP_STRICT_FLAGS;
>  		adapter->ptp_caps.pin_config = adapter->sdp_config;
>  		adapter->ptp_caps.adjfine = igb_ptp_adjfine_82580;
>  		adapter->ptp_caps.adjtime = igb_ptp_adjtime_82576;
> @@ -1378,6 +1368,8 @@ void igb_ptp_init(struct igb_adapter *adapter)
>  		adapter->ptp_caps.n_ext_ts = IGB_N_EXTTS;
>  		adapter->ptp_caps.n_per_out = IGB_N_PEROUT;
>  		adapter->ptp_caps.n_pins = IGB_N_SDP;
> +		adapter->ptp_caps.supported_extts_flags = PTP_EXTTS_EDGES |
> +							  PTP_STRICT_FLAGS;

sometimes you both drop the enabled and combine the edges 

>  		adapter->ptp_caps.pps = 1;
>  		adapter->ptp_caps.pin_config = adapter->sdp_config;
>  		adapter->ptp_caps.adjfine = igb_ptp_adjfine_82580;

No preference which version you pick but shouldn't we go with one?
Or is this on purpose to show we have no preference?
-- 
pw-bot: cr

  reply	other threads:[~2025-04-12  1:20 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-08 20:55 [PATCH net-next 0/2] net: ptp: driver opt-in for supported PTP ioctl flags Jacob Keller
2025-04-08 20:55 ` [PATCH net-next 1/2] net: ptp: introduce .supported_extts_flags to ptp_clock_info Jacob Keller
2025-04-12  1:20   ` Jakub Kicinski [this message]
2025-04-14 20:00     ` Jacob Keller
2025-04-08 20:55 ` [PATCH net-next 2/2] net: ptp: introduce .supported_perout_flags " Jacob Keller
2025-04-10 10:07 ` [PATCH net-next 0/2] net: ptp: driver opt-in for supported PTP ioctl flags Vadim Fedorenko

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=20250411182044.0ee40963@kernel.org \
    --to=kuba@kernel.org \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=andrei.botila@oss.nxp.com \
    --cc=andrew@lunn.ch \
    --cc=anthony.l.nguyen@intel.com \
    --cc=bryan.whitehead@microchip.com \
    --cc=claudiu.manoil@nxp.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hkallweit1@gmail.com \
    --cc=horatiu.vultur@microchip.com \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=jacob.e.keller@intel.com \
    --cc=leon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=niklas.soderlund@ragnatech.se \
    --cc=olteanv@gmail.com \
    --cc=pabeni@redhat.com \
    --cc=paul.barker.ct@bp.renesas.com \
    --cc=przemyslaw.kitszel@intel.com \
    --cc=richardcochran@gmail.com \
    --cc=saeedm@nvidia.com \
    --cc=tariqt@nvidia.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).