From: 'Dominique MARTINET' <dominique.martinet@atmark-techno.com>
To: Jakub Kicinski <kuba@kernel.org>
Cc: David Laight <David.Laight@aculab.com>,
Oliver Neukum <oneukum@suse.com>,
"edumazet@google.com" <edumazet@google.com>,
"pabeni@redhat.com" <pabeni@redhat.com>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
Greg Thelen <gthelen@google.com>,
John Sperbeck <jsperbeck@google.com>,
"stable@vger.kernel.org" <stable@vger.kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Subject: Re: [PATCH net] net: usb: usbnet: fix name regression
Date: Tue, 3 Dec 2024 22:14:19 +0900 [thread overview]
Message-ID: <Z08EKwZ3DNb11x_B@atmark-techno.com> (raw)
In-Reply-To: <20241202182935.75e8850c@kernel.org>
Jakub Kicinski wrote on Mon, Dec 02, 2024 at 06:29:35PM -0800:
> > Half of the reason I sent the mail in the first place is I don't
> > understand what commit 8a7d12d674ac ("net: usb: usbnet: fix name
> > regression") actually fixes: the commit message desribes something about
> > mac address not being set before bind() but the code does not change
> > what address is looked at (net->dev_addr), just which bits of the
> > address is checked; and I don't see what which bytes are being looked at
> > changing has anything to do with the "fixed" commit bab8eb0dd4cb9 ("usbnet:
> > modern method to get random MAC")
>
> We moved where the random address is assigned, we used to assign random
> (local) addr at init, now we assign it after calling ->bind().
>
> Previously we checked "if local" as a shorthand for checking "if driver
> updated". This check should really have been "if addr == node_id".
Ok, so a zero address here means a driver didn't set it, because the
ex-"node_id" address was no longer set at this point, and these would
fail the 0x2 check that worked previously...
The third time's a charm, the ordering part of the message just clicked
for me, thank you for putting up with me.
> > As far as I understand, !is_local_ether_addr (mac[0] & 0x2) implies
> > !is_zero_ether_addr (all bits of mac or'd), so that'd get us back to
> > exactly the old check.
>
> Let the compiler discover that, this is control path code, so write
> it for the human reader... The condition we want is "driver did not
> initialize the MAC address, or it initialized it to a local MAC
> address".
(I was reading that '&& !' wrong here, having the check negated in the
helper is much more clear and it's required to keep the two anyway...)
> > Or if we go with the local address version, something like the
> > following?
> [...]
>
> Up to you if you want to send this.
Thank you; after thinking it through today I think it won't hurt further
to send so I did.
Almost everyone involved is in Cc, but for follow-up it is here:
https://lore.kernel.org/r/20241203130457.904325-1-asmadeus@codewreck.org
Thanks,
--
Dominique
next prev parent reply other threads:[~2024-12-03 13:14 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-17 7:18 [PATCH net] net: usb: usbnet: fix name regression Oliver Neukum
2024-10-17 16:11 ` Simon Horman
2024-10-22 11:23 ` Paolo Abeni
2024-10-22 11:30 ` patchwork-bot+netdevbpf
2024-12-02 3:50 ` Dominique MARTINET
2024-12-02 6:29 ` Greg Kroah-Hartman
2024-12-02 8:24 ` Dominique MARTINET
2024-12-02 8:17 ` David Laight
2024-12-02 8:36 ` 'Dominique MARTINET'
2024-12-02 14:56 ` Jakub Kicinski
2024-12-02 23:39 ` 'Dominique MARTINET'
2024-12-03 0:26 ` Jakub Kicinski
2024-12-03 1:18 ` 'Dominique MARTINET'
2024-12-03 2:29 ` Jakub Kicinski
2024-12-03 13:14 ` 'Dominique MARTINET' [this message]
2024-12-02 14:26 ` Sasha Levin
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=Z08EKwZ3DNb11x_B@atmark-techno.com \
--to=dominique.martinet@atmark-techno.com \
--cc=David.Laight@aculab.com \
--cc=edumazet@google.com \
--cc=gregkh@linuxfoundation.org \
--cc=gthelen@google.com \
--cc=jsperbeck@google.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=oneukum@suse.com \
--cc=pabeni@redhat.com \
--cc=stable@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.