Commit 822452fb authored by Miquel Raynal's avatar Miquel Raynal Committed by Stefan Schmidt
Browse files

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: default avatarMiquel Raynal <miquel.raynal@bootlin.com>
Acked-by: default avatarAlexander Aring <aahringo@redhat.com>
Link: https://lore.kernel.org/r/20230324110558.90707-2-miquel.raynal@bootlin.com


Signed-off-by: default avatarStefan Schmidt <stefan@datenfreihafen.org>
parent d021d218
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -178,12 +178,15 @@ wpan_phy_cca_cmp(const struct wpan_phy_cca *a, const struct wpan_phy_cca *b)
 *	setting.
 * @WPAN_PHY_FLAG_STATE_QUEUE_STOPPED: Indicates that the transmit queue was
 *	temporarily stopped.
 * @WPAN_PHY_FLAG_DATAGRAMS_ONLY: Indicates that transceiver is only able to
 *	send/receive datagrams.
 */
enum wpan_phy_flags {
	WPAN_PHY_FLAG_TXPOWER		= BIT(1),
	WPAN_PHY_FLAG_CCA_ED_LEVEL	= BIT(2),
	WPAN_PHY_FLAG_CCA_MODE		= BIT(3),
	WPAN_PHY_FLAG_STATE_QUEUE_STOPPED = BIT(4),
	WPAN_PHY_FLAG_DATAGRAMS_ONLY	= BIT(5),
};

struct wpan_phy {
+10 −0
Original line number Diff line number Diff line
@@ -1417,6 +1417,11 @@ static int nl802154_trigger_scan(struct sk_buff *skb, struct genl_info *info)
		return -EINVAL;
	}

	if (wpan_phy->flags & WPAN_PHY_FLAG_DATAGRAMS_ONLY) {
		NL_SET_ERR_MSG(info->extack, "PHY only supports datagrams");
		return -EOPNOTSUPP;
	}

	request = kzalloc(sizeof(*request), GFP_KERNEL);
	if (!request)
		return -ENOMEM;
@@ -1584,6 +1589,11 @@ nl802154_send_beacons(struct sk_buff *skb, struct genl_info *info)
		return -EPERM;
	}

	if (wpan_phy->flags & WPAN_PHY_FLAG_DATAGRAMS_ONLY) {
		NL_SET_ERR_MSG(info->extack, "PHY only supports datagrams");
		return -EOPNOTSUPP;
	}

	request = kzalloc(sizeof(*request), GFP_KERNEL);
	if (!request)
		return -ENOMEM;