From: Lee Jones <lee@kernel.org>
To: Tobias Junghans <tobias.junghans@inhub.de>
Cc: Andrew Lunn <andrew@lunn.ch>,
linux-leds@vger.kernel.org, netdev@vger.kernel.org
Subject: Re: [PATCH v2] leds: trigger: netdev: refactor dev matching in netdev_trig_notify()
Date: Thu, 24 Apr 2025 09:09:27 +0100 [thread overview]
Message-ID: <20250424080927.GC8734@google.com> (raw)
In-Reply-To: <20250423131325.235098-1-tobias.junghans@inhub.de>
On Wed, 23 Apr 2025, Tobias Junghans wrote:
> If there are network devices with the same name in different
> namespaces, ledtrig-netdev gets confused easily and switches between
> these devices whenever there are NETDEV_CHANGENAME/NETDEV_REGISTER
> notifications. This happens since ledtrig-netdev only checks for
> device name equality regardless of previous associations with another
> network device with the same name.
>
> Real world example: eth0 is the primary physical network interface and
> ledltrig-netdev is associated with that interface. If now Docker creates
> a virtual Ethernet interface (vethXXXX), moves it to the
> container's net namespace and renames it to eth0, ledtrig-netdev
> switches to this device and the LED no longer blinks for the original
> (physical) network device.
>
> Fix this by refactoring the conditions under which to return early with
> NOTIFY_DONE inside netdev_trig_notify():
>
> - For processing NETDEV_REGISTER events, the device name has to match
> and no association with a net_dev must exist.
>
> - For processing NETDEV_CHANGENAME events, the associated and notified
> network device have to match. Alternatively the device name has to
> match and no association with a net_dev must exist.
>
> - For all other events, the associated and notified network device have
> to match.
>
> Signed-off-by: Tobias Junghans <tobias.junghans@inhub.de>
> ---
> drivers/leds/trigger/ledtrig-netdev.c | 29 +++++++++++++++++++--------
> 1 file changed, 21 insertions(+), 8 deletions(-)
Please send subsequent versions independently, rather than attached to
the end of lengthy (or any for that matter) mail threads. This gets
confusing, fast!
Also, this is v3.
Please resubmit.
--
Lee Jones [李琼斯]
prev parent reply other threads:[~2025-04-24 8:09 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-01 8:49 [PATCH] leds: trigger: netdev: Match net in netdev_trig_notify() Tobias Junghans
2025-04-04 15:10 ` Lee Jones
2025-04-07 9:02 ` [PATCH v2] " Tobias Junghans
2025-04-10 10:17 ` Lee Jones
2025-04-10 20:39 ` Andrew Lunn
2025-04-11 7:44 ` Lee Jones
2025-04-23 13:13 ` [PATCH v2] leds: trigger: netdev: refactor dev matching " Tobias Junghans
2025-04-24 8:09 ` Lee Jones [this message]
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=20250424080927.GC8734@google.com \
--to=lee@kernel.org \
--cc=andrew@lunn.ch \
--cc=linux-leds@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=tobias.junghans@inhub.de \
/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).