nl802154.c (5260adf86b6732c75136fc1b159bb370062ddfa8) | nl802154.c (05db59a0619969a47ab87050985344177c662cab) |
---|---|
1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * 4 * Authors: 5 * Alexander Aring <aar@pengutronix.de> 6 * 7 * Based on: net/wireless/nl80211.c 8 */ --- 1614 unchanged lines hidden (view full) --- 1623 struct cfg802154_registered_device *rdev = info->user_ptr[0]; 1624 struct net_device *dev = info->user_ptr[1]; 1625 struct wpan_dev *wpan_dev = dev->ieee802154_ptr; 1626 1627 /* Resources are released in the notification helper above */ 1628 return rdev_stop_beacons(rdev, wpan_dev); 1629} 1630 | 1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * 4 * Authors: 5 * Alexander Aring <aar@pengutronix.de> 6 * 7 * Based on: net/wireless/nl80211.c 8 */ --- 1614 unchanged lines hidden (view full) --- 1623 struct cfg802154_registered_device *rdev = info->user_ptr[0]; 1624 struct net_device *dev = info->user_ptr[1]; 1625 struct wpan_dev *wpan_dev = dev->ieee802154_ptr; 1626 1627 /* Resources are released in the notification helper above */ 1628 return rdev_stop_beacons(rdev, wpan_dev); 1629} 1630 |
1631static int nl802154_associate(struct sk_buff *skb, struct genl_info *info) 1632{ 1633 struct cfg802154_registered_device *rdev = info->user_ptr[0]; 1634 struct net_device *dev = info->user_ptr[1]; 1635 struct wpan_dev *wpan_dev; 1636 struct wpan_phy *wpan_phy; 1637 struct ieee802154_addr coord; 1638 int err; 1639 1640 wpan_dev = dev->ieee802154_ptr; 1641 wpan_phy = &rdev->wpan_phy; 1642 1643 if (wpan_phy->flags & WPAN_PHY_FLAG_DATAGRAMS_ONLY) { 1644 NL_SET_ERR_MSG(info->extack, "PHY only supports datagrams"); 1645 return -EOPNOTSUPP; 1646 } 1647 1648 if (!info->attrs[NL802154_ATTR_PAN_ID] || 1649 !info->attrs[NL802154_ATTR_EXTENDED_ADDR]) 1650 return -EINVAL; 1651 1652 coord.pan_id = nla_get_le16(info->attrs[NL802154_ATTR_PAN_ID]); 1653 coord.mode = IEEE802154_ADDR_LONG; 1654 coord.extended_addr = nla_get_le64(info->attrs[NL802154_ATTR_EXTENDED_ADDR]); 1655 1656 mutex_lock(&wpan_dev->association_lock); 1657 err = rdev_associate(rdev, wpan_dev, &coord); 1658 mutex_unlock(&wpan_dev->association_lock); 1659 if (err) 1660 pr_err("Association with PAN ID 0x%x failed (%d)\n", 1661 le16_to_cpu(coord.pan_id), err); 1662 1663 return err; 1664} 1665 |
|
1631#ifdef CONFIG_IEEE802154_NL802154_EXPERIMENTAL 1632static const struct nla_policy nl802154_dev_addr_policy[NL802154_DEV_ADDR_ATTR_MAX + 1] = { 1633 [NL802154_DEV_ADDR_ATTR_PAN_ID] = { .type = NLA_U16 }, 1634 [NL802154_DEV_ADDR_ATTR_MODE] = { .type = NLA_U32 }, 1635 [NL802154_DEV_ADDR_ATTR_SHORT] = { .type = NLA_U16 }, 1636 [NL802154_DEV_ADDR_ATTR_EXTENDED] = { .type = NLA_U64 }, 1637}; 1638 --- 1105 unchanged lines hidden (view full) --- 2744 { 2745 .cmd = NL802154_CMD_STOP_BEACONS, 2746 .doit = nl802154_stop_beacons, 2747 .flags = GENL_ADMIN_PERM, 2748 .internal_flags = NL802154_FLAG_NEED_NETDEV | 2749 NL802154_FLAG_CHECK_NETDEV_UP | 2750 NL802154_FLAG_NEED_RTNL, 2751 }, | 1666#ifdef CONFIG_IEEE802154_NL802154_EXPERIMENTAL 1667static const struct nla_policy nl802154_dev_addr_policy[NL802154_DEV_ADDR_ATTR_MAX + 1] = { 1668 [NL802154_DEV_ADDR_ATTR_PAN_ID] = { .type = NLA_U16 }, 1669 [NL802154_DEV_ADDR_ATTR_MODE] = { .type = NLA_U32 }, 1670 [NL802154_DEV_ADDR_ATTR_SHORT] = { .type = NLA_U16 }, 1671 [NL802154_DEV_ADDR_ATTR_EXTENDED] = { .type = NLA_U64 }, 1672}; 1673 --- 1105 unchanged lines hidden (view full) --- 2779 { 2780 .cmd = NL802154_CMD_STOP_BEACONS, 2781 .doit = nl802154_stop_beacons, 2782 .flags = GENL_ADMIN_PERM, 2783 .internal_flags = NL802154_FLAG_NEED_NETDEV | 2784 NL802154_FLAG_CHECK_NETDEV_UP | 2785 NL802154_FLAG_NEED_RTNL, 2786 }, |
2787 { 2788 .cmd = NL802154_CMD_ASSOCIATE, 2789 .doit = nl802154_associate, 2790 .flags = GENL_ADMIN_PERM, 2791 .internal_flags = NL802154_FLAG_NEED_NETDEV | 2792 NL802154_FLAG_CHECK_NETDEV_UP | 2793 NL802154_FLAG_NEED_RTNL, 2794 }, |
|
2752#ifdef CONFIG_IEEE802154_NL802154_EXPERIMENTAL 2753 { 2754 .cmd = NL802154_CMD_SET_SEC_PARAMS, 2755 .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, 2756 .doit = nl802154_set_llsec_params, 2757 .flags = GENL_ADMIN_PERM, 2758 .internal_flags = NL802154_FLAG_NEED_NETDEV | 2759 NL802154_FLAG_NEED_RTNL, --- 138 unchanged lines hidden --- | 2795#ifdef CONFIG_IEEE802154_NL802154_EXPERIMENTAL 2796 { 2797 .cmd = NL802154_CMD_SET_SEC_PARAMS, 2798 .validate = GENL_DONT_VALIDATE_STRICT | GENL_DONT_VALIDATE_DUMP, 2799 .doit = nl802154_set_llsec_params, 2800 .flags = GENL_ADMIN_PERM, 2801 .internal_flags = NL802154_FLAG_NEED_NETDEV | 2802 NL802154_FLAG_NEED_RTNL, --- 138 unchanged lines hidden --- |