diff options
author | Miquel Raynal <miquel.raynal@bootlin.com> | 2023-09-27 20:12:05 +0200 |
---|---|---|
committer | Miquel Raynal <miquel.raynal@bootlin.com> | 2023-11-20 11:41:06 +0100 |
commit | 2e7ed75e92fc493ff5484f61aed6489262c78f3e (patch) | |
tree | 0b38fd6db5e22f1c4564550e18cc6b51c0a58e6f /include/net | |
parent | 5260adf86b6732c75136fc1b159bb370062ddfa8 (diff) | |
download | linux-2e7ed75e92fc493ff5484f61aed6489262c78f3e.tar.gz linux-2e7ed75e92fc493ff5484f61aed6489262c78f3e.tar.bz2 linux-2e7ed75e92fc493ff5484f61aed6489262c78f3e.zip |
ieee802154: Internal PAN management
Introduce structures to describe peer devices in a PAN as well as a few
related helpers. We basically care about:
- Our unique parent after associating with a coordinator.
- Peer devices, children, which successfully associated with us.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Acked-by: Stefan Schmidt <stefan@datenfreihafen.org>
Acked-by: Alexander Aring <aahringo@redhat.com>
Link: https://lore.kernel.org/linux-wpan/20230927181214.129346-3-miquel.raynal@bootlin.com
Diffstat (limited to 'include/net')
-rw-r--r-- | include/net/cfg802154.h | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/include/net/cfg802154.h b/include/net/cfg802154.h index f79ce133e51a..a89f1c9cea3f 100644 --- a/include/net/cfg802154.h +++ b/include/net/cfg802154.h @@ -304,6 +304,22 @@ struct ieee802154_coord_desc { }; /** + * struct ieee802154_pan_device - PAN device information + * @pan_id: the PAN ID of this device + * @mode: the preferred mode to reach the device + * @short_addr: the short address of this device + * @extended_addr: the extended address of this device + * @node: the list node + */ +struct ieee802154_pan_device { + __le16 pan_id; + u8 mode; + __le16 short_addr; + __le64 extended_addr; + struct list_head node; +}; + +/** * struct cfg802154_scan_request - Scan request * * @type: type of scan to be performed @@ -478,6 +494,11 @@ struct wpan_dev { /* fallback for acknowledgment bit setting */ bool ackreq; + + /* Associations */ + struct mutex association_lock; + struct ieee802154_pan_device *parent; + struct list_head children; }; #define to_phy(_dev) container_of(_dev, struct wpan_phy, dev) @@ -529,4 +550,30 @@ static inline const char *wpan_phy_name(struct wpan_phy *phy) void ieee802154_configure_durations(struct wpan_phy *phy, unsigned int page, unsigned int channel); +/** + * cfg802154_device_is_associated - Checks whether we are associated to any device + * @wpan_dev: the wpan device + * @return: true if we are associated + */ +bool cfg802154_device_is_associated(struct wpan_dev *wpan_dev); + +/** + * cfg802154_device_is_parent - Checks if a device is our coordinator + * @wpan_dev: the wpan device + * @target: the expected parent + * @return: true if @target is our coordinator + */ +bool cfg802154_device_is_parent(struct wpan_dev *wpan_dev, + struct ieee802154_addr *target); + +/** + * cfg802154_device_is_child - Checks whether a device is associated to us + * @wpan_dev: the wpan device + * @target: the expected child + * @return: the PAN device + */ +struct ieee802154_pan_device * +cfg802154_device_is_child(struct wpan_dev *wpan_dev, + struct ieee802154_addr *target); + #endif /* __NET_CFG802154_H */ |