aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac802154
diff options
context:
space:
mode:
authorAlexander Aring <alex.aring@gmail.com>2014-11-09 02:36:46 -0500
committerMarcel Holtmann <marcel@holtmann.org>2014-11-09 13:50:28 -0500
commit5fb3f026ae15827fe32e34adafce0d0f63ad0366 (patch)
tree35b5e05e5ff8c2dd6fc72568645c66641aa8daa9 /net/mac802154
parent863e88f255dac0657e57d5f1a1f95ee8733f8c13 (diff)
mac802154: remove mac_params in sdata
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>
Diffstat (limited to 'net/mac802154')
-rw-r--r--net/mac802154/ieee802154_i.h2
-rw-r--r--net/mac802154/iface.c19
-rw-r--r--net/mac802154/mac_cmd.c26
3 files changed, 33 insertions, 14 deletions
diff --git a/net/mac802154/ieee802154_i.h b/net/mac802154/ieee802154_i.h
index 803f529e2c45..e22f509af72b 100644
--- a/net/mac802154/ieee802154_i.h
+++ b/net/mac802154/ieee802154_i.h
@@ -84,8 +84,6 @@ struct ieee802154_sub_if_data {
84 84
85 spinlock_t mib_lock; 85 spinlock_t mib_lock;
86 86
87 struct ieee802154_mac_params mac_params;
88
89 /* protects sec from concurrent access by netlink. access by 87 /* protects sec from concurrent access by netlink. access by
90 * encrypt/decrypt/header_create safe without additional protection. 88 * encrypt/decrypt/header_create safe without additional protection.
91 */ 89 */
diff --git a/net/mac802154/iface.c b/net/mac802154/iface.c
index 6669da7446f2..c0b96cf525d6 100644
--- a/net/mac802154/iface.c
+++ b/net/mac802154/iface.c
@@ -205,22 +205,21 @@ static int mac802154_wpan_open(struct net_device *dev)
205 } 205 }
206 206
207 if (local->hw.flags & IEEE802154_HW_LBT) { 207 if (local->hw.flags & IEEE802154_HW_LBT) {
208 rc = drv_set_lbt_mode(local, sdata->mac_params.lbt); 208 rc = drv_set_lbt_mode(local, wpan_dev->lbt);
209 if (rc < 0) 209 if (rc < 0)
210 goto out; 210 goto out;
211 } 211 }
212 212
213 if (local->hw.flags & IEEE802154_HW_CSMA_PARAMS) { 213 if (local->hw.flags & IEEE802154_HW_CSMA_PARAMS) {
214 rc = drv_set_csma_params(local, sdata->mac_params.min_be, 214 rc = drv_set_csma_params(local, wpan_dev->min_be,
215 sdata->mac_params.max_be, 215 wpan_dev->max_be,
216 sdata->mac_params.csma_retries); 216 wpan_dev->csma_retries);
217 if (rc < 0) 217 if (rc < 0)
218 goto out; 218 goto out;
219 } 219 }
220 220
221 if (local->hw.flags & IEEE802154_HW_FRAME_RETRIES) { 221 if (local->hw.flags & IEEE802154_HW_FRAME_RETRIES) {
222 rc = drv_set_max_frame_retries(local, 222 rc = drv_set_max_frame_retries(local, wpan_dev->frame_retries);
223 sdata->mac_params.frame_retries);
224 if (rc < 0) 223 if (rc < 0)
225 goto out; 224 goto out;
226 } 225 }
@@ -410,11 +409,11 @@ ieee802154_setup_sdata(struct ieee802154_sub_if_data *sdata, int type)
410 get_random_bytes(&wpan_dev->dsn, 1); 409 get_random_bytes(&wpan_dev->dsn, 1);
411 410
412 /* defaults per 802.15.4-2011 */ 411 /* defaults per 802.15.4-2011 */
413 sdata->mac_params.min_be = 3; 412 wpan_dev->min_be = 3;
414 sdata->mac_params.max_be = 5; 413 wpan_dev->max_be = 5;
415 sdata->mac_params.csma_retries = 4; 414 wpan_dev->csma_retries = 4;
416 /* for compatibility, actual default is 3 */ 415 /* for compatibility, actual default is 3 */
417 sdata->mac_params.frame_retries = -1; 416 wpan_dev->frame_retries = -1;
418 417
419 ieee802154_be64_to_le64(&wpan_dev->extended_addr, sdata->dev->dev_addr); 418 ieee802154_be64_to_le64(&wpan_dev->extended_addr, sdata->dev->dev_addr);
420 wpan_dev->pan_id = cpu_to_le16(IEEE802154_PANID_BROADCAST); 419 wpan_dev->pan_id = cpu_to_le16(IEEE802154_PANID_BROADCAST);
diff --git a/net/mac802154/mac_cmd.c b/net/mac802154/mac_cmd.c
index 00b2b214770e..b8bd95263aab 100644
--- a/net/mac802154/mac_cmd.c
+++ b/net/mac802154/mac_cmd.c
@@ -72,10 +72,21 @@ static int mac802154_set_mac_params(struct net_device *dev,
72{ 72{
73 struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev); 73 struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
74 struct ieee802154_local *local = sdata->local; 74 struct ieee802154_local *local = sdata->local;
75 struct wpan_dev *wpan_dev = &sdata->wpan_dev;
75 int ret; 76 int ret;
76 77
77 mutex_lock(&sdata->local->iflist_mtx); 78 mutex_lock(&sdata->local->iflist_mtx);
78 sdata->mac_params = *params; 79 /* PHY */
80 wpan_dev->wpan_phy->transmit_power = params->transmit_power;
81 wpan_dev->wpan_phy->cca_mode = params->cca_mode;
82 wpan_dev->wpan_phy->cca_ed_level = params->cca_ed_level;
83
84 /* MAC */
85 wpan_dev->min_be = params->min_be;
86 wpan_dev->max_be = params->max_be;
87 wpan_dev->csma_retries = params->csma_retries;
88 wpan_dev->frame_retries = params->frame_retries;
89 wpan_dev->lbt = params->lbt;
79 mutex_unlock(&sdata->local->iflist_mtx); 90 mutex_unlock(&sdata->local->iflist_mtx);
80 91
81 if (local->hw.flags & IEEE802154_HW_TXPOWER) { 92 if (local->hw.flags & IEEE802154_HW_TXPOWER) {
@@ -103,9 +114,20 @@ static void mac802154_get_mac_params(struct net_device *dev,
103 struct ieee802154_mac_params *params) 114 struct ieee802154_mac_params *params)
104{ 115{
105 struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev); 116 struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
117 struct wpan_dev *wpan_dev = &sdata->wpan_dev;
106 118
107 mutex_lock(&sdata->local->iflist_mtx); 119 mutex_lock(&sdata->local->iflist_mtx);
108 *params = sdata->mac_params; 120 /* PHY */
121 params->transmit_power = wpan_dev->wpan_phy->transmit_power;
122 params->cca_mode = wpan_dev->wpan_phy->cca_mode;
123 params->cca_ed_level = wpan_dev->wpan_phy->cca_ed_level;
124
125 /* MAC */
126 params->min_be = wpan_dev->min_be;
127 params->max_be = wpan_dev->max_be;
128 params->csma_retries = wpan_dev->csma_retries;
129 params->frame_retries = wpan_dev->frame_retries;
130 params->lbt = wpan_dev->lbt;
109 mutex_unlock(&sdata->local->iflist_mtx); 131 mutex_unlock(&sdata->local->iflist_mtx);
110} 132}
111 133