From: Uday Shankar <ushankar@purestorage.com>
To: Breno Leitao <leitao@debian.org>
Cc: "David S . Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Simon Horman <horms@kernel.org>,
netdev@vger.kernel.org
Subject: Re: [PATCH] netconsole: allow selection of egress interface via MAC address
Date: Wed, 8 Jan 2025 08:02:44 -0700 [thread overview]
Message-ID: <Z36TlACdNMwFD7wv@dev-ushankar.dev.purestorage.com> (raw)
In-Reply-To: <20250103-loutish-heavy-caracal-1dfb5d@leitao>
On Fri, Jan 03, 2025 at 03:41:17AM -0800, Breno Leitao wrote:
> > For these reasons, allow selection of the egress interface via MAC
> > address. To maintain parity between interfaces, the local_mac entry in
> > configfs is also made read-write and can be used to select the local
> > interface, though this use case is less interesting than the one
> > highlighted above.
>
> This will change slightly local_mac meaning. At the same time, I am not
> sure local_mac is a very useful field as-is. The configuration might be
> a bit confusing using `local_mac` to define the target interface. I am
> wondering if creating a new field might be more appropriate. Maybe
> `dev_mac`? (I am not super confident this approach is better TBH, but, it
> seems easier to reason about).
Do you mean creating a new field called dev_mac which replaces
local_mac? I do agree that naming is a bit better but I'd be worried
about breaking programs which expect local_mac to exist. Having the
field go read-only --> read-write via this change feels a lot less
disruptive to preexisting programs than renaming the field.
Or do you mean creating a new field dev_mac which will live alongside
local_mac, and letting local_mac keep its existing semantics? It feels
like that would lead to messier code, since dev_mac's semantics are kind
of a superset of local_mac's semantics (e.g. after selecting and
enabling a netconsole via dev_name, local_mac is populated with the mac
address of the interface and we'd probably want the same for dev_mac as
well).
A third option would be dropping the configfs changes altogether, which
I'd be okay with - as I highlighted in the commit message, I suspect
this interface is far less likely to see real use than the command-line
parameter. A downside of this option though is that automated testing
becomes difficult, as we can't write a variant of netcons_basic.sh
without configfs support. We'd have to have a test which uses the
parameter directly, and I'm not sure if we have a testing framework for
the kernel which would support that.
Let me know which option you think is best, and I'll move forward with
it in v2.
> > diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c
> > index 4ea44a2f48f7..865c43a97f70 100644
> > --- a/drivers/net/netconsole.c
> > +++ b/drivers/net/netconsole.c
>
> > @@ -211,6 +211,8 @@ static struct netconsole_target *alloc_and_init(void)
> > + /* the "don't use" or N/A value for this field */
>
> This comment is not very clear. What do you mean exactly?
I wanted to maintain the invariant that when setting up a netconsole, at
most one of dev_name and local_mac is set to a meaningful value, as
otherwise we'd need to implement and document some sort of priority
system when it comes to selecting the local interface. This invariant
requires having a designated "invalid" value for each field - it's the
empty string for dev_name and the broadcast mac for local_mac (for
backwards compatibility purposes, see below).
>
> > + eth_broadcast_addr(nt->np.local_mac);
>
> Why not just memzeroing the memory?
That could work, but we kind of had an unwritten rule that the broadcast
address was the invalid value for local_mac in the code before. For
example, when creating a brand new netconsole via configfs:
# cd /sys/kernel/config/netconsole/
# mkdir test
# cat test/local_mac
ff:ff:ff:ff:ff:ff
So I stuck with the broadcast mac address for the local_mac "invalid"
value.
ACK on the rest of the comments, I will address them in v2 once we have
clarity on the above issue.
next prev parent reply other threads:[~2025-01-08 15:02 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-11 2:18 [PATCH] netconsole: allow selection of egress interface via MAC address Uday Shankar
2024-12-12 10:11 ` Simon Horman
2024-12-12 22:31 ` Uday Shankar
2024-12-13 10:34 ` Simon Horman
2024-12-12 12:34 ` Paolo Abeni
2024-12-12 21:59 ` Uday Shankar
2025-01-03 11:41 ` Breno Leitao
2025-01-08 15:02 ` Uday Shankar [this message]
2025-01-09 15:43 ` Breno Leitao
2025-02-03 13:12 ` Breno Leitao
2025-02-03 20:29 ` Uday Shankar
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=Z36TlACdNMwFD7wv@dev-ushankar.dev.purestorage.com \
--to=ushankar@purestorage.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=leitao@debian.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.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).