Netdev Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] wwan: core: Fix missing RTM_NEWLINK event
@ 2021-07-22 15:49 Loic Poulain
2021-07-22 16:14 ` Sergey Ryazanov
0 siblings, 1 reply; 5+ messages in thread
From: Loic Poulain @ 2021-07-22 15:49 UTC (permalink / raw)
To: davem, johannes, ryazanov.s.a; +Cc: netdev, Loic Poulain, stable
By default there is no rtnetlink event generated when registering a
netdev with rtnl_link_ops until its rtnl_link_state is switched to
initialized (RTNL_LINK_INITIALIZED). This causes issues with user
tools like NetworkManager which relies on such event to manage links.
Fix that by setting link to initialized (via rtnl_configure_link).
Cc: stable@vger.kernel.org
Fixes: 88b710532e53 ("wwan: add interface creation support")
Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
---
drivers/net/wwan/wwan_core.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/net/wwan/wwan_core.c b/drivers/net/wwan/wwan_core.c
index 3e16c31..409caf4 100644
--- a/drivers/net/wwan/wwan_core.c
+++ b/drivers/net/wwan/wwan_core.c
@@ -866,6 +866,10 @@ static int wwan_rtnl_newlink(struct net *src_net, struct net_device *dev,
else
ret = register_netdevice(dev);
+ /* Link initialized, notify new link */
+ if (!ret)
+ rtnl_configure_link(dev, NULL);
+
out:
/* release the reference */
put_device(&wwandev->dev);
--
2.7.4
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] wwan: core: Fix missing RTM_NEWLINK event
2021-07-22 15:49 [PATCH] wwan: core: Fix missing RTM_NEWLINK event Loic Poulain
@ 2021-07-22 16:14 ` Sergey Ryazanov
2021-07-22 16:54 ` Loic Poulain
0 siblings, 1 reply; 5+ messages in thread
From: Sergey Ryazanov @ 2021-07-22 16:14 UTC (permalink / raw)
To: Loic Poulain; +Cc: David Miller, Johannes Berg, netdev, stable
Hello Loic,
On Thu, Jul 22, 2021 at 6:39 PM Loic Poulain <loic.poulain@linaro.org> wrote:
> By default there is no rtnetlink event generated when registering a
> netdev with rtnl_link_ops until its rtnl_link_state is switched to
> initialized (RTNL_LINK_INITIALIZED). This causes issues with user
> tools like NetworkManager which relies on such event to manage links.
>
> Fix that by setting link to initialized (via rtnl_configure_link).
Shouldn't the __rtnl_newlink() function call rtnl_configure_link()
just after the newlink() callback invocation? Or I missed something?
--
Sergey
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] wwan: core: Fix missing RTM_NEWLINK event
2021-07-22 16:14 ` Sergey Ryazanov
@ 2021-07-22 16:54 ` Loic Poulain
2021-07-22 17:42 ` Sergey Ryazanov
0 siblings, 1 reply; 5+ messages in thread
From: Loic Poulain @ 2021-07-22 16:54 UTC (permalink / raw)
To: Sergey Ryazanov; +Cc: David Miller, Johannes Berg, Network Development, stable
On Thu, 22 Jul 2021 at 18:14, Sergey Ryazanov <ryazanov.s.a@gmail.com> wrote:
>
> Hello Loic,
>
> On Thu, Jul 22, 2021 at 6:39 PM Loic Poulain <loic.poulain@linaro.org> wrote:
> > By default there is no rtnetlink event generated when registering a
> > netdev with rtnl_link_ops until its rtnl_link_state is switched to
> > initialized (RTNL_LINK_INITIALIZED). This causes issues with user
> > tools like NetworkManager which relies on such event to manage links.
> >
> > Fix that by setting link to initialized (via rtnl_configure_link).
>
> Shouldn't the __rtnl_newlink() function call rtnl_configure_link()
> just after the newlink() callback invocation? Or I missed something?
Ah right, but the first call of rtnl_configure_link() (uninitialized)
does not cause RTM_NEWLINK event (cf __dev_notify_flags). It however
seems to work for other link types (e,g, rmnet), so probably something
to clarify here.
Regards,
Loic
>
> --
> Sergey
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] wwan: core: Fix missing RTM_NEWLINK event
2021-07-22 16:54 ` Loic Poulain
@ 2021-07-22 17:42 ` Sergey Ryazanov
2021-07-22 18:01 ` Loic Poulain
0 siblings, 1 reply; 5+ messages in thread
From: Sergey Ryazanov @ 2021-07-22 17:42 UTC (permalink / raw)
To: Loic Poulain; +Cc: David Miller, Johannes Berg, Network Development, stable
On Thu, Jul 22, 2021 at 7:44 PM Loic Poulain <loic.poulain@linaro.org> wrote:
> On Thu, 22 Jul 2021 at 18:14, Sergey Ryazanov <ryazanov.s.a@gmail.com> wrote:
>> On Thu, Jul 22, 2021 at 6:39 PM Loic Poulain <loic.poulain@linaro.org> wrote:
>>> By default there is no rtnetlink event generated when registering a
>>> netdev with rtnl_link_ops until its rtnl_link_state is switched to
>>> initialized (RTNL_LINK_INITIALIZED). This causes issues with user
>>> tools like NetworkManager which relies on such event to manage links.
>>>
>>> Fix that by setting link to initialized (via rtnl_configure_link).
>>
>> Shouldn't the __rtnl_newlink() function call rtnl_configure_link()
>> just after the newlink() callback invocation? Or I missed something?
>
> Ah right, but the first call of rtnl_configure_link() (uninitialized)
> does not cause RTM_NEWLINK event (cf __dev_notify_flags). It however
> seems to work for other link types (e,g, rmnet), so probably something
> to clarify here.
Just check additional netdev creation with hwsim:
# ip link add wwan0.3 parentdev wwan0 type wwan linkid 3
On the other console:
# ip -d mon
6: wwan0.3: <POINTOPOINT,NOARP> mtu 1500 qdisc noop state DOWN group default
link/none promiscuity 0 minmtu 68 maxmtu 65535
wwan numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535
But I saw no notification at the moment of wwan_hwsim module loading.
This happens since I missed the rtnl_configure_link() call in the
wwan_create_default_link() after the default link successful creation
:(
So we need your fix at least in the default link creation routine to
fix ca374290aaad ("wwan: core: support default netdev creation").
Something like this:
diff --git a/drivers/net/wwan/wwan_core.c b/drivers/net/wwan/wwan_core.c
index 3e16c318e705..374aa2cc884c 100644
--- a/drivers/net/wwan/wwan_core.c
+++ b/drivers/net/wwan/wwan_core.c
@@ -984,6 +984,8 @@ static void wwan_create_default_link(struct
wwan_device *wwandev,
goto unlock;
}
+ rtnl_configure_link(dev, NULL); /* trigger the RTM_NEWLINK event */
+
unlock:
rtnl_unlock();
--
Sergey
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] wwan: core: Fix missing RTM_NEWLINK event
2021-07-22 17:42 ` Sergey Ryazanov
@ 2021-07-22 18:01 ` Loic Poulain
0 siblings, 0 replies; 5+ messages in thread
From: Loic Poulain @ 2021-07-22 18:01 UTC (permalink / raw)
To: Sergey Ryazanov; +Cc: David Miller, Johannes Berg, Network Development, stable
On Thu, 22 Jul 2021 at 19:42, Sergey Ryazanov <ryazanov.s.a@gmail.com> wrote:
>
> On Thu, Jul 22, 2021 at 7:44 PM Loic Poulain <loic.poulain@linaro.org> wrote:
> > On Thu, 22 Jul 2021 at 18:14, Sergey Ryazanov <ryazanov.s.a@gmail.com> wrote:
> >> On Thu, Jul 22, 2021 at 6:39 PM Loic Poulain <loic.poulain@linaro.org> wrote:
> >>> By default there is no rtnetlink event generated when registering a
> >>> netdev with rtnl_link_ops until its rtnl_link_state is switched to
> >>> initialized (RTNL_LINK_INITIALIZED). This causes issues with user
> >>> tools like NetworkManager which relies on such event to manage links.
> >>>
> >>> Fix that by setting link to initialized (via rtnl_configure_link).
> >>
> >> Shouldn't the __rtnl_newlink() function call rtnl_configure_link()
> >> just after the newlink() callback invocation? Or I missed something?
> >
> > Ah right, but the first call of rtnl_configure_link() (uninitialized)
> > does not cause RTM_NEWLINK event (cf __dev_notify_flags). It however
> > seems to work for other link types (e,g, rmnet), so probably something
> > to clarify here.
>
> Just check additional netdev creation with hwsim:
>
> # ip link add wwan0.3 parentdev wwan0 type wwan linkid 3
>
> On the other console:
>
> # ip -d mon
> 6: wwan0.3: <POINTOPOINT,NOARP> mtu 1500 qdisc noop state DOWN group default
> link/none promiscuity 0 minmtu 68 maxmtu 65535
> wwan numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535
>
> But I saw no notification at the moment of wwan_hwsim module loading.
> This happens since I missed the rtnl_configure_link() call in the
> wwan_create_default_link() after the default link successful creation
> :(
Yep just realized that!
> So we need your fix at least in the default link creation routine to
> fix ca374290aaad ("wwan: core: support default netdev creation").
> Something like this:
>
> diff --git a/drivers/net/wwan/wwan_core.c b/drivers/net/wwan/wwan_core.c
> index 3e16c318e705..374aa2cc884c 100644
> --- a/drivers/net/wwan/wwan_core.c
> +++ b/drivers/net/wwan/wwan_core.c
> @@ -984,6 +984,8 @@ static void wwan_create_default_link(struct
> wwan_device *wwandev,
> goto unlock;
> }
>
> + rtnl_configure_link(dev, NULL); /* trigger the RTM_NEWLINK event */
> +
Testing right now.
Loic
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-07-22 17:51 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-22 15:49 [PATCH] wwan: core: Fix missing RTM_NEWLINK event Loic Poulain
2021-07-22 16:14 ` Sergey Ryazanov
2021-07-22 16:54 ` Loic Poulain
2021-07-22 17:42 ` Sergey Ryazanov
2021-07-22 18:01 ` Loic Poulain
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).