Commit 2dd35600 authored by Kory Maincent's avatar Kory Maincent Committed by Jakub Kicinski
Browse files

net: Change the API of PHY default timestamp to MAC



Change the API to select MAC default time stamping instead of the PHY.
Indeed the PHY is closer to the wire therefore theoretically it has less
delay than the MAC timestamping but the reality is different. Due to lower
time stamping clock frequency, latency in the MDIO bus and no PHC hardware
synchronization between different PHY, the PHY PTP is often less precise
than the MAC. The exception is for PHY designed specially for PTP case but
these devices are not very widespread. For not breaking the compatibility
default_timestamp flag has been introduced in phy_device that is set by
the phy driver to know we are using the old API behavior.

Reviewed-by: default avatarRahul Rameshbabu <rrameshbabu@nvidia.com>
Signed-off-by: default avatarKory Maincent <kory.maincent@bootlin.com>
Link: https://patch.msgid.link/20240709-feature_ptp_netnext-v17-4-b5317f50df2a@bootlin.com


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent e50bfd6b
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -931,6 +931,9 @@ struct bcm_ptp_private *bcm_ptp_probe(struct phy_device *phydev)
		return ERR_CAST(clock);
	priv->ptp_clock = clock;

	/* Timestamp selected by default to keep legacy API */
	phydev->default_timestamp = true;

	priv->phydev = phydev;
	bcm_ptp_init(priv);

+2 −0
Original line number Diff line number Diff line
@@ -1447,6 +1447,8 @@ static int dp83640_probe(struct phy_device *phydev)
	for (i = 0; i < MAX_RXTS; i++)
		list_add(&dp83640->rx_pool_data[i].list, &dp83640->rxpool);

	/* Timestamp selected by default to keep legacy API */
	phydev->default_timestamp = true;
	phydev->mii_ts = &dp83640->mii_ts;
	phydev->priv = dp83640;

+6 −0
Original line number Diff line number Diff line
@@ -3781,6 +3781,9 @@ static void lan8814_ptp_init(struct phy_device *phydev)
	ptp_priv->mii_ts.ts_info  = lan8814_ts_info;

	phydev->mii_ts = &ptp_priv->mii_ts;

	/* Timestamp selected by default to keep legacy API */
	phydev->default_timestamp = true;
}

static int lan8814_ptp_probe_once(struct phy_device *phydev)
@@ -5279,6 +5282,9 @@ static int lan8841_probe(struct phy_device *phydev)

	phydev->mii_ts = &ptp_priv->mii_ts;

	/* Timestamp selected by default to keep legacy API */
	phydev->default_timestamp = true;

	return 0;
}

+3 −0
Original line number Diff line number Diff line
@@ -1570,6 +1570,9 @@ int vsc8584_ptp_probe(struct phy_device *phydev)
		return PTR_ERR(vsc8531->load_save);
	}

	/* Timestamp selected by default to keep legacy API */
	phydev->default_timestamp = true;

	vsc8531->ptp->phydev = phydev;

	return 0;
+3 −0
Original line number Diff line number Diff line
@@ -1660,6 +1660,9 @@ static int nxp_c45_probe(struct phy_device *phydev)
		priv->mii_ts.ts_info = nxp_c45_ts_info;
		phydev->mii_ts = &priv->mii_ts;
		ret = nxp_c45_init_ptp_clock(priv);

		/* Timestamp selected by default to keep legacy API */
		phydev->default_timestamp = true;
	} else {
		phydev_dbg(phydev, "PTP support not enabled even if the phy supports it");
	}
Loading