Re: [PATCH net-next v5 08/16] net: ethtool: Add a command to expose current time stamping layer

From: Florian Fainelli
Date: Mon Oct 09 2023 - 17:21:06 EST


On 10/9/23 08:51, Köry Maincent wrote:
From: Kory Maincent <kory.maincent@xxxxxxxxxxx>

Time stamping on network packets may happen either in the MAC or in
the PHY, but not both. In preparation for making the choice
selectable, expose both the current and available layers via ethtool.

In accordance with the kernel implementation as it stands, the current
layer will always read as "phy" when a PHY time stamping device is
present. Future patches will allow changing the current layer
administratively.

Signed-off-by: Kory Maincent <kory.maincent@xxxxxxxxxxx>

---

[snip]

+/*
+ * Hardware layer of the TIMESTAMPING provider
+ * New description layer should have the NETDEV_TIMESTAMPING or
+ * PHYLIB_TIMESTAMPING bit set to know which API to use for timestamping.

If we are talking about hardware layers, then we shall use either PHY_TIMESTAMPING or MAC_TIMESTAMPING. PHYLIB is the sub-subsystem to deal with Ethernet PHYs, and netdev is the object through which we represent network devices, so they are not even quite describing similar things. If you go with the {PHY,MAC}_TIMESTAMPING suggestion, then I could see how we could somewhat easily add PCS_TIMESTAMPING for instance.

+ */
+enum {
+ NO_TIMESTAMPING = 0,
+ NETDEV_TIMESTAMPING = (1 << 0),
+ PHYLIB_TIMESTAMPING = (1 << 1),
+ SOFTWARE_TIMESTAMPING = (1 << 2) | (1 << 0),

Why do we have to set NETDEV_TIMESTAMPING here, or is this a round-about way of enumerating 0, 1, 2 and 3?
--
Florian

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature