Re: [PATCH wpan-next 04/11] mac802154: Handle associating
From: Simon Horman <hidden>
Date: 2023-06-02 15:54:52
On Thu, Jun 01, 2023 at 05:48:10PM +0200, Miquel Raynal wrote:
Joining a PAN officially goes by associating with a coordinator. This coordinator may have been discovered thanks to the beacons it sent in the past. Add support to the MAC layer for these associations, which require: - Sending an association request - Receiving an association response The association response contains the association status, eventually a reason if the association was unsuccessful, and finally a short address that we should use for intra-PAN communication from now on, if we required one (which is the default, and not yet configurable). Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
...
quoted hunk ↗ jump to hunk
diff --git a/net/ieee802154/core.c b/net/ieee802154/core.c index cd69bdbfd59f..8bf01bb7e858 100644 --- a/net/ieee802154/core.c +++ b/net/ieee802154/core.c@@ -198,6 +198,18 @@ void wpan_phy_free(struct wpan_phy *phy) } EXPORT_SYMBOL(wpan_phy_free); +static void cfg802154_free_peer_structures(struct wpan_dev *wpan_dev) +{ + mutex_lock(&wpan_dev->association_lock); + + if (wpan_dev->parent) + kfree(wpan_dev->parent);
Hi Miquel, a minor nit from my side: There no need to check for NULL before calling kfree, because kfree will do nothing with a NULL argument.
+
+ wpan_dev->association_generation++;
+
+ mutex_unlock(&wpan_dev->association_lock);
+}
+
int cfg802154_switch_netns(struct cfg802154_registered_device *rdev,
struct net *net)
{...