Re: [revert 0d60d8df6f49] [net/net-next] [6.8-rc5] Build Failure

From: Eric Dumazet
Date: Thu Feb 29 2024 - 10:03:12 EST


On Thu, Feb 29, 2024 at 3:53 PM Eric Dumazet <edumazet@xxxxxxxxxx> wrote:
>
> On Thu, Feb 29, 2024 at 3:47 PM Jakub Kicinski <kuba@xxxxxxxxxx> wrote:
> >
> > On Thu, 29 Feb 2024 09:55:22 +0100 Eric Dumazet wrote:
> > > I do not see other solution than this, otherwise we have to add more
> > > pollution to include/linux/netdevice.h
> >
> > Right :(
> >
> > > diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
> > > index a9c973b92294bb110cf3cd336485972127b01b58..40797ea80bc6273cae6b7773d0a3e47459a72150
> > > 100644
> > > --- a/include/linux/netdevice.h
> > > +++ b/include/linux/netdevice.h
> > > @@ -2469,7 +2469,7 @@ struct net_device {
> > > struct devlink_port *devlink_port;
> > >
> > > #if IS_ENABLED(CONFIG_DPLL)
> > > - struct dpll_pin __rcu *dpll_pin;
> > > + void __rcu *dpll_pin;
> > > #endif
> >
> > If DPLL wants to hide its type definitions the helpers must live
> > in dpll? IOW move netdev_dpll_pin() to drivers/dpll/dpll_core.c
>
> Oh for some reason I thought this stuff was a module.
>
> Otherwise, why having dpll 'core' helpers in net/core/dev.c

So, we would have something a bit convoluted like :

diff --git a/drivers/dpll/dpll_core.c b/drivers/dpll/dpll_core.c
index 4c2bb27c99fe4e517b0d92c4ae3db83a679c7d11..241db366b2c74ae749f49612d86176b2f8f479c1
100644
--- a/drivers/dpll/dpll_core.c
+++ b/drivers/dpll/dpll_core.c
@@ -42,6 +42,11 @@ struct dpll_pin_registration {
void *priv;
};

+struct dpll_pin *netdev_dpll_pin(const struct net_device *dev)
+{
+ return rcu_dereference_rtnl(dev->dpll_pin);
+}
+
struct dpll_device *dpll_device_get_by_id(int id)
{
if (xa_get_mark(&dpll_device_xa, id, DPLL_REGISTERED))
diff --git a/include/linux/dpll.h b/include/linux/dpll.h
index 4ec2fe9caf5a3f284afd0cfe4fc7c2bf42cbbc60..c60591308ae80fb99aa5abb5832b9a228473a916
100644
--- a/include/linux/dpll.h
+++ b/include/linux/dpll.h
@@ -169,13 +169,13 @@ int dpll_device_change_ntf(struct dpll_device *dpll);

int dpll_pin_change_ntf(struct dpll_pin *pin);

+#if !IS_ENABLED(CONFIG_DPLL)
static inline struct dpll_pin *netdev_dpll_pin(const struct net_device *dev)
{
-#if IS_ENABLED(CONFIG_DPLL)
- return rcu_dereference_rtnl(dev->dpll_pin);
-#else
return NULL;
-#endif
}
+#else
+struct dpll_pin *netdev_dpll_pin(const struct net_device *dev);
+#endif

#endif