mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jeremy Kerr <jk@codeconstruct.com.au>
To: Faizan Ali <faizana@nvidia.com>
Cc: Matt Johnston <matt@codeconstruct.com.au>,
	netdev@vger.kernel.org,  linux-kernel@vger.kernel.org,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Eric Dumazet <edumazet@google.com>,
	"David S . Miller"	 <davem@davemloft.net>,
	Simon Horman <horms@kernel.org>
Subject: Re: [PATCH net-next] net: mctp: add MCTP_OPT_ROUTE_SRCADDR getsockopt
Date: Fri, 25 Sep 2026 18:11:38 +0800	[thread overview]
Message-ID: <347e33249f14ca893a618868a61b4e8837bfba0d.camel@codeconstruct.com.au> (raw)
In-Reply-To: <20260923082726.2918670-1-faizana@nvidia.com>

Hi Faizan,

> > I'm not against the idea, we just need a fairly solidy justification
> > for adding user ABI that cannot be changed in future.
> 
> In theory, yes - any incoming message destined to an active local EID
> should reach an application bound to that message type. That said, I
> still find these problems with simply picking any local EID:
> 
> 1. It requires a snapshot of all available local EIDs first -
>    information the kernel already has internally via the routing
>    table, but which applications can today only get via ad-hoc mctp
>    route/addr correlation.

That's mostly equivalent what you're adding here - a facility to extract
a local address from the kernel. The mctp addr command just uses a
netlink interface to do so, rather than a sockopt.

The important difference here is the addition of the routing calculation
to filter that set of addresses to a single one.

> 2. Not every local EID is reachable from every peer, even on the same
>    network. Example from our hardware:
> 
>      BMC --USB(EID 8)--> SMA(EID 20) --I3C--> GPU(EID 30)
>      BMC also has a separate mctpi2c0 (EID 9), unrelated to the SMA.
> 
>    Reaching the GPU is a gateway route (30 -> via 20 -> via 8), which
>    mctp_route_lookup() already resolves correctly today for
>    sendmsg(). If PLDM instead picks "any" EID and gets 9, the GPU's
>    event notifications go out via I3C to the SMA - which has no
>    knowledge of EID 9 at all (it's on an unrelated bus). The packet is
>    undeliverable at the SMA itself, one hop before it would even reach
>    the BMC.

Is there any reason why the SMA can route to EID 8 but not 9?

>    I acknowledge this is implementation-specific, and additional
>    route provisioning on the bridge could help - but that still
>    requires out-of-band configuration to stay in sync with every
>    local EID. Separately, how device firmware handles Set Event
>    Receiver packets carrying an EID different from the one it saw
>    during Set Endpoint ID discovery is also implementation-defined.

If there was any expected correlation between the Set Event Receiver and
the sender of Set Endpoint ID messages, we wouldn't need the concept of
Set Event Receiver at all.

I wouldn't think that there would be any requirement for the
current-level bus-owner to be the event receiver; it's valid for the
events to be going to any other MCTP endpoint.

> 3. A picked EID doesn't stay valid - interface teardown (hot unplug)
>    removes its local EID from the available routes, and Set Event
>    Receiver is a one-shot registration with no way to detect that
>    drift later. Further events would then be silently dropped by the
>    kernel, since it has no route for the removed EID, and would never
>    reach the application.

You have the same issues with this - the source EID returned by your
sockopt may become stale too. In fact, if we're interested in solving
that issue, the way to detect that would be to listen for local address
add/remove events, which would require netlink, so we may as well use
the existing netlink interface for the original query too.

The most compelling point here is (2) - if there are particular routing
requirements that would require a specific EID for Set Event Receiver.
But the only datapoint we have for that is that there is a device that -
for some reason - is making one specific assumption about the routing
topology. Can you expand on that maybe?

The other approach may be to implement something like IP_PKTINFO, where
we would have visibility on the local EID for a *received* message.
There is a bit more precedence for that design, but it may introduce an
unnecessary send/receive operation before the EID can be determined (but
it's likely we're doing initial PLDM messaging to the event source
anyway...).

Cheers,


Jeremy

  reply	other threads:[~2026-09-25 10:11 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-21  3:51 Faizan Ali
2026-09-22  1:23 ` Jeremy Kerr
2026-09-23  8:27   ` Faizan Ali
2026-09-25 10:11     ` Jeremy Kerr [this message]
2026-09-23 18:52 ` netdev-bot+sashiko

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=347e33249f14ca893a618868a61b4e8837bfba0d.camel@codeconstruct.com.au \
    --to=jk@codeconstruct.com.au \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=faizana@nvidia.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matt@codeconstruct.com.au \
    --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

all inboxes | Powered by JetHome®