]> git.karo-electronics.de Git - linux-beck.git/commitdiff
ieee802154: iface: move multiple node type check
authorAlexander Aring <alex.aring@gmail.com>
Fri, 19 Dec 2014 22:45:59 +0000 (23:45 +0100)
committerMarcel Holtmann <marcel@holtmann.org>
Fri, 19 Dec 2014 23:06:55 +0000 (00:06 +0100)
This patch moves the handling for checking on multiple node type
interface to the corresponding concurrent iface check function.

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

index 61f3ff00a508ace27a3be4d45c2f6f22c528fad9..6fb6bdf9868c7684b63635a23c2a8b45ae07e4d8 100644 (file)
@@ -137,25 +137,11 @@ static int mac802154_wpan_mac_addr(struct net_device *dev, void *p)
 static int mac802154_slave_open(struct net_device *dev)
 {
        struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
-       struct ieee802154_sub_if_data *subif;
        struct ieee802154_local *local = sdata->local;
        int res = 0;
 
        ASSERT_RTNL();
 
-       if (sdata->vif.type == NL802154_IFTYPE_NODE) {
-               mutex_lock(&sdata->local->iflist_mtx);
-               list_for_each_entry(subif, &sdata->local->interfaces, list) {
-                       if (subif != sdata &&
-                           subif->vif.type == sdata->vif.type &&
-                           ieee802154_sdata_running(subif)) {
-                               mutex_unlock(&sdata->local->iflist_mtx);
-                               return -EBUSY;
-                       }
-               }
-               mutex_unlock(&sdata->local->iflist_mtx);
-       }
-
        set_bit(SDATA_STATE_RUNNING, &sdata->state);
 
        if (!local->open_count) {
@@ -235,6 +221,15 @@ ieee802154_check_concurrent_iface(struct ieee802154_sub_if_data *sdata,
                if (nsdata != sdata && ieee802154_sdata_running(nsdata)) {
                        int ret;
 
+                       /* TODO currently we don't support multiple node types
+                        * we need to run skb_clone at rx path. Check if there
+                        * exist really an use case if we need to support
+                        * multiple node types at the same time.
+                        */
+                       if (sdata->vif.type == NL802154_IFTYPE_NODE &&
+                           nsdata->vif.type == NL802154_IFTYPE_NODE)
+                               return -EBUSY;
+
                        /* check all phy mac sublayer settings are the same.
                         * We have only one phy, different values makes trouble.
                         */