]> Pileus Git - ~andy/linux/blobdiff - net/mac80211/cfg.c
mac80211: unify config_interface and bss_info_changed
[~andy/linux] / net / mac80211 / cfg.c
index e677b751d46857db80d163aa58bdbff04a116348..648bac1c850e32ab15600fdc7442ef161b064046 100644 (file)
@@ -451,18 +451,11 @@ static int ieee80211_config_beacon(struct ieee80211_sub_if_data *sdata,
         * This is a kludge. beacon interval should really be part
         * of the beacon information.
         */
-       if (params->interval && (sdata->local->hw.conf.beacon_int !=
-                                params->interval)) {
-               sdata->local->hw.conf.beacon_int = params->interval;
-               err = ieee80211_hw_config(sdata->local,
-                                       IEEE80211_CONF_CHANGE_BEACON_INTERVAL);
-               if (err < 0)
-                       return err;
-               /*
-                * We updated some parameter so if below bails out
-                * it's not an error.
-                */
-               err = 0;
+       if (params->interval &&
+           (sdata->vif.bss_conf.beacon_int != params->interval)) {
+               sdata->vif.bss_conf.beacon_int = params->interval;
+               ieee80211_bss_info_change_notify(sdata,
+                                                BSS_CHANGED_BEACON_INT);
        }
 
        /* Need to have a beacon head if we don't have one yet */
@@ -528,8 +521,9 @@ static int ieee80211_config_beacon(struct ieee80211_sub_if_data *sdata,
 
        kfree(old);
 
-       return ieee80211_if_config(sdata, IEEE80211_IFCC_BEACON |
-                                         IEEE80211_IFCC_BEACON_ENABLED);
+       ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_BEACON_ENABLED |
+                                               BSS_CHANGED_BEACON);
+       return 0;
 }
 
 static int ieee80211_add_beacon(struct wiphy *wiphy, struct net_device *dev,
@@ -580,7 +574,8 @@ static int ieee80211_del_beacon(struct wiphy *wiphy, struct net_device *dev)
        synchronize_rcu();
        kfree(old);
 
-       return ieee80211_if_config(sdata, IEEE80211_IFCC_BEACON_ENABLED);
+       ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_BEACON_ENABLED);
+       return 0;
 }
 
 /* Layer 2 Update frame (802.2 Type 1 LLC XID Update response) */
@@ -1167,7 +1162,8 @@ static int ieee80211_scan(struct wiphy *wiphy,
 
        if (sdata->vif.type != NL80211_IFTYPE_STATION &&
            sdata->vif.type != NL80211_IFTYPE_ADHOC &&
-           sdata->vif.type != NL80211_IFTYPE_MESH_POINT)
+           sdata->vif.type != NL80211_IFTYPE_MESH_POINT &&
+           (sdata->vif.type != NL80211_IFTYPE_AP || sdata->u.ap.beacon))
                return -EOPNOTSUPP;
 
        return ieee80211_request_scan(sdata, req);
@@ -1267,25 +1263,62 @@ static int ieee80211_assoc(struct wiphy *wiphy, struct net_device *dev,
 static int ieee80211_deauth(struct wiphy *wiphy, struct net_device *dev,
                            struct cfg80211_deauth_request *req)
 {
-       struct ieee80211_sub_if_data *sdata;
-
-       sdata = IEEE80211_DEV_TO_SUB_IF(dev);
+       struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
 
-       /* TODO: req->ie */
+       /* TODO: req->ie, req->peer_addr */
        return ieee80211_sta_deauthenticate(sdata, req->reason_code);
 }
 
 static int ieee80211_disassoc(struct wiphy *wiphy, struct net_device *dev,
                              struct cfg80211_disassoc_request *req)
 {
-       struct ieee80211_sub_if_data *sdata;
-
-       sdata = IEEE80211_DEV_TO_SUB_IF(dev);
+       struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
 
-       /* TODO: req->ie */
+       /* TODO: req->ie, req->peer_addr */
        return ieee80211_sta_disassociate(sdata, req->reason_code);
 }
 
+static int ieee80211_join_ibss(struct wiphy *wiphy, struct net_device *dev,
+                              struct cfg80211_ibss_params *params)
+{
+       struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
+
+       return ieee80211_ibss_join(sdata, params);
+}
+
+static int ieee80211_leave_ibss(struct wiphy *wiphy, struct net_device *dev)
+{
+       struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
+
+       return ieee80211_ibss_leave(sdata);
+}
+
+static int ieee80211_set_wiphy_params(struct wiphy *wiphy, u32 changed)
+{
+       struct ieee80211_local *local = wiphy_priv(wiphy);
+
+       if (changed & WIPHY_PARAM_RTS_THRESHOLD) {
+               int err;
+
+               if (local->ops->set_rts_threshold) {
+                       err = local->ops->set_rts_threshold(
+                               local_to_hw(local), wiphy->rts_threshold);
+                       if (err)
+                               return err;
+               }
+       }
+
+       if (changed & WIPHY_PARAM_RETRY_SHORT)
+               local->hw.conf.short_frame_max_tx_count = wiphy->retry_short;
+       if (changed & WIPHY_PARAM_RETRY_LONG)
+               local->hw.conf.long_frame_max_tx_count = wiphy->retry_long;
+       if (changed &
+           (WIPHY_PARAM_RETRY_SHORT | WIPHY_PARAM_RETRY_LONG))
+               ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_RETRY_LIMITS);
+
+       return 0;
+}
+
 struct cfg80211_ops mac80211_config_ops = {
        .add_virtual_intf = ieee80211_add_iface,
        .del_virtual_intf = ieee80211_del_iface,
@@ -1322,4 +1355,7 @@ struct cfg80211_ops mac80211_config_ops = {
        .assoc = ieee80211_assoc,
        .deauth = ieee80211_deauth,
        .disassoc = ieee80211_disassoc,
+       .join_ibss = ieee80211_join_ibss,
+       .leave_ibss = ieee80211_leave_ibss,
+       .set_wiphy_params = ieee80211_set_wiphy_params,
 };