]> git.karo-electronics.de Git - linux-beck.git/commitdiff
mac802154: remove mac_params in sdata
authorAlexander Aring <alex.aring@gmail.com>
Sun, 9 Nov 2014 07:36:46 +0000 (08:36 +0100)
committerMarcel Holtmann <marcel@holtmann.org>
Sun, 9 Nov 2014 18:50:28 +0000 (19:50 +0100)
This patch removes the mac_params from subif data struct. Instead we
manipulate the wpan attributes directly.

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

index 803f529e2c45ef9f4d27cfa7eb7340f92888bf54..e22f509af72b74a292b6cb59480eab0e72349e0d 100644 (file)
@@ -84,8 +84,6 @@ struct ieee802154_sub_if_data {
 
        spinlock_t mib_lock;
 
-       struct ieee802154_mac_params mac_params;
-
        /* protects sec from concurrent access by netlink. access by
         * encrypt/decrypt/header_create safe without additional protection.
         */
index 6669da7446f2936607d3ac3df228db42150f2467..c0b96cf525d6695b18464eb960bb382a15ce3904 100644 (file)
@@ -205,22 +205,21 @@ static int mac802154_wpan_open(struct net_device *dev)
        }
 
        if (local->hw.flags & IEEE802154_HW_LBT) {
-               rc = drv_set_lbt_mode(local, sdata->mac_params.lbt);
+               rc = drv_set_lbt_mode(local, wpan_dev->lbt);
                if (rc < 0)
                        goto out;
        }
 
        if (local->hw.flags & IEEE802154_HW_CSMA_PARAMS) {
-               rc = drv_set_csma_params(local, sdata->mac_params.min_be,
-                                        sdata->mac_params.max_be,
-                                        sdata->mac_params.csma_retries);
+               rc = drv_set_csma_params(local, wpan_dev->min_be,
+                                        wpan_dev->max_be,
+                                        wpan_dev->csma_retries);
                if (rc < 0)
                        goto out;
        }
 
        if (local->hw.flags & IEEE802154_HW_FRAME_RETRIES) {
-               rc = drv_set_max_frame_retries(local,
-                                              sdata->mac_params.frame_retries);
+               rc = drv_set_max_frame_retries(local, wpan_dev->frame_retries);
                if (rc < 0)
                        goto out;
        }
@@ -410,11 +409,11 @@ ieee802154_setup_sdata(struct ieee802154_sub_if_data *sdata, int type)
        get_random_bytes(&wpan_dev->dsn, 1);
 
        /* defaults per 802.15.4-2011 */
-       sdata->mac_params.min_be = 3;
-       sdata->mac_params.max_be = 5;
-       sdata->mac_params.csma_retries = 4;
+       wpan_dev->min_be = 3;
+       wpan_dev->max_be = 5;
+       wpan_dev->csma_retries = 4;
        /* for compatibility, actual default is 3 */
-       sdata->mac_params.frame_retries = -1;
+       wpan_dev->frame_retries = -1;
 
        ieee802154_be64_to_le64(&wpan_dev->extended_addr, sdata->dev->dev_addr);
        wpan_dev->pan_id = cpu_to_le16(IEEE802154_PANID_BROADCAST);
index 00b2b214770eb3b7e37ba0b6179ec7054e88df33..b8bd95263aabc25c5c72034650a8b717d9fefd44 100644 (file)
@@ -72,10 +72,21 @@ static int mac802154_set_mac_params(struct net_device *dev,
 {
        struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
        struct ieee802154_local *local = sdata->local;
+       struct wpan_dev *wpan_dev = &sdata->wpan_dev;
        int ret;
 
        mutex_lock(&sdata->local->iflist_mtx);
-       sdata->mac_params = *params;
+       /* PHY */
+       wpan_dev->wpan_phy->transmit_power = params->transmit_power;
+       wpan_dev->wpan_phy->cca_mode = params->cca_mode;
+       wpan_dev->wpan_phy->cca_ed_level = params->cca_ed_level;
+
+       /* MAC */
+       wpan_dev->min_be = params->min_be;
+       wpan_dev->max_be = params->max_be;
+       wpan_dev->csma_retries = params->csma_retries;
+       wpan_dev->frame_retries = params->frame_retries;
+       wpan_dev->lbt = params->lbt;
        mutex_unlock(&sdata->local->iflist_mtx);
 
        if (local->hw.flags & IEEE802154_HW_TXPOWER) {
@@ -103,9 +114,20 @@ static void mac802154_get_mac_params(struct net_device *dev,
                                     struct ieee802154_mac_params *params)
 {
        struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
+       struct wpan_dev *wpan_dev = &sdata->wpan_dev;
 
        mutex_lock(&sdata->local->iflist_mtx);
-       *params = sdata->mac_params;
+       /* PHY */
+       params->transmit_power = wpan_dev->wpan_phy->transmit_power;
+       params->cca_mode = wpan_dev->wpan_phy->cca_mode;
+       params->cca_ed_level = wpan_dev->wpan_phy->cca_ed_level;
+
+       /* MAC */
+       params->min_be = wpan_dev->min_be;
+       params->max_be = wpan_dev->max_be;
+       params->csma_retries = wpan_dev->csma_retries;
+       params->frame_retries = wpan_dev->frame_retries;
+       params->lbt = wpan_dev->lbt;
        mutex_unlock(&sdata->local->iflist_mtx);
 }