netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vladimir Oltean <olteanv@gmail.com>
To: Russell King - ARM Linux admin <linux@armlinux.org.uk>
Cc: Richard Cochran <richardcochran@gmail.com>,
	Andrew Lunn <andrew@lunn.ch>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	netdev@vger.kernel.org
Subject: Re: [PATCH RFC net-next] net: phy: add Marvell PHY PTP support
Date: Thu, 30 Jul 2020 01:53:30 +0300	[thread overview]
Message-ID: <20200729225330.3nnlpfvnbi3akdcv@skbuf> (raw)
In-Reply-To: <20200729220748.GW1605@shell.armlinux.org.uk>

On Wed, Jul 29, 2020 at 11:07:48PM +0100, Russell King - ARM Linux admin wrote:
> 
> The way PHY PTP support is handled is _really_ not nice.
> 
> If we have a phylib driver that supports timestamping, and a MAC driver
> that also supports timestamping, then what we end up with is very
> messed up.
> 
> 1. The SIOCGHWTSTAMP/SIOCSHWTSTAMP calls are directed through
>    ndo_do_ioctl().  The MAC driver gets first call on whether to
>    intercept these or not.  See dev_ifsioc().
> 
> 2. The ethtool ETHTOOL_GET_TS_INFO call, however, is given to the
>    PHY in preference to the MAC driver - there is no way for the MAC
>    driver to gain preference.  See __ethtool_get_ts_info().
> 
> So, if we have this situation (and yes, I do), then the SIOC*HWTSTAMP
> calls get implemented by the MAC driver, and takes effect at the MAC
> driver, while the ethtool ETHTOOL_GET_TS_INFO call returns results
> from the PHY driver.
> 
> That means the MAC driver's timestamping will be controllable from
> userspace, but userspace sees the abilities of the PHY driver's
> timestamping, and potentially directed to the wrong PTP clock
> instance.
> 
> What I see elsewhere in ethtool is that the MAC has the ability to
> override the phylib provided functionality - for example,
> __ethtool_get_sset_count(), __ethtool_get_strings(), and
> ethtool_get_phy_stats().  Would it be possible to do the same in
>  __ethtool_get_ts_info(), so at least a MAC driver can then decide
> whether to propagate the ethtool request to phylib or not, just like
> it can do with the SIOC*HWTSTAMP ioctls?  Essentially, reversing the
> order of:
> 
>         if (phy_has_tsinfo(phydev))
>                 return phy_ts_info(phydev, info);
>         if (ops->get_ts_info)
>                 return ops->get_ts_info(dev, info);
> 
> ?
> 
> Thanks.
> 
> -- 
> RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
> FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!

When we were discussing this in the other thread:
https://www.spinics.net/lists/netdev/msg669699.html
what I proposed was to introduce a NETIF_F_PHY_HWTSTAMP net_device flag
that could get set when the driver is capable of doing the right thing
with PHY timestamping. Then ethtool could look at that flag.
Additionally, if we could make this flag configurable as a netdev
feature with ethtool, then you could turn it off and even if you have an
attached PTP PHY, you'll use the PHC of the MAC.
You're free to leave your thoughts in that thread.

Thanks,
-Vladimir

  reply	other threads:[~2020-07-29 22:53 UTC|newest]

