Skip to content

Commit 822452f

Browse files
miquelraynalStefan-Schmidt
authored andcommitted
net: ieee802154: Handle limited devices with only datagram support
Some devices, like HardMAC ones can be a bit limited in the way they handle mac commands. In particular, they might just not support it at all and instead only be able to transmit and receive regular data packets. In this case, they cannot be used for any of the internal management commands that we have introduced so far and must be flagged accordingly. Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Acked-by: Alexander Aring <aahringo@redhat.com> Link: https://lore.kernel.org/r/20230324110558.90707-2-miquel.raynal@bootlin.com Signed-off-by: Stefan Schmidt <stefan@datenfreihafen.org>
1 parent d021d21 commit 822452f

2 files changed

Lines changed: 13 additions & 0 deletions

File tree

include/net/cfg802154.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,12 +178,15 @@ wpan_phy_cca_cmp(const struct wpan_phy_cca *a, const struct wpan_phy_cca *b)
178178
* setting.
179179
* @WPAN_PHY_FLAG_STATE_QUEUE_STOPPED: Indicates that the transmit queue was
180180
* temporarily stopped.
181+
* @WPAN_PHY_FLAG_DATAGRAMS_ONLY: Indicates that transceiver is only able to
182+
* send/receive datagrams.
181183
*/
182184
enum wpan_phy_flags {
183185
WPAN_PHY_FLAG_TXPOWER = BIT(1),
184186
WPAN_PHY_FLAG_CCA_ED_LEVEL = BIT(2),
185187
WPAN_PHY_FLAG_CCA_MODE = BIT(3),
186188
WPAN_PHY_FLAG_STATE_QUEUE_STOPPED = BIT(4),
189+
WPAN_PHY_FLAG_DATAGRAMS_ONLY = BIT(5),
187190
};
188191

189192
struct wpan_phy {

net/ieee802154/nl802154.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1417,6 +1417,11 @@ static int nl802154_trigger_scan(struct sk_buff *skb, struct genl_info *info)
14171417
return -EINVAL;
14181418
}
14191419

1420+
if (wpan_phy->flags & WPAN_PHY_FLAG_DATAGRAMS_ONLY) {
1421+
NL_SET_ERR_MSG(info->extack, "PHY only supports datagrams");
1422+
return -EOPNOTSUPP;
1423+
}
1424+
14201425
request = kzalloc(sizeof(*request), GFP_KERNEL);
14211426
if (!request)
14221427
return -ENOMEM;
@@ -1584,6 +1589,11 @@ nl802154_send_beacons(struct sk_buff *skb, struct genl_info *info)
15841589
return -EPERM;
15851590
}
15861591

1592+
if (wpan_phy->flags & WPAN_PHY_FLAG_DATAGRAMS_ONLY) {
1593+
NL_SET_ERR_MSG(info->extack, "PHY only supports datagrams");
1594+
return -EOPNOTSUPP;
1595+
}
1596+
15871597
request = kzalloc(sizeof(*request), GFP_KERNEL);
15881598
if (!request)
15891599
return -ENOMEM;

0 commit comments

Comments
 (0)