]> Git Repo - linux.git/commitdiff
net: ieee802154: Handle limited devices with only datagram support
authorMiquel Raynal <[email protected]>
Fri, 24 Mar 2023 11:05:57 +0000 (12:05 +0100)
committerStefan Schmidt <[email protected]>
Fri, 24 Mar 2023 16:19:12 +0000 (17:19 +0100)
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 <[email protected]>
Acked-by: Alexander Aring <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Stefan Schmidt <[email protected]>
include/net/cfg802154.h
net/ieee802154/nl802154.c

index 0c2778a836db62bad3c881b0154285fe966f578a..e000579844892743711b8f6b9a7c2d1feb063b4c 100644 (file)
@@ -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 {
index a20ac4bb48a45c761c0898c968c1393b582a593c..cd688b51d97782224fd00c175fbfbe59e348a349 100644 (file)
@@ -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;
This page took 0.062391 seconds and 4 git commands to generate.