Thread overview: 74+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-14 16:26 [PATCH RFC net-next] net: phy: add Marvell PHY PTP support Russell King
2020-07-15 18:38 ` Andrew Lunn
2020-07-15 18:56   ` Russell King - ARM Linux admin
2020-07-16 11:33     ` Russell King - ARM Linux admin
2020-07-16 20:53       ` Richard Cochran
2020-07-16 20:48 ` Richard Cochran
2020-07-17  7:54   ` Kurt Kanzenbach
2020-07-18  2:24     ` Richard Cochran
2020-07-20 14:21       ` Richard Cochran
2020-07-20 14:37         ` Kurt Kanzenbach
2020-07-26 23:48 ` Russell King - ARM Linux admin
2020-07-29 10:58 ` Russell King - ARM Linux admin
2020-07-29 13:19   ` Richard Cochran
2020-07-29 13:28     ` Russell King - ARM Linux admin
2020-07-29 22:07       ` Russell King - ARM Linux admin
2020-07-29 22:53         ` Vladimir Oltean [this message]
2020-07-30 15:53         ` Richard Cochran
2020-07-30 18:38           ` Russell King - ARM Linux admin
2020-07-30 19:32             ` Richard Cochran
2020-07-30 19:44               ` Russell King - ARM Linux admin
2020-07-30 11:06     ` [PATCH RFC net-next] net: phy: add Marvell PHY PTP support [multicast/DSA issues] Russell King - ARM Linux admin
2020-07-30 11:54       ` Russell King - ARM Linux admin
2020-07-30 12:47         ` Russell King - ARM Linux admin
2023-02-27 14:40           ` Köry Maincent
2023-02-27 15:20             ` Russell King (Oracle)
2023-02-27 17:30               ` Köry Maincent
2023-02-27 17:42                 ` Russell King (Oracle)
2023-02-27 19:45               ` Richard Cochran
2023-02-27 20:09                 ` Russell King (Oracle)
2023-02-27 20:19                   ` Richard Cochran
2023-02-28 12:07                     ` Russell King (Oracle)
2023-02-28 13:16                       ` Köry Maincent
2023-02-28 13:36                         ` Russell King (Oracle)
2023-02-28 14:50                           ` Köry Maincent
2023-02-28 15:16                         ` Richard Cochran
2023-02-28 15:33                           ` Andrew Lunn
2023-02-28 21:13                             ` Richard Cochran
2023-02-28 16:27                           ` Russell King (Oracle)
2023-02-28 16:44                             ` Michael Walle
2023-02-28 16:58                               ` Russell King (Oracle)
2023-02-28 20:13                                 ` Michael Walle
2023-02-28 21:11                                   ` Richard Cochran
2023-02-28 21:24                             ` Richard Cochran
2023-02-28 22:26                             ` Jakub Kicinski
2023-02-28 22:40                               ` Russell King (Oracle)
2023-02-28 22:59                                 ` Jakub Kicinski
2023-03-01 16:04                                   ` Köry Maincent
2023-03-02  4:36                                     ` Richard Cochran
2023-03-02 11:49                                       ` Russell King (Oracle)
2023-03-02 16:49                                         ` Jakub Kicinski
2023-03-02 17:06                                           ` Köry Maincent
2023-03-02 17:23                                             ` Jakub Kicinski
2023-03-03 13:12                                               ` Köry Maincent
2023-03-03 23:28                                                 ` Jakub Kicinski
2023-03-02 17:26                                           ` Russell King (Oracle)
2023-03-03 10:20                                             ` Michael Walle
2023-03-03 13:20                                               ` Andrew Lunn
2023-03-03 13:34                                                 ` Köry Maincent
2023-03-03 13:59                                                   ` Andrew Lunn
2023-03-03 14:03                                                 ` Russell King (Oracle)
2023-03-03 16:34                                                   ` Andrew Lunn
2023-03-03 17:32                                                     ` Richard Cochran
2023-03-03 17:35                                                       ` Richard Cochran
2023-03-03 23:40                                                   ` Jakub Kicinski
2023-03-02 21:28                                           ` Richard Cochran
2023-03-02 21:19                                         ` Richard Cochran
2023-04-27 15:13               ` Köry Maincent
2023-04-27 16:50                 ` Andrew Lunn
2023-04-28  8:51                   ` Köry Maincent
2020-07-30 15:50         ` Richard Cochran
2020-07-31 14:41         ` Andrew Lunn
2023-03-02 10:37   ` [PATCH RFC net-next] net: phy: add Marvell PHY PTP support Köry Maincent
2023-03-02 17:38     ` Russell King (Oracle)
2023-03-02 21:35     ` Richard Cochran

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=20200729225330.3nnlpfvnbi3akdcv@skbuf \
    --to=olteanv@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=hkallweit1@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=richardcochran@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).