Re: [PATCH net-next v1 12/14] net: phy: nxp-c45-tja11xx: read ext trig ts TJA1120
From: Horatiu Vultur
Date: Mon Jun 19 2023 - 04:51:40 EST
The 06/16/2023 16:53, Radu Pirea (NXP OSS) wrote:
Hi Radu,
>
> static void nxp_c45_read_egress_ts(struct nxp_c45_phy *priv,
> @@ -628,12 +648,12 @@ static long nxp_c45_do_aux_work(struct ptp_clock_info *ptp)
> bool reschedule = false;
> struct timespec64 ts;
> struct sk_buff *skb;
> - bool txts_valid;
> + bool ts_valid;
> u32 ts_raw;
>
> while (!skb_queue_empty_lockless(&priv->tx_queue) && poll_txts) {
> - txts_valid = data->get_egressts(priv, &hwts);
> - if (unlikely(!txts_valid)) {
> + ts_valid = data->get_egressts(priv, &hwts);
> + if (unlikely(!ts_valid)) {
> /* Still more skbs in the queue */
> reschedule = true;
> break;
> @@ -654,9 +674,9 @@ static long nxp_c45_do_aux_work(struct ptp_clock_info *ptp)
> netif_rx(skb);
> }
>
> - if (priv->extts) {
> - nxp_c45_get_extts(priv, &ts);
> - if (timespec64_compare(&ts, &priv->extts_ts) != 0) {
> + if (priv->extts && data->get_extts) {
The data->get_extts can't be null. So I don't think you need this check.
> + ts_valid = data->get_extts(priv, &ts);
> + if (ts_valid && timespec64_compare(&ts, &priv->extts_ts) != 0) {
> priv->extts_ts = ts;
> event.index = priv->extts_index;
> event.type = PTP_CLOCK_EXTTS;
> @@ -1702,6 +1722,7 @@ static const struct nxp_c45_phy_data tja1103_phy_data = {
> .ack_ptp_irq = false,
> .counters_enable = tja1103_counters_enable,
> .get_egressts = nxp_c45_get_hwtxts,
> + .get_extts = nxp_c45_get_extts,
> .ptp_init = tja1103_ptp_init,
> .ptp_enable = tja1103_ptp_enable,
> .nmi_handler = tja1103_nmi_handler,
> @@ -1816,6 +1837,7 @@ static const struct nxp_c45_phy_data tja1120_phy_data = {
> .ack_ptp_irq = true,
> .counters_enable = tja1120_counters_enable,
> .get_egressts = tja1120_get_hwtxts,
> + .get_extts = tja1120_get_extts,
> .ptp_init = tja1120_ptp_init,
> .ptp_enable = tja1120_ptp_enable,
> .nmi_handler = tja1120_nmi_handler,
> --
> 2.34.1
>
>
--
/Horatiu