Thread (24 messages) 24 messages, 3 authors, 2023-09-01

Re: [PATCH wpan-next 06/11] mac802154: Handle disassociations

From: Alexander Aring <aahringo@redhat.com>
Date: 2023-06-03 11:30:24

Hi,

On Thu, Jun 1, 2023 at 11:50 AM Miquel Raynal [off-list ref] wrote:
quoted hunk ↗ jump to hunk
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()?

- Alex
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help