aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorAlexander Aring <alex.aring@gmail.com>2014-11-01 23:18:44 -0400
committerMarcel Holtmann <marcel@holtmann.org>2014-11-01 23:51:07 -0400
commitf59f419d31ee27c131b44beda5b14b8ce0aaf519 (patch)
tree424c93e1b35f1c581398fa566ce4ff534d2b1dda /net
parent50c79075019e7b952327cfebf0681548573fd8e5 (diff)
mac802154: move phy settings into netlink receive
All PHY attributes should be directly set to the transceiver after netlink. MAC attributes should be set by interface up. Currently the macparams netlink cmd contains mixed attributes of phy and mac settings. This patch moves all phy settings to the netlink receive function for setting macparams. This is the only way which doesn't change the userspace API and keep the deprecated netlink interface alive. Signed-off-by: Alexander Aring <alex.aring@gmail.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net')
-rw-r--r--net/mac802154/iface.c19
-rw-r--r--net/mac802154/mac_cmd.c21
2 files changed, 21 insertions, 19 deletions
diff --git a/net/mac802154/iface.c b/net/mac802154/iface.c
index 5f94c70478f9..eaad66590f10 100644
--- a/net/mac802154/iface.c
+++ b/net/mac802154/iface.c
@@ -218,31 +218,12 @@ static int mac802154_wpan_open(struct net_device *dev)
218 goto out; 218 goto out;
219 } 219 }
220 220
221 if (local->hw.flags & IEEE802154_HW_TXPOWER) {
222 rc = drv_set_tx_power(local, sdata->mac_params.transmit_power);
223 if (rc < 0)
224 goto out;
225 }
226
227 if (local->hw.flags & IEEE802154_HW_LBT) { 221 if (local->hw.flags & IEEE802154_HW_LBT) {
228 rc = drv_set_lbt_mode(local, sdata->mac_params.lbt); 222 rc = drv_set_lbt_mode(local, sdata->mac_params.lbt);
229 if (rc < 0) 223 if (rc < 0)
230 goto out; 224 goto out;
231 } 225 }
232 226
233 if (local->hw.flags & IEEE802154_HW_CCA_MODE) {
234 rc = drv_set_cca_mode(local, sdata->mac_params.cca_mode);
235 if (rc < 0)
236 goto out;
237 }
238
239 if (local->hw.flags & IEEE802154_HW_CCA_ED_LEVEL) {
240 rc = drv_set_cca_ed_level(local,
241 sdata->mac_params.cca_ed_level);
242 if (rc < 0)
243 goto out;
244 }
245
246 if (local->hw.flags & IEEE802154_HW_CSMA_PARAMS) { 227 if (local->hw.flags & IEEE802154_HW_CSMA_PARAMS) {
247 rc = drv_set_csma_params(local, sdata->mac_params.min_be, 228 rc = drv_set_csma_params(local, sdata->mac_params.min_be,
248 sdata->mac_params.max_be, 229 sdata->mac_params.max_be,
diff --git a/net/mac802154/mac_cmd.c b/net/mac802154/mac_cmd.c
index 90c1ad80a67d..9c2d6f61f194 100644
--- a/net/mac802154/mac_cmd.c
+++ b/net/mac802154/mac_cmd.c
@@ -28,6 +28,7 @@
28#include <net/nl802154.h> 28#include <net/nl802154.h>
29 29
30#include "ieee802154_i.h" 30#include "ieee802154_i.h"
31#include "driver-ops.h"
31 32
32static int mac802154_mlme_start_req(struct net_device *dev, 33static int mac802154_mlme_start_req(struct net_device *dev,
33 struct ieee802154_addr *addr, 34 struct ieee802154_addr *addr,
@@ -85,11 +86,31 @@ static int mac802154_set_mac_params(struct net_device *dev,
85 const struct ieee802154_mac_params *params) 86 const struct ieee802154_mac_params *params)
86{ 87{
87 struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev); 88 struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
89 struct ieee802154_local *local = sdata->local;
90 int ret;
88 91
89 mutex_lock(&sdata->local->iflist_mtx); 92 mutex_lock(&sdata->local->iflist_mtx);
90 sdata->mac_params = *params; 93 sdata->mac_params = *params;
91 mutex_unlock(&sdata->local->iflist_mtx); 94 mutex_unlock(&sdata->local->iflist_mtx);
92 95
96 if (local->hw.flags & IEEE802154_HW_TXPOWER) {
97 ret = drv_set_tx_power(local, params->transmit_power);
98 if (ret < 0)
99 return ret;
100 }
101
102 if (local->hw.flags & IEEE802154_HW_CCA_MODE) {
103 ret = drv_set_cca_mode(local, params->cca_mode);
104 if (ret < 0)
105 return ret;
106 }
107
108 if (local->hw.flags & IEEE802154_HW_CCA_ED_LEVEL) {
109 ret = drv_set_cca_ed_level(local, params->cca_ed_level);
110 if (ret < 0)
111 return ret;
112 }
113
93 return 0; 114 return 0;
94} 115}
95 116