[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250411182044.0ee40963@kernel.org>
Date: Fri, 11 Apr 2025 18:20:44 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Jacob Keller <jacob.e.keller@...el.com>
Cc: Andrew Lunn <andrew@...n.ch>, Vladimir Oltean <olteanv@...il.com>,
"David S. Miller" <davem@...emloft.net>, Eric Dumazet
<edumazet@...gle.com>, Paolo Abeni <pabeni@...hat.com>, Tony Nguyen
<anthony.l.nguyen@...el.com>, Przemek Kitszel
<przemyslaw.kitszel@...el.com>, Saeed Mahameed <saeedm@...dia.com>, Leon
Romanovsky <leon@...nel.org>, Tariq Toukan <tariqt@...dia.com>, Bryan
Whitehead <bryan.whitehead@...rochip.com>, UNGLinuxDriver@...rochip.com,
Horatiu Vultur <horatiu.vultur@...rochip.com>, Paul Barker
<paul.barker.ct@...renesas.com>, Niklas Söderlund
<niklas.soderlund@...natech.se>, Richard Cochran
<richardcochran@...il.com>, Heiner Kallweit <hkallweit1@...il.com>, Russell
King <linux@...linux.org.uk>, Andrei Botila <andrei.botila@....nxp.com>,
Claudiu Manoil <claudiu.manoil@....com>, Alexandre Belloni
<alexandre.belloni@...tlin.com>, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org, intel-wired-lan@...ts.osuosl.org,
linux-rdma@...r.kernel.org, linux-renesas-soc@...r.kernel.org
Subject: Re: [PATCH net-next 1/2] net: ptp: introduce .supported_extts_flags
to ptp_clock_info
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
Powered by blists - more mailing lists