From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Alexander Aring <aahringo@redhat.com>
Cc: Alexander Aring <alex.aring@gmail.com>,
Stefan Schmidt <stefan@datenfreihafen.org>,
linux-wpan@vger.kernel.org,
"David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Eric Dumazet <edumazet@google.com>,
netdev@vger.kernel.org, David Girault <david.girault@qorvo.com>,
Romuald Despres <romuald.despres@qorvo.com>,
Frederic Blain <frederic.blain@qorvo.com>,
Nicolas Schodet <nico@ni.fr.eu.org>,
Guilhem Imberton <guilhem.imberton@qorvo.com>,
Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Subject: Re: [PATCH wpan-next 07/11] mac802154: Handle association requests from peers
Date: Fri, 1 Sep 2023 18:25:28 +0200 [thread overview]
Message-ID: <20230901182528.7c35f71e@xps-13> (raw)
In-Reply-To: <20230901174537.50f88d60@xps-13>
miquel.raynal@bootlin.com wrote on Fri, 1 Sep 2023 17:45:37 +0200:
> Hi Alexander,
>
> > > > --- a/net/ieee802154/pan.c
> > > > +++ b/net/ieee802154/pan.c
> > > > @@ -66,3 +66,30 @@ cfg802154_device_is_child(struct wpan_dev *wpan_dev,
> > > > return NULL;
> > > > }
> > > > EXPORT_SYMBOL_GPL(cfg802154_device_is_child);
> > > > +
> > > > +__le16 cfg802154_get_free_short_addr(struct wpan_dev *wpan_dev)
> > > > +{
> > > > + struct ieee802154_pan_device *child;
> > > > + __le16 addr;
> > > > +
> > > > + lockdep_assert_held(&wpan_dev->association_lock);
> > > > +
> > > > + do {
> > > > + get_random_bytes(&addr, 2);
> > >
> > > This is combined with the max associations setting? I am not sure if
> > > this is the best way to get free values from a u16 value where we have
> > > some data structure of "given" addresses to a node. I recently was
> > > looking into idr/xarray data structure... maybe we can use something
> > > from there.
> >
> > I actually thought about using an increasing index, but the pseudo
> > random generator seemed appropriate because of its "unpredictability",
> > but there is not real use for that (besides maybe testing purposes). I
> > can definitely switch to another solution.
>
> I looked into this deeper. I didn't felt like idr would be so much
> useful, but I started converting the code to use ida instead (so the
> simplest approach, with no associated pointer). There are actually two
> use cases which clearly match better the random address mechanism.
>
> a/ One can freely decide the short address of the coordinator (it is
> freely selectable by the user) but ida has no mechanism to handle this
> with an API which would prevent such "number to be used".
>
> In practice, this could be workarounded "easily", even though the
> implementation would be dirty IMHO: getting an IDA, if it matches ours,
> just try again without freeing it. TBH I don't like much this idea.
>
> b/ In case we ever want to support master handover, the ida solution
> does not work well...
c/ Technically speaking, leaf devices can connect to a PAN coordinator
which is not the top-level coordinator in case it is out of reach.
So the coordinator receiving the association request needs to allocate
a random address for this leaf device, without knowing all the
addresses the top-level coordinator already allocated. In case the
devices move or a coordinator detects two different devices within the
same PAN with the same short addres, it must trigger a realignment
procedure (not implemented yet). Therefore, following a linear scheme
when allocating children short addresses sounds like an endless source
of conflicts and realignments, whereas random addressing would prevent
most of these situations on regular sized networks?
> For now I've kept the current approach (actually adding a missing
> check), but if you know how to solve that I can either update the
> implementation or make a followup patch, especially since the current
> approach is not bounded (in the theoretical case where we have 65k
> devices in the same PAN).
>
> I believe the allocation strategies are not set in stone anyway and can
> easily evolve.
>
> Thanks,
> Miquèl
next prev parent reply other threads:[~2023-09-01 16:25 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-01 15:48 [PATCH wpan-next 00/11] ieee802154: Associations between devices Miquel Raynal
2023-06-01 15:48 ` [PATCH wpan-next 01/11] ieee802154: Let PAN IDs be reset Miquel Raynal
2023-06-01 15:48 ` [PATCH wpan-next 02/11] ieee802154: Internal PAN management Miquel Raynal
2023-06-01 15:48 ` [PATCH wpan-next 03/11] ieee802154: Add support for user association requests Miquel Raynal
2023-06-01 15:48 ` [PATCH wpan-next 04/11] mac802154: Handle associating Miquel Raynal
2023-06-02 15:54 ` Simon Horman
2023-08-18 14:17 ` Miquel Raynal
2023-06-03 10:09 ` Alexander Aring
2023-07-04 11:34 ` Alexander Aring
2023-09-01 15:01 ` Miquel Raynal
2023-09-01 15:31 ` Miquel Raynal
2023-06-01 15:48 ` [PATCH wpan-next 05/11] ieee802154: Add support for user disassociation requests Miquel Raynal
2023-06-01 15:48 ` [PATCH wpan-next 06/11] mac802154: Handle disassociations Miquel Raynal
2023-06-03 11:30 ` Alexander Aring
2023-08-21 9:02 ` Miquel Raynal
2023-06-01 15:48 ` [PATCH wpan-next 07/11] mac802154: Handle association requests from peers Miquel Raynal
2023-06-03 11:28 ` Alexander Aring
2023-08-21 8:52 ` Miquel Raynal
2023-09-01 15:45 ` Miquel Raynal
2023-09-01 16:25 ` Miquel Raynal [this message]
2023-06-01 15:48 ` [PATCH wpan-next 08/11] ieee802154: Add support for limiting the number of associated devices Miquel Raynal
2023-06-01 15:48 ` [PATCH wpan-next 09/11] mac802154: Follow " Miquel Raynal
2023-06-01 15:48 ` [PATCH wpan-next 10/11] mac802154: Handle disassociation notifications from peers Miquel Raynal
2023-06-01 15:48 ` [PATCH wpan-next 11/11] ieee802154: Give the user the association list Miquel Raynal
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=20230901182528.7c35f71e@xps-13 \
--to=miquel.raynal@bootlin.com \
--cc=aahringo@redhat.com \
--cc=alex.aring@gmail.com \
--cc=davem@davemloft.net \
--cc=david.girault@qorvo.com \
--cc=edumazet@google.com \
--cc=frederic.blain@qorvo.com \
--cc=guilhem.imberton@qorvo.com \
--cc=kuba@kernel.org \
--cc=linux-wpan@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=nico@ni.fr.eu.org \
--cc=pabeni@redhat.com \
--cc=romuald.despres@qorvo.com \
--cc=stefan@datenfreihafen.org \
--cc=thomas.petazzoni@bootlin.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 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.