Commit 8f499f99 authored by Alexander Aring's avatar Alexander Aring Committed by Marcel Holtmann

ieee802154: don't allow to change addr while netif_running

This patch changes the actual behaviour for setting address attributes.
We should not change addresses while netif_running is true. Furthermore
when netif_running is running the address attributes becomes read only
and we can remove locking mechanism in receive and transmit hothpaths
of 802.15.4 subsystem.
Signed-off-by: default avatarAlexander Aring <alex.aring@gmail.com>
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
parent 4a9a816a
...@@ -477,7 +477,7 @@ int ieee802154_start_req(struct sk_buff *skb, struct genl_info *info) ...@@ -477,7 +477,7 @@ int ieee802154_start_req(struct sk_buff *skb, struct genl_info *info)
u8 channel, bcn_ord, sf_ord; u8 channel, bcn_ord, sf_ord;
u8 page; u8 page;
int pan_coord, blx, coord_realign; int pan_coord, blx, coord_realign;
int ret = -EOPNOTSUPP; int ret = -EBUSY;
if (!info->attrs[IEEE802154_ATTR_COORD_PAN_ID] || if (!info->attrs[IEEE802154_ATTR_COORD_PAN_ID] ||
!info->attrs[IEEE802154_ATTR_COORD_SHORT_ADDR] || !info->attrs[IEEE802154_ATTR_COORD_SHORT_ADDR] ||
...@@ -493,9 +493,15 @@ int ieee802154_start_req(struct sk_buff *skb, struct genl_info *info) ...@@ -493,9 +493,15 @@ int ieee802154_start_req(struct sk_buff *skb, struct genl_info *info)
dev = ieee802154_nl_get_dev(info); dev = ieee802154_nl_get_dev(info);
if (!dev) if (!dev)
return -ENODEV; return -ENODEV;
if (!ieee802154_mlme_ops(dev)->start_req)
if (netif_running(dev))
goto out; goto out;
if (!ieee802154_mlme_ops(dev)->start_req) {
ret = -EOPNOTSUPP;
goto out;
}
addr.mode = IEEE802154_ADDR_SHORT; addr.mode = IEEE802154_ADDR_SHORT;
addr.short_addr = nla_get_shortaddr( addr.short_addr = nla_get_shortaddr(
info->attrs[IEEE802154_ATTR_COORD_SHORT_ADDR]); info->attrs[IEEE802154_ATTR_COORD_SHORT_ADDR]);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment