netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Köry Maincent" <kory.maincent@bootlin.com>
To: Vladimir Oltean <vladimir.oltean@nxp.com>
Cc: Jakub Kicinski <kuba@kernel.org>,
	Florian Fainelli <florian.fainelli@broadcom.com>,
	Broadcom internal kernel review list
	<bcm-kernel-feedback-list@broadcom.com>,
	Andrew Lunn <andrew@lunn.ch>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	Russell King <linux@armlinux.org.uk>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Paolo Abeni <pabeni@redhat.com>,
	Richard Cochran <richardcochran@gmail.com>,
	Radu Pirea <radu-nicolae.pirea@oss.nxp.com>,
	Jay Vosburgh <j.vosburgh@gmail.com>,
	Andy Gospodarek <andy@greyhouse.net>,
	Nicolas Ferre <nicolas.ferre@microchip.com>,
	Claudiu Beznea <claudiu.beznea@tuxon.dev>,
	Willem de Bruijn <willemdebruijn.kernel@gmail.com>,
	Jonathan Corbet <corbet@lwn.net>,
	Horatiu Vultur <horatiu.vultur@microchip.com>,
	UNGLinuxDriver@microchip.com, Simon Horman <horms@kernel.org>,
	Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-doc@vger.kernel.org,
	Maxime Chevallier <maxime.chevallier@bootlin.com>
Subject: Re: [PATCH net-next v7 15/16] net: ethtool: ts: Let the active time stamping layer be selectable
Date: Mon, 20 Nov 2023 15:53:44 +0100	[thread overview]
Message-ID: <20231120155344.14cd69d9@kmaincent-XPS-13-7390> (raw)
In-Reply-To: <20231120142316.d2emoaqeej2pg4s3@skbuf>

On Mon, 20 Nov 2023 16:23:16 +0200
Vladimir Oltean <vladimir.oltean@nxp.com> wrote:

> On Mon, Nov 20, 2023 at 02:49:29PM +0100, Köry Maincent wrote:
> > > The next question would be: if a driver performs PHY management in
> > > firmware, and does not use phylib, how should user space interact with it?
> > > What timestamping layer and upon what should the ID be chosen?  
> > 
> > In that case it could be the second options I refereed to.
> > Using the id to select the right timestamp within the NIC driver.
> > It indeed won't be called PHY timestamping as it is managed by the NIC
> > firmware but as it is managed by only one firmware and driver using the id
> > to separate the available timestamp seems a good idea.
> > 
> > Another solution would be to create another value in the layer enumeration.
> > PHY_NIC_TIMESTAMPING? Better idea? I am not good at naming.  
> 
> The point I was trying to make is that your current choice of exposing
> PHY_TIMESTAMPING in UAPI, when it really only refers to phylib PHYs,
> would lead exactly to this sort of UAPI balkanization where everyone
> wants to add more timestamping layers, and to define IDs to be specific
> to their own invented layer. Maybe the concept of timestamping layers is
> not what user space should see at all.
> 
> In previous email discussions, I was proposing to Jakub and you "what if
> we didn't let user space select a specific layer like PHY_TIMESTAMPING
> or MAC_TIMESTAMPING at all, but just select a specific phc_index as the
> provider of hardware timestamps"?
> 
> The limitation we're trying to lift is that currently, there can be only
> a single provider of hardware timestamps. We make that provider customizable.
> There is already a good understanding from user space that, if "ethtool -T"
> on an interface says there is no PHC, then there are going to be no
> hardware timestamps. So I thought it would be much more intuitive if the
> timestamping layer could be selected by the user merely by an unified
> phc_index (provided by a phylib phy or firmware based driver or whatever),
> and everything else would just be an implementation detail of the kernel.
> No one should care that it's a phylib phy, and shouldn't use a different
> procedure to identify its ID based on whether it's a phylib or firmware
> PHY.
> 
> It's a bit hard to align my expectation of what this series should offer
> with yours. I think we're talking past each other, which unfortunately
> makes me lose track and interest. I wish you could have answered my
> earlier question about this alternative proposal.
> https://lore.kernel.org/netdev/20231013170903.p3ycicebnfrsmoks@skbuf/

I did thought about it but I got stuck by the case of hardware timestamping
without PHC. Richard explained the reason of its existence here:
https://lore.kernel.org/netdev/ZS3MKWlnPqTe8gkq@hoboy.vegasvil.org/#t

Maybe I got a bit stuck in my implementation and should investigate more your
proposition and how to deal with this case. Do you have an idea on how to
solve it?

> > > Finally (and unrelated to the question above), why is
> > > SOFTWARE_TIMESTAMPING even a layer exposed in the UAPI? My understanding
> > > of this patch set is that it is meant to select the source of hardware
> > > timestamps that are given to a socket. What gap in the UAPI does the
> > > introduction of a SOFTWARE_TIMESTAMPING hwtstamping layer cover?  
> > 
> > As I explained to Jakub:
> > The software timestamping comes from the MAC driver capabilities and I
> > decided to separate software and MAC timestamping.  
> 
> Why? What was the problem? This confuses me because I don't understand
> what is the problem that the solution is trying to address, and whether
> the solution is orthogonal to all the other UAPI that exists for
> software and hardware timestamping at the socket layer - which AFAIK can
> happily coexist.
> 
> > If we select PHY timestamping we can't use software timestamping and
> > for an user, selecting the MAC as timestamping seems not logical to
> > use software timestamping (I got confused myself when I first dig into
> > it long time ago). Be able to select directly Software timestamping
> > seems appropriate and won't bring any harm. What do you think?  
> 
> Hmm, can you please explain what is the reason why software timestamping
> can't coexist with PHY timestamping? It is a genuine question to which I
> don't have an answer - I haven't used PHY timestamping. It must be
> something specific to that, since I do know that MAC + software
> timestamping work simultaneously just fine.

The software timestamp is managed through the MAC driver calling
skb_tx_timestamp() function. The PHY driver does not call it, that's why there
is no software timestamping in PHY driver capabilities. Also the PHY driver
doesn't know if the MAC driver support it so it currently can not coexist with
PHY timestamping.

Regards,
-- 
Köry Maincent, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com

  reply	other threads:[~2023-11-20 14:53 UTC|newest]

Thread overview: 79+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-14 11:28 [PATCH net-next v7 00/16] net: Make timestamping selectable Kory Maincent
2023-11-14 11:28 ` [PATCH net-next v7 01/16] net: Convert PHYs hwtstamp callback to use kernel_hwtstamp_config Kory Maincent
2023-11-14 11:28 ` [PATCH net-next v7 02/16] net: phy: Remove the call to phy_mii_ioctl in phy_hwstamp_get/set Kory Maincent
2023-11-14 11:28 ` [PATCH net-next v7 03/16] net: ethtool: Refactor identical get_ts_info implementations Köry Maincent
2023-11-14 11:28 ` [PATCH net-next v7 04/16] net: macb: Convert to ndo_hwtstamp_get() and ndo_hwtstamp_set() Kory Maincent
2023-11-14 11:28 ` [PATCH net-next v7 05/16] net: Make dev_set_hwtstamp_phylib accessible Kory Maincent
2023-11-14 11:28 ` [PATCH net-next v7 06/16] net: phy: micrel: fix ts_info value in case of no phc Kory Maincent
2023-11-14 11:28 ` [PATCH net-next v7 07/16] net_tstamp: Add TIMESTAMPING SOFTWARE and HARDWARE mask Kory Maincent
2023-11-14 15:52   ` Willem de Bruijn
2023-11-19  2:22   ` Jakub Kicinski
2023-11-20  9:05     ` Köry Maincent
2023-11-20 16:48       ` Jakub Kicinski
2023-11-20 16:51         ` Willem de Bruijn
2023-11-14 11:28 ` [PATCH net-next v7 08/16] net: ethtool: Add a command to expose current time stamping layer Kory Maincent
2023-11-19  2:24   ` Jakub Kicinski
2023-11-20  9:17     ` Köry Maincent
2023-11-20 10:40       ` Köry Maincent
2023-11-14 11:28 ` [PATCH net-next v7 09/16] netlink: specs: Introduce new netlink command to get current timestamp Kory Maincent
2023-11-19  2:25   ` Jakub Kicinski
2023-11-14 11:28 ` [PATCH net-next v7 10/16] net: ethtool: Add a command to list available time stamping layers Kory Maincent
2023-11-19  2:26   ` Jakub Kicinski
2023-11-14 11:28 ` [PATCH net-next v7 11/16] netlink: specs: Introduce new netlink " Kory Maincent
2023-11-14 11:28 ` [PATCH net-next v7 12/16] net: Replace hwtstamp_source by timestamping layer Kory Maincent
2023-11-14 11:28 ` [PATCH net-next v7 13/16] net: Change the API of PHY default timestamp to MAC Kory Maincent
2023-11-14 11:28 ` [PATCH net-next v7 14/16] net: ethtool: ts: Update GET_TS to reply the current selected timestamp Kory Maincent
2023-11-14 11:28 ` [PATCH net-next v7 15/16] net: ethtool: ts: Let the active time stamping layer be selectable Kory Maincent
2023-11-19  2:34   ` Jakub Kicinski
2023-11-20  9:44     ` Köry Maincent
2023-11-20 10:52       ` Vladimir Oltean
2023-11-20 11:14         ` Köry Maincent
2023-11-20 12:06           ` Vladimir Oltean
2023-11-20 13:49             ` Köry Maincent
2023-11-20 14:23               ` Vladimir Oltean
2023-11-20 14:53                 ` Köry Maincent [this message]
2023-11-20 16:10                   ` Vladimir Oltean
2023-11-20 17:17                     ` Köry Maincent
2023-11-20 17:37                 ` Jakub Kicinski
2023-11-20 18:39                   ` Andrew Lunn
2023-11-20 18:51                     ` Jakub Kicinski
2023-11-20 19:58                       ` Vladimir Oltean
2023-11-20 21:45                         ` Jakub Kicinski
2023-11-29 20:09                           ` Köry Maincent
2023-11-29 20:37                             ` Vladimir Oltean
2023-11-29 22:00                               ` Köry Maincent
2023-11-29 23:56                                 ` Jakub Kicinski
2023-11-30  0:06                                   ` Rahul Rameshbabu
2023-11-20 19:09                     ` Russell King (Oracle)
2023-11-20 19:00                   ` Vladimir Oltean
2023-11-20 19:58                     ` Jakub Kicinski
2023-11-20 21:17                       ` Vladimir Oltean
2023-11-20 21:37                         ` Jakub Kicinski
2023-11-20 22:05                           ` Vladimir Oltean
2023-11-21 17:31                             ` Köry Maincent
2023-11-21 17:43                               ` Jakub Kicinski
2023-11-22 13:44                                 ` Köry Maincent
2023-11-22 14:08                                   ` Vladimir Oltean
2023-11-22 14:19                                     ` Vladimir Oltean
2023-11-22 14:36                                     ` Vladimir Oltean
2023-11-22 16:54                                       ` Jakub Kicinski
2023-11-22 16:59                                         ` Vladimir Oltean
2023-11-22 17:55                                           ` Jakub Kicinski
2023-11-22 18:11                                             ` Willem de Bruijn
2023-11-24 17:27                                               ` Vladimir Oltean
2023-11-24 19:45                                                 ` Willem de Bruijn
2023-11-25 19:41                                                   ` Richard Cochran
2023-11-22 14:57                                     ` Köry Maincent
2023-11-22 16:50                                     ` Jakub Kicinski
2023-11-22 16:55                                       ` Vladimir Oltean
2023-11-22 18:01                                         ` Jakub Kicinski
2023-11-23 15:00                                           ` Köry Maincent
2023-11-23 17:32                                             ` Jakub Kicinski
2023-11-24 15:43                                               ` Vladimir Oltean
2023-11-24 17:34                                                 ` Köry Maincent
2023-11-24 19:57                                                   ` Vladimir Oltean
2023-11-24 20:47                                                   ` Willem de Bruijn
2023-11-21 23:40                               ` Richard Cochran
2023-11-14 11:28 ` [PATCH net-next v7 16/16] netlink: specs: Introduce time stamping set command Kory Maincent
2023-11-18 15:10 ` [PATCH net-next v7 00/16] net: Make timestamping selectable patchwork-bot+netdevbpf
2023-11-19  2:35   ` Jakub Kicinski

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=20231120155344.14cd69d9@kmaincent-XPS-13-7390 \
    --to=kory.maincent@bootlin.com \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=andrew@lunn.ch \
    --cc=andy@greyhouse.net \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=claudiu.beznea@tuxon.dev \
    --cc=corbet@lwn.net \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=florian.fainelli@broadcom.com \
    --cc=hkallweit1@gmail.com \
    --cc=horatiu.vultur@microchip.com \
    --cc=horms@kernel.org \
    --cc=j.vosburgh@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=maxime.chevallier@bootlin.com \
    --cc=netdev@vger.kernel.org \
    --cc=nicolas.ferre@microchip.com \
    --cc=pabeni@redhat.com \
    --cc=radu-nicolae.pirea@oss.nxp.com \
    --cc=richardcochran@gmail.com \
    --cc=thomas.petazzoni@bootlin.com \
    --cc=vladimir.oltean@nxp.com \
    --cc=willemdebruijn.kernel@gmail.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).