Loading include/net/cfg802154.h +2 −0 Original line number Diff line number Diff line Loading @@ -43,6 +43,8 @@ struct cfg802154_ops { const char *name, enum nl802154_iftype type, __le64 extended_addr); int (*del_virtual_intf)(struct wpan_phy *wpan_phy, struct wpan_dev *wpan_dev); int (*set_channel)(struct wpan_phy *wpan_phy, u8 page, u8 channel); int (*set_pan_id)(struct wpan_phy *wpan_phy, struct wpan_dev *wpan_dev, u16 pan_id); Loading net/ieee802154/nl802154.c +28 −0 Original line number Diff line number Diff line Loading @@ -583,6 +583,26 @@ static int nl802154_new_interface(struct sk_buff *skb, struct genl_info *info) type, extended_addr); } static int nl802154_del_interface(struct sk_buff *skb, struct genl_info *info) { struct cfg802154_registered_device *rdev = info->user_ptr[0]; struct wpan_dev *wpan_dev = info->user_ptr[1]; if (!rdev->ops->del_virtual_intf) return -EOPNOTSUPP; /* If we remove a wpan device without a netdev then clear * user_ptr[1] so that nl802154_post_doit won't dereference it * to check if it needs to do dev_put(). Otherwise it crashes * since the wpan_dev has been freed, unlike with a netdev where * we need the dev_put() for the netdev to really be freed. */ if (!wpan_dev->netdev) info->user_ptr[1] = NULL; return rdev_del_virtual_intf(rdev, wpan_dev); } static int nl802154_set_channel(struct sk_buff *skb, struct genl_info *info) { struct cfg802154_registered_device *rdev = info->user_ptr[0]; Loading Loading @@ -858,6 +878,14 @@ static const struct genl_ops nl802154_ops[] = { .internal_flags = NL802154_FLAG_NEED_WPAN_PHY | NL802154_FLAG_NEED_RTNL, }, { .cmd = NL802154_CMD_DEL_INTERFACE, .doit = nl802154_del_interface, .policy = nl802154_policy, .flags = GENL_ADMIN_PERM, .internal_flags = NL802154_FLAG_NEED_WPAN_DEV | NL802154_FLAG_NEED_RTNL, }, { .cmd = NL802154_CMD_SET_CHANNEL, .doit = nl802154_set_channel, Loading net/ieee802154/rdev-ops.h +7 −0 Original line number Diff line number Diff line Loading @@ -28,6 +28,13 @@ rdev_add_virtual_intf(struct cfg802154_registered_device *rdev, char *name, extended_addr); } static inline int rdev_del_virtual_intf(struct cfg802154_registered_device *rdev, struct wpan_dev *wpan_dev) { return rdev->ops->del_virtual_intf(&rdev->wpan_phy, wpan_dev); } static inline int rdev_set_channel(struct cfg802154_registered_device *rdev, u8 page, u8 channel) { Loading net/mac802154/cfg.c +9 −0 Original line number Diff line number Diff line Loading @@ -57,6 +57,14 @@ ieee802154_add_iface(struct wpan_phy *phy, const char *name, return 0; } static int ieee802154_del_iface(struct wpan_phy *wpan_phy, struct wpan_dev *wpan_dev) { ieee802154_if_remove(IEEE802154_WPAN_DEV_TO_SUB_IF(wpan_dev)); return 0; } static int ieee802154_set_channel(struct wpan_phy *wpan_phy, u8 page, u8 channel) { Loading Loading @@ -191,6 +199,7 @@ const struct cfg802154_ops mac802154_config_ops = { .add_virtual_intf_deprecated = ieee802154_add_iface_deprecated, .del_virtual_intf_deprecated = ieee802154_del_iface_deprecated, .add_virtual_intf = ieee802154_add_iface, .del_virtual_intf = ieee802154_del_iface, .set_channel = ieee802154_set_channel, .set_pan_id = ieee802154_set_pan_id, .set_short_addr = ieee802154_set_short_addr, Loading net/mac802154/ieee802154_i.h +6 −0 Original line number Diff line number Diff line Loading @@ -115,6 +115,12 @@ IEEE802154_DEV_TO_SUB_IF(const struct net_device *dev) return netdev_priv(dev); } static inline struct ieee802154_sub_if_data * IEEE802154_WPAN_DEV_TO_SUB_IF(struct wpan_dev *wpan_dev) { return container_of(wpan_dev, struct ieee802154_sub_if_data, wpan_dev); } static inline bool ieee802154_sdata_running(struct ieee802154_sub_if_data *sdata) { Loading Loading
include/net/cfg802154.h +2 −0 Original line number Diff line number Diff line Loading @@ -43,6 +43,8 @@ struct cfg802154_ops { const char *name, enum nl802154_iftype type, __le64 extended_addr); int (*del_virtual_intf)(struct wpan_phy *wpan_phy, struct wpan_dev *wpan_dev); int (*set_channel)(struct wpan_phy *wpan_phy, u8 page, u8 channel); int (*set_pan_id)(struct wpan_phy *wpan_phy, struct wpan_dev *wpan_dev, u16 pan_id); Loading
net/ieee802154/nl802154.c +28 −0 Original line number Diff line number Diff line Loading @@ -583,6 +583,26 @@ static int nl802154_new_interface(struct sk_buff *skb, struct genl_info *info) type, extended_addr); } static int nl802154_del_interface(struct sk_buff *skb, struct genl_info *info) { struct cfg802154_registered_device *rdev = info->user_ptr[0]; struct wpan_dev *wpan_dev = info->user_ptr[1]; if (!rdev->ops->del_virtual_intf) return -EOPNOTSUPP; /* If we remove a wpan device without a netdev then clear * user_ptr[1] so that nl802154_post_doit won't dereference it * to check if it needs to do dev_put(). Otherwise it crashes * since the wpan_dev has been freed, unlike with a netdev where * we need the dev_put() for the netdev to really be freed. */ if (!wpan_dev->netdev) info->user_ptr[1] = NULL; return rdev_del_virtual_intf(rdev, wpan_dev); } static int nl802154_set_channel(struct sk_buff *skb, struct genl_info *info) { struct cfg802154_registered_device *rdev = info->user_ptr[0]; Loading Loading @@ -858,6 +878,14 @@ static const struct genl_ops nl802154_ops[] = { .internal_flags = NL802154_FLAG_NEED_WPAN_PHY | NL802154_FLAG_NEED_RTNL, }, { .cmd = NL802154_CMD_DEL_INTERFACE, .doit = nl802154_del_interface, .policy = nl802154_policy, .flags = GENL_ADMIN_PERM, .internal_flags = NL802154_FLAG_NEED_WPAN_DEV | NL802154_FLAG_NEED_RTNL, }, { .cmd = NL802154_CMD_SET_CHANNEL, .doit = nl802154_set_channel, Loading
net/ieee802154/rdev-ops.h +7 −0 Original line number Diff line number Diff line Loading @@ -28,6 +28,13 @@ rdev_add_virtual_intf(struct cfg802154_registered_device *rdev, char *name, extended_addr); } static inline int rdev_del_virtual_intf(struct cfg802154_registered_device *rdev, struct wpan_dev *wpan_dev) { return rdev->ops->del_virtual_intf(&rdev->wpan_phy, wpan_dev); } static inline int rdev_set_channel(struct cfg802154_registered_device *rdev, u8 page, u8 channel) { Loading
net/mac802154/cfg.c +9 −0 Original line number Diff line number Diff line Loading @@ -57,6 +57,14 @@ ieee802154_add_iface(struct wpan_phy *phy, const char *name, return 0; } static int ieee802154_del_iface(struct wpan_phy *wpan_phy, struct wpan_dev *wpan_dev) { ieee802154_if_remove(IEEE802154_WPAN_DEV_TO_SUB_IF(wpan_dev)); return 0; } static int ieee802154_set_channel(struct wpan_phy *wpan_phy, u8 page, u8 channel) { Loading Loading @@ -191,6 +199,7 @@ const struct cfg802154_ops mac802154_config_ops = { .add_virtual_intf_deprecated = ieee802154_add_iface_deprecated, .del_virtual_intf_deprecated = ieee802154_del_iface_deprecated, .add_virtual_intf = ieee802154_add_iface, .del_virtual_intf = ieee802154_del_iface, .set_channel = ieee802154_set_channel, .set_pan_id = ieee802154_set_pan_id, .set_short_addr = ieee802154_set_short_addr, Loading
net/mac802154/ieee802154_i.h +6 −0 Original line number Diff line number Diff line Loading @@ -115,6 +115,12 @@ IEEE802154_DEV_TO_SUB_IF(const struct net_device *dev) return netdev_priv(dev); } static inline struct ieee802154_sub_if_data * IEEE802154_WPAN_DEV_TO_SUB_IF(struct wpan_dev *wpan_dev) { return container_of(wpan_dev, struct ieee802154_sub_if_data, wpan_dev); } static inline bool ieee802154_sdata_running(struct ieee802154_sub_if_data *sdata) { Loading