mac802154: set panid address filter on ifup
authorAlexander Aring <alex.aring@gmail.com>
Sun, 2 Nov 2014 03:18:43 +0000 (04:18 +0100)
committerMarcel Holtmann <marcel@holtmann.org>
Sun, 2 Nov 2014 03:51:07 +0000 (04:51 +0100)
This patch moves the setting of hardware panid address filtering
inside of interface up instead doing it it directly inside of netlink
interface. The netlink call which can only be called when netif isn't
running sets only the necessary panid value in sdata. After an
interface up the address filter will be set with this value.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
net/mac802154/iface.c
net/mac802154/mib.c

index 1bae29dff082359e6d7192a238734a64071434d6..5f94c70478f98390f5b8077b5e16945e7e69351f 100644 (file)
@@ -205,6 +205,10 @@ static int mac802154_wpan_open(struct net_device *dev)
        }
 
        if (local->hw.flags & IEEE802154_HW_AFILT) {
+               rc = drv_set_pan_id(local, sdata->pan_id);
+               if (rc < 0)
+                       goto out;
+
                rc = drv_set_extended_addr(local, sdata->extended_addr);
                if (rc < 0)
                        goto out;
index 755befde6a178e2da71956b5a026da0cbbdf806c..6fa749154bafa8732b8a6f7d498411cc1c406111 100644 (file)
 #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);
@@ -119,12 +74,6 @@ void mac802154_dev_set_pan_id(struct net_device *dev, __le16 val)
        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)