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 06/11] mac802154: Handle disassociations
Date: Mon, 21 Aug 2023 11:02:56 +0200 [thread overview]
Message-ID: <20230821110256.2e658d62@xps-13> (raw)
In-Reply-To: <CAK-6q+hWR9cLt2+nbGY9KbtwLSJkN+NF+Q651aPDLCaO1mk1=Q@mail.gmail.com>
Hi Alexander,
aahringo@redhat.com wrote on Sat, 3 Jun 2023 07:30:05 -0400:
> Hi,
>
> On Thu, Jun 1, 2023 at 11:50 AM Miquel Raynal <miquel.raynal@bootlin.com> wrote:
> >
> > Devices may decide to disassociate from their coordinator for different
> > reasons (device turning off, coordinator signal strength too low, etc),
> > the MAC layer just has to send a disassociation notification.
> >
> > If the ack of the disassociation notification is not received, the
> > device may consider itself disassociated anyway.
> >
> > Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
> > ---
> > net/ieee802154/pan.c | 2 +
> > net/mac802154/cfg.c | 102 +++++++++++++++++++++++++++++++++++
> > net/mac802154/ieee802154_i.h | 4 ++
> > net/mac802154/scan.c | 60 +++++++++++++++++++++
> > 4 files changed, 168 insertions(+)
> >
> > diff --git a/net/ieee802154/pan.c b/net/ieee802154/pan.c
> > index e2a12a42ba2b..477e8dad0cf0 100644
> > --- a/net/ieee802154/pan.c
> > +++ b/net/ieee802154/pan.c
> > @@ -49,6 +49,7 @@ bool cfg802154_device_is_parent(struct wpan_dev *wpan_dev,
> >
> > return false;
> > }
> > +EXPORT_SYMBOL_GPL(cfg802154_device_is_parent);
> >
> > struct ieee802154_pan_device *
> > cfg802154_device_is_child(struct wpan_dev *wpan_dev,
> > @@ -64,3 +65,4 @@ cfg802154_device_is_child(struct wpan_dev *wpan_dev,
> >
> > return NULL;
> > }
> > +EXPORT_SYMBOL_GPL(cfg802154_device_is_child);
> > diff --git a/net/mac802154/cfg.c b/net/mac802154/cfg.c
> > index 89112d2bcee7..c27c05e825ff 100644
> > --- a/net/mac802154/cfg.c
> > +++ b/net/mac802154/cfg.c
> > @@ -386,6 +386,107 @@ static int mac802154_associate(struct wpan_phy *wpan_phy,
> > return ret;
> > }
> >
> > +static int mac802154_disassociate_from_parent(struct wpan_phy *wpan_phy,
> > + struct wpan_dev *wpan_dev)
> > +{
> > + struct ieee802154_local *local = wpan_phy_priv(wpan_phy);
> > + struct ieee802154_pan_device *child, *tmp;
> > + struct ieee802154_sub_if_data *sdata;
> > + u64 eaddr;
> > + int ret;
> > +
> > + sdata = IEEE802154_WPAN_DEV_TO_SUB_IF(wpan_dev);
> > +
> > + /* Start by disassociating all the children and preventing new ones to
> > + * attempt associations.
> > + */
> > + list_for_each_entry_safe(child, tmp, &wpan_dev->children, node) {
> > + ret = mac802154_send_disassociation_notif(sdata, child,
> > + IEEE802154_COORD_WISHES_DEVICE_TO_LEAVE);
> > + if (ret) {
> > + eaddr = swab64((__force u64)child->extended_addr);
>
> Does this pass sparse? I think this needs to be le64_to_cpu()?
I never feel comfortable with sparse given the dozens (hundreds) of
lines it outputs, but I think yes, parse does not seem to complain. To
be honest I think we should keep it this way just because I copy-pasted
it from other locations in the core:
$ git grep -c "swab64((__force u64)" -- net/ieee802154/ net/mac802154/
net/ieee802154/nl-mac.c:1
net/mac802154/cfg.c:4
net/mac802154/llsec.c:1
net/mac802154/rx.c:2
net/mac802154/scan.c:6
So if we ever want to change that, we could easily find them all and
replace them all in one go?
Thanks,
Miquèl
next prev parent reply other threads:[~2023-08-21 9:03 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 [this message]
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
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=20230821110256.2e658d62@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox