From: Jakub Kicinski <kuba@kernel.org>
To: Vladimir Oltean <vladimir.oltean@nxp.com>
Cc: Maxim Georgiev <glipus@gmail.com>,
kory.maincent@bootlin.com, netdev@vger.kernel.org,
maxime.chevallier@bootlin.com, vadim.fedorenko@linux.dev,
richardcochran@gmail.com, gerhard@engleder-embedded.com
Subject: Re: [RFC PATCH v3 3/5] Add ndo_hwtstamp_get/set support to vlan code path
Date: Wed, 5 Apr 2023 17:00:10 -0700 [thread overview]
Message-ID: <20230405170010.1c989a8f@kernel.org> (raw)
In-Reply-To: <20230405180121.cefhbjlejuisywhk@skbuf>
On Wed, 5 Apr 2023 21:01:21 +0300 Vladimir Oltean wrote:
> - bonding is also DSA master when it has a DSA master as lower, so the
> DSA master restriction has already run once - on the bonding device
> itself
Huh, didn't know that.
> > The latter could be used for the first descend as well I'd presume.
> > And it can be exported for the use of more complex drivers like
> > bonding which want to walk the lowers themselves.
> >
> > > - it requires cfg.flags & HWTSTAMP_FLAG_BONDED_PHC_INDEX to be set in
> > > SET requests
> > >
> > > - it sets cfg.flags | HWTSTAMP_FLAG_BONDED_PHC_INDEX in GET responses
> >
> > IIRC that was to indicate to user space that the real PHC may change
> > for this netdev so it needs to pay attention to netlink notifications.
> > Shouldn't apply to *vlans?
>
> No, this shouldn't apply to *vlans, but I didn't suggest that it should.
Good, so if we just target *vlans we don't have to worry.
> I don't think my proposal was clear enough, so here's some code
> (untested, written in email client).
>
> static int macvlan_hwtstamp_get(struct net_device *dev,
> struct kernel_hwtstamp_config *cfg,
> struct netlink_ext_ack *extack)
> {
> struct net_device *real_dev = macvlan_dev_real_dev(dev);
>
> return generic_hwtstamp_get_lower(real_dev, cfg, extack);
> }
>
> static int macvlan_hwtstamp_set(struct net_device *dev,
> struct kernel_hwtstamp_config *cfg,
> struct netlink_ext_ack *extack)
> {
> struct net_device *real_dev = macvlan_dev_real_dev(dev);
>
> return generic_hwtstamp_set_lower(real_dev, cfg, extack);
> }
>
> static int vlan_hwtstamp_get(struct net_device *dev,
> struct kernel_hwtstamp_config *cfg,
> struct netlink_ext_ack *extack)
> {
> struct net_device *real_dev = vlan_dev_priv(dev)->real_dev;
>
> return generic_hwtstamp_get_lower(real_dev, cfg, extack);
> }
>
> static int vlan_hwtstamp_set(struct net_device *dev,
> struct kernel_hwtstamp_config *cfg,
> struct netlink_ext_ack *extack)
> {
> struct net_device *real_dev = vlan_dev_priv(dev)->real_dev;
>
> return generic_hwtstamp_set_lower(real_dev, cfg, extack);
> }
I got that, but why wouldn't this not be better, as it avoids
the 3 driver stubs? (also written in the MUA)
int net_lower_hwtstamp_set(struct net_device *dev,
struct kernel_hwtstamp_config *cfg,
struct netlink_ext_ack *extack)
{
struct list_head *iter = dev->adj_list.lower.next;
struct net_device *lower;
lower = netdev_lower_get_next(dev, &iter);
return generic_hwtstamp_set_lower(lower, cfg, extack);
}
> static int bond_hwtstamp_get(struct net_device *bond_dev,
> struct kernel_hwtstamp_config *cfg,
> struct netlink_ext_ack *extack)
> {
> struct bonding *bond = netdev_priv(bond_dev);
> struct net_device *real_dev = bond_option_active_slave_get_rcu(bond);
> int err;
>
> if (!real_dev)
> return -EOPNOTSUPP;
>
> err = generic_hwtstamp_get_lower(real_dev, cfg, extack);
> if (err)
> return err;
>
> /* Set the BOND_PHC_INDEX flag to notify user space */
> cfg->flags |= HWTSTAMP_FLAG_BONDED_PHC_INDEX;
>
> return 0;
> }
>
> static int bond_hwtstamp_set(struct net_device *bond_dev,
> struct kernel_hwtstamp_config *cfg,
> struct netlink_ext_ack *extack)
> {
> struct bonding *bond = netdev_priv(bond_dev);
> struct net_device *real_dev = bond_option_active_slave_get_rcu(bond);
> int err;
>
> if (!real_dev)
> return -EOPNOTSUPP;
>
> if (!(cfg->flags & HWTSTAMP_FLAG_BONDED_PHC_INDEX))
> return -EOPNOTSUPP;
>
> return generic_hwtstamp_set_lower(real_dev, cfg, extack);
> }
>
> Doesn't seem in any way necessary to complicate things with the netdev
> adjacence lists?
What is the complication? We can add a "get first" helper maybe to hide
the oddities of the linking.
> > Yes, user space must be involved anyway, because the entire clock will
> > change. IMHO implementing the pass thru for timestamping requests on
> > bonding is checkbox engineering, kernel can't make it work
> > transparently. But nobody else spoke up when it was proposed so...
>
> ok, but that's a bit beside the point here.
You cut off the quote it was responding to so IDK if it is.
next prev parent reply other threads:[~2023-04-06 0:00 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-05 6:33 [RFC PATCH v3 3/5] Add ndo_hwtstamp_get/set support to vlan code path Maxim Georgiev
2023-04-05 12:26 ` Vladimir Oltean
2023-04-05 16:19 ` Max Georgiev
2023-04-05 16:28 ` Vladimir Oltean
2023-04-05 16:42 ` Jakub Kicinski
2023-04-05 17:03 ` Vladimir Oltean
2023-04-05 17:13 ` Jakub Kicinski
2023-04-05 17:28 ` Vladimir Oltean
2023-04-05 17:34 ` Vladimir Oltean
2023-04-05 17:42 ` Jakub Kicinski
2023-04-05 18:01 ` Vladimir Oltean
2023-04-06 0:00 ` Jakub Kicinski [this message]
2023-04-06 6:21 ` Max Georgiev
2023-04-06 15:01 ` Vladimir Oltean
2023-04-06 16:18 ` Max Georgiev
2023-04-06 16:50 ` Vladimir Oltean
2023-04-08 13:56 ` 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=20230405170010.1c989a8f@kernel.org \
--to=kuba@kernel.org \
--cc=gerhard@engleder-embedded.com \
--cc=glipus@gmail.com \
--cc=kory.maincent@bootlin.com \
--cc=maxime.chevallier@bootlin.com \
--cc=netdev@vger.kernel.org \
--cc=richardcochran@gmail.com \
--cc=vadim.fedorenko@linux.dev \
--cc=vladimir.oltean@nxp.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).