Re: [PATCH v2 2/4] net: qrtr: Assign unique node id for MHI endpoints
From: Youssef Samir
Date: Wed Sep 23 2026 - 11:59:46 EST
On Tue, Sep 22, 2026 at 6:24 PM Juha-Matti Tilli
<juha-matti.tilli@xxxxxx> wrote:
>
> On Tue, Sep 22, 2026, at 20:14, Youssef Samir wrote:
> > On 9/21/2026 12:23 PM, Manivannan Sadhasivam via B4 Relay wrote:
> > > +
> > > +/* The offset is chosen carefully to not collide with the node ids allocated by
> > > + * the remote nodes. All the remote nodes use node ids in range 0 to 0xffff.
> > This assumption does not hold up for QRTR V1 headers where the node ids are 32bit.
> > QAIC devices use BHI_SERIALNUM as the node ID, and it is definitely larger than
> > 0xFFFF.> + */
>
> Does that mean we have to go back to my endpoint id patchset? It's an
> option, but a quite complex one.
I'm not sure. Last time I tested the endpoint ID series was its v5 and it was
functionally acceptable, and other than switching to sendmsg(2) instead of
send(2) and sendto(2), it did not require much changing on the user-space
side. But as you mentioned, it was/is complex compared to this one.
>
> However, what is the likelihood that serial number would clash with
> these host node id values? Maybe just adjusting the comment could be
> acceptable.
The chance of collision is slim, but still not impossible.
I think a solution would be to treat qrtr_host_node_id(idx) as the
preferred id, not
the one that will actually be assigned to the node. And before
assigning the nid,
we check it against the radix tree, and if it exists, we try to probe
the next available
id (so an IDA). This will also require exposing the nid to the user in
sysfs (i.e. /sys/bus/mhi/devices/mhix/mhix_IPCR/nid).
Thanks,
Youssef