Commit f59f419d authored by Alexander Aring's avatar Alexander Aring Committed by Marcel Holtmann

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: default avatarAlexander Aring <alex.aring@gmail.com>
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
parent 50c79075
...@@ -218,31 +218,12 @@ static int mac802154_wpan_open(struct net_device *dev) ...@@ -218,31 +218,12 @@ static int mac802154_wpan_open(struct net_device *dev)
goto out; goto out;
} }
if (local->hw.flags & IEEE802154_HW_TXPOWER) {
rc = drv_set_tx_power(local, sdata->mac_params.transmit_power);
if (rc < 0)
goto out;
}
if (local->hw.flags & IEEE802154_HW_LBT) { if (local->hw.flags & IEEE802154_HW_LBT) {
rc = drv_set_lbt_mode(local, sdata->mac_params.lbt); rc = drv_set_lbt_mode(local, sdata->mac_params.lbt);
if (rc < 0) if (rc < 0)
goto out; goto out;
} }
if (local->hw.flags & IEEE802154_HW_CCA_MODE) {
rc = drv_set_cca_mode(local, sdata->mac_params.cca_mode);
if (rc < 0)
goto out;
}
if (local->hw.flags & IEEE802154_HW_CCA_ED_LEVEL) {
rc = drv_set_cca_ed_level(local,
sdata->mac_params.cca_ed_level);
if (rc < 0)
goto out;
}
if (local->hw.flags & IEEE802154_HW_CSMA_PARAMS) { if (local->hw.flags & IEEE802154_HW_CSMA_PARAMS) {
rc = drv_set_csma_params(local, sdata->mac_params.min_be, rc = drv_set_csma_params(local, sdata->mac_params.min_be,
sdata->mac_params.max_be, sdata->mac_params.max_be,
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include <net/nl802154.h> #include <net/nl802154.h>
#include "ieee802154_i.h" #include "ieee802154_i.h"
#include "driver-ops.h"
static int mac802154_mlme_start_req(struct net_device *dev, static int mac802154_mlme_start_req(struct net_device *dev,
struct ieee802154_addr *addr, struct ieee802154_addr *addr,
...@@ -85,11 +86,31 @@ static int mac802154_set_mac_params(struct net_device *dev, ...@@ -85,11 +86,31 @@ static int mac802154_set_mac_params(struct net_device *dev,
const struct ieee802154_mac_params *params) const struct ieee802154_mac_params *params)
{ {
struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev); struct ieee802154_sub_if_data *sdata = IEEE802154_DEV_TO_SUB_IF(dev);
struct ieee802154_local *local = sdata->local;
int ret;
mutex_lock(&sdata->local->iflist_mtx); mutex_lock(&sdata->local->iflist_mtx);
sdata->mac_params = *params; sdata->mac_params = *params;
mutex_unlock(&sdata->local->iflist_mtx); mutex_unlock(&sdata->local->iflist_mtx);
if (local->hw.flags & IEEE802154_HW_TXPOWER) {
ret = drv_set_tx_power(local, params->transmit_power);
if (ret < 0)
return ret;
}
if (local->hw.flags & IEEE802154_HW_CCA_MODE) {
ret = drv_set_cca_mode(local, params->cca_mode);
if (ret < 0)
return ret;
}
if (local->hw.flags & IEEE802154_HW_CCA_ED_LEVEL) {
ret = drv_set_cca_ed_level(local, params->cca_ed_level);
if (ret < 0)
return ret;
}
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment