cfg80211: restructure AP/GO mode API
Johannes Berg
maintainerPATCH 1/1 cfg80211: restructure AP/GO mode API
From: Johannes Berg <[email protected]>
The AP/GO mode API isn't very clearly defined, it has "set beacon" and "new beacon" etc.
Modify the API to the following:
* start AP -- all settings
* change beacon -- new beacon data
* stop AP -- stop AP mode operation
This also reflects in the nl80211 API, rename the commands there correspondingly (but keep the old names for compatibility.)
Overall, this makes it much clearer what's going on in the API.
Kalle developed the ath6kl changes, I created the rest of the patch.
Signed-off-by Kalle Valo <[email protected]>
Signed-off-by Johannes Berg <[email protected]>
--- drivers/net/wireless/ath/ath6kl/cfg80211.c | 82 +++++---- include/linux/nl80211.h | 34 ++- include/net/cfg80211.h | 70 ++++--- net/mac80211/cfg.c | 146 ++++++---------- net/mac80211/ieee80211_i.h | 2 net/mac80211/tx.c | 13 - net/wireless/nl80211.c | 255 ++++++++++++++++------------- 7 files changed, 316 insertions(+), 286 deletions(-)
include/net/cfg80211.h +40 -30
@@ -366,25 +366,13 @@ struct cfg80211_crypto_settings { };/** -* struct beacon_parameters - beacon parameters -* -* Used to configure the beacon for an interface. -* +* struct cfg80211_beacon_data - beacon data * @head: head portion of beacon (before TIM IE) * or %NULL if not changed * @tail: tail portion of beacon (after TIM IE) * or %NULL if not changed -* @interval: beacon interval or zero if not changed -* @dtim_period: DTIM period or zero if not changed * @head_len: length of @head * @tail_len: length of @tail -* @ssid: SSID to be used in the BSS (note: may be %NULL if not provided from -* user space) -* @ssid_len: length of @ssid -* @hidden_ssid: whether to hide the SSID in Beacon/Probe Response frames -* @crypto: crypto settings -* @privacy: the BSS uses privacy -* @auth_type: Authentication type (algorithm) * @beacon_ies: extra information element(s) to add into Beacon frames or %NULL * @beacon_ies_len: length of beacon_ies in octets * @proberesp_ies: extra information element(s) to add into Probe Response
@@ -396,24 +384,46 @@ struct cfg80211_crypto_settings {* @probe_resp_len: length of probe response template (@probe_resp) * @probe_resp: probe response template (AP mode only) */ -struct beacon_parameters { -u8 *head, *tail; -int interval, dtim_period; -int head_len, tail_len; +struct cfg80211_beacon_data { +const u8 *head, *tail; +const u8 *beacon_ies; +const u8 *proberesp_ies; +const u8 *assocresp_ies; +const u8 *probe_resp; + +size_t head_len, tail_len; +size_t beacon_ies_len; +size_t proberesp_ies_len; +size_t assocresp_ies_len; +size_t probe_resp_len; +}; + +/** +* struct cfg80211_ap_settings - AP configuration +* +* Used to configure an AP interface. +* +* @beacon: beacon data +* @beacon_interval: beacon interval +* @dtim_period: DTIM period +* @ssid: SSID to be used in the BSS (note: may be %NULL if not provided from +* user space) +* @ssid_len: length of @ssid +* @hidden_ssid: whether to hide the SSID in Beacon/Probe Response frames +* @crypto: crypto settings +* @privacy: the BSS uses privacy +* @auth_type: Authentication type (algorithm) +*/ +struct cfg80211_ap_settings { +struct cfg80211_beacon_data beacon; + +int beacon_interval, dtim_period;const u8 *ssid;size_t ssid_len;enum nl80211_hidden_ssid hidden_ssid;struct cfg80211_crypto_settings crypto;bool privacy;enum nl80211_auth_type auth_type; -const u8 *beacon_ies; -size_t beacon_ies_len; -const u8 *proberesp_ies; -size_t proberesp_ies_len; -const u8 *assocresp_ies; -size_t assocresp_ies_len; -int probe_resp_len; -u8 *probe_resp; };/**
@@ -1518,11 +1528,11 @@ struct cfg80211_ops {struct net_device *netdev, u8 key_index); -int (*add_beacon)(struct wiphy *wiphy,struct net_device *dev, -struct beacon_parameters *info); -int (*set_beacon)(struct wiphy *wiphy,struct net_device *dev, -struct beacon_parameters *info); -int (*del_beacon)(struct wiphy *wiphy,struct net_device *dev); +int (*start_ap)(struct wiphy *wiphy,struct net_device *dev, +struct cfg80211_ap_settings *settings); +int (*change_beacon)(struct wiphy *wiphy,struct net_device *dev, +struct cfg80211_beacon_data *info); +int (*stop_ap)(struct wiphy *wiphy,struct net_device *dev); int (*add_station)(struct wiphy *wiphy, struct net_device *dev,
include/linux/nl80211.h +19 -15
@@ -156,21 +156,23 @@* @NL80211_CMD_DEL_KEY: delete a key identified by %NL80211_ATTR_KEY_IDX * or %NL80211_ATTR_MAC. * -* @NL80211_CMD_GET_BEACON: retrieve beacon information (returned in a -* %NL80222_CMD_NEW_BEACON message) -* @NL80211_CMD_SET_BEACON: set the beacon on an access point interface -* using the %NL80211_ATTR_BEACON_INTERVAL, %NL80211_ATTR_DTIM_PERIOD, -* %NL80211_ATTR_BEACON_HEAD and %NL80211_ATTR_BEACON_TAIL attributes. -* Following attributes are provided for drivers that generate full Beacon -* and Probe Response frames internally: %NL80211_ATTR_SSID, +* @NL80211_CMD_GET_BEACON: (not used) +* @NL80211_CMD_SET_BEACON: change the beacon on an access point interface +* using the %NL80211_ATTR_BEACON_HEAD and %NL80211_ATTR_BEACON_TAIL +* attributes. For drivers that generate the beacon and probe responses +* internally, the following attributes must be provided: %NL80211_ATTR_IE, +* %NL80211_ATTR_IE_PROBE_RESP and %NL80211_ATTR_IE_ASSOC_RESP. +* @NL80211_CMD_START_AP: Start AP operation on an AP interface, parameters +* are like for %NL80211_CMD_SET_BEACON, and additionally parameters that +* do not change are used, these include %NL80211_ATTR_BEACON_INTERVAL, +* %NL80211_ATTR_DTIM_PERIOD, %NL80211_ATTR_SSID, * %NL80211_ATTR_HIDDEN_SSID, %NL80211_ATTR_CIPHERS_PAIRWISE, * %NL80211_ATTR_CIPHER_GROUP, %NL80211_ATTR_WPA_VERSIONS, -* %NL80211_ATTR_AKM_SUITES, %NL80211_ATTR_PRIVACY, -* %NL80211_ATTR_AUTH_TYPE, %NL80211_ATTR_IE, %NL80211_ATTR_IE_PROBE_RESP, -* %NL80211_ATTR_IE_ASSOC_RESP. -* @NL80211_CMD_NEW_BEACON: add a new beacon to an access point interface, -* parameters are like for %NL80211_CMD_SET_BEACON. -* @NL80211_CMD_DEL_BEACON: remove the beacon, stop sending it +* %NL80211_ATTR_AKM_SUITES, %NL80211_ATTR_PRIVACY and +* %NL80211_ATTR_AUTH_TYPE. +* @NL80211_CMD_NEW_BEACON: old alias for %NL80211_CMD_START_AP +* @NL80211_CMD_STOP_AP: Stop AP operation on the given interface +* @NL80211_CMD_DEL_BEACON: old alias for %NL80211_CMD_STOP_AP * * @NL80211_CMD_GET_STATION: Get station attributes for station identified by * %NL80211_ATTR_MAC on the interface identified by %NL80211_ATTR_IFINDEX.
@@ -565,8 +567,10 @@ enum nl80211_commands {NL80211_CMD_GET_BEACON ,NL80211_CMD_SET_BEACON , -NL80211_CMD_NEW_BEACON , -NL80211_CMD_DEL_BEACON , +NL80211_CMD_START_AP , +NL80211_CMD_NEW_BEACON =NL80211_CMD_START_AP , +NL80211_CMD_STOP_AP , +NL80211_CMD_DEL_BEACON =NL80211_CMD_STOP_AP ,NL80211_CMD_GET_STATION , NL80211_CMD_SET_STATION,
net/wireless/nl80211.c +142 -113
336 lines not on this page · raw message
net/mac80211/cfg.c +59 -87
237 lines not on this page · raw message
net/mac80211/ieee80211_i.h +1 -1
@@ -228,7 +228,7 @@ struct ieee80211_rx_data {struct beacon_data {u8 *head, *tail;int head_len, tail_len; -int dtim_period; +struct rcu_head rcu_head; };struct ieee80211_if_ap {
net/mac80211/tx.c +8 -5
@@ -2206,7 +2206,8 @@ void ieee80211_tx_pending(unsigned long/* functions for drivers to get certain frames */ -static void ieee80211_beacon_add_tim (struct ieee80211_if_ap *bss, +static void ieee80211_beacon_add_tim (struct ieee80211_sub_if_data *sdata, +struct ieee80211_if_ap *bss,struct sk_buff *skb,struct beacon_data *beacon) {
@@ -2223,7 +2224,7 @@ static void ieee80211_beacon_add_tim(str IEEE80211_MAX_AID+1);if (bss->dtim_count ==0 ) - bss->dtim_count = beacon->dtim_period -1 ; + bss->dtim_count = sdata->vif.bss_conf.dtim_period -1 ;else bss->dtim_count--;
@@ -2231,7 +2232,7 @@ static void ieee80211_beacon_add_tim(str *pos++ =WLAN_EID_TIM ; *pos++ =4 ; *pos++ = bss->dtim_count; - *pos++ = beacon->dtim_period; + *pos++ = sdata->vif.bss_conf.dtim_period;if (bss->dtim_count ==0 && !skb_queue_empty (&bss->ps_bc_buf)) aid0 =1 ;
@@ -2324,12 +2325,14 @@ struct sk_buff *ieee80211_beacon_get_tim* of the tim bitmap in mac80211 and the driver. */ if (local->tim_in_locked_section) { -ieee80211_beacon_add_tim (ap, skb, beacon); +ieee80211_beacon_add_tim (sdata, ap, skb, + beacon); }else {unsigned long flags;spin_lock_irqsave (&local->tim_lock, flags); -ieee80211_beacon_add_tim (ap, skb, beacon); +ieee80211_beacon_add_tim (sdata, ap, skb, + beacon);spin_unlock_irqrestore (&local->tim_lock, flags); }
drivers/net/wireless/ath/ath6kl/cfg80211.c +47 -35
133 lines not on this page · raw message