#include "ieee802154_i.h"
#include "driver-ops.h"
-struct hw_addr_filt_notify_work {
- struct work_struct work;
- struct net_device *dev;
- unsigned long changed;
-};
-
-static struct ieee802154_local *mac802154_slave_get_priv(struct net_device *dev)
-{
- struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
-
- BUG_ON(dev->type != ARPHRD_IEEE802154);
-
- return sdata->local;
-}
-
-static void hw_addr_notify(struct work_struct *work)
-{
- struct hw_addr_filt_notify_work *nw = container_of(work,
- struct hw_addr_filt_notify_work, work);
- struct ieee802154_local *local = mac802154_slave_get_priv(nw->dev);
- int res;
-
- res = local->ops->set_hw_addr_filt(&local->hw, &local->hw.hw_filt,
- nw->changed);
- if (res)
- pr_debug("failed changed mask %lx\n", nw->changed);
-
- kfree(nw);
-}
-
-static void set_hw_addr_filt(struct net_device *dev, unsigned long changed)
-{
- struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
- struct hw_addr_filt_notify_work *work;
-
- work = kzalloc(sizeof(*work), GFP_ATOMIC);
- if (!work)
- return;
-
- INIT_WORK(&work->work, hw_addr_notify);
- work->dev = dev;
- work->changed = changed;
- queue_work(sdata->local->workqueue, &work->work);
-}
-
void mac802154_dev_set_short_addr(struct net_device *dev, __le16 val)
{
struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
spin_lock_bh(&sdata->mib_lock);
sdata->pan_id = val;
spin_unlock_bh(&sdata->mib_lock);
-
- if ((sdata->local->ops->set_hw_addr_filt) &&
- (sdata->local->hw.hw_filt.pan_id != sdata->pan_id)) {
- sdata->local->hw.hw_filt.pan_id = sdata->pan_id;
- set_hw_addr_filt(dev, IEEE802154_AFILT_PANID_CHANGED);
- }
}
u8 mac802154_dev_get_dsn(const struct net_device *dev)