From 471b3efdfccc257591331724145f8ccf8b3217e1 Mon Sep 17 00:00:00 2001 From: Johannes Berg Date: Fri, 28 Dec 2007 14:32:58 +0100 Subject: mac80211: add unified BSS configuration This patch (based on Ron Rindjunsky's) creates a framework for a unified way to pass BSS configuration to drivers that require the information, e.g. for implementing power save mode. This patch introduces new ieee80211_bss_conf structure that is passed to the driver via the new bss_info_changed() callback when the BSS configuration changes. This new BSS configuration infrastructure adds the following new features: * drivers are notified of their association AID * drivers are notified of association status and replaces the erp_ie_changed() callback. The patch also does the relevant driver updates for the latter change. Signed-off-by: Ron Rindjunsky Signed-off-by: Johannes Berg Signed-off-by: John W. Linville --- drivers/net/wireless/iwlwifi/iwl-3945.c | 6 ++---- drivers/net/wireless/iwlwifi/iwl-4965.c | 6 ++---- drivers/net/wireless/iwlwifi/iwl4965-base.c | 24 +++++++++++++++++------- drivers/net/wireless/rt2x00/rt2400pci.c | 2 +- drivers/net/wireless/rt2x00/rt2500pci.c | 2 +- drivers/net/wireless/rt2x00/rt2500usb.c | 2 +- drivers/net/wireless/rt2x00/rt2x00.h | 6 ++++-- drivers/net/wireless/rt2x00/rt2x00dev.c | 13 ++++++++++--- drivers/net/wireless/rt2x00/rt2x00mac.c | 16 ++++++++++------ drivers/net/wireless/rt2x00/rt61pci.c | 2 +- drivers/net/wireless/rt2x00/rt73usb.c | 2 +- drivers/net/wireless/zd1211rw/zd_mac.c | 12 +++++++----- 12 files changed, 57 insertions(+), 36 deletions(-) (limited to 'drivers/net/wireless') diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c index a793cd11f738..77e7202c026b 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945.c +++ b/drivers/net/wireless/iwlwifi/iwl-3945.c @@ -520,10 +520,8 @@ static void iwl3945_rx_reply_rx(struct iwl3945_priv *priv, break; /* - * TODO: There is no callback function from upper - * stack to inform us when associated status. this - * work around to sniff assoc_resp management frame - * and finish the association process. + * TODO: Use the new callback function from + * mac80211 instead of sniffing these packets. */ case IEEE80211_STYPE_ASSOC_RESP: case IEEE80211_STYPE_REASSOC_RESP:{ diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c index 89e2c44bfcca..ed3f119b56cd 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965.c +++ b/drivers/net/wireless/iwlwifi/iwl-4965.c @@ -4095,10 +4095,8 @@ static void iwl4965_rx_reply_rx(struct iwl4965_priv *priv, break; /* - * TODO: There is no callback function from upper - * stack to inform us when associated status. this - * work around to sniff assoc_resp management frame - * and finish the association process. + * TODO: Use the new callback function from + * mac80211 instead of sniffing these packets. */ case IEEE80211_STYPE_ASSOC_RESP: case IEEE80211_STYPE_REASSOC_RESP: diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c index 92bb7e13a1f0..2597c08a2395 100644 --- a/drivers/net/wireless/iwlwifi/iwl4965-base.c +++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c @@ -7764,25 +7764,35 @@ static void iwl4965_mac_remove_interface(struct ieee80211_hw *hw, IWL_DEBUG_MAC80211("leave\n"); } -static void iwl4965_mac_erp_ie_changed(struct ieee80211_hw *hw, - u8 changes, int cts_protection, int preamble) + +static void iwl4965_bss_info_changed(struct ieee80211_hw *hw, + struct ieee80211_vif *vif, + struct ieee80211_bss_conf *bss_conf, + u32 changes) { struct iwl4965_priv *priv = hw->priv; - if (changes & IEEE80211_ERP_CHANGE_PREAMBLE) { - if (preamble == WLAN_ERP_PREAMBLE_SHORT) + if (changes & BSS_CHANGED_ERP_PREAMBLE) { + if (bss_conf->use_short_preamble) priv->staging_rxon.flags |= RXON_FLG_SHORT_PREAMBLE_MSK; else priv->staging_rxon.flags &= ~RXON_FLG_SHORT_PREAMBLE_MSK; } - if (changes & IEEE80211_ERP_CHANGE_PROTECTION) { - if (cts_protection && (priv->phymode != MODE_IEEE80211A)) + if (changes & BSS_CHANGED_ERP_CTS_PROT) { + if (bss_conf->use_cts_prot && (priv->phymode != MODE_IEEE80211A)) priv->staging_rxon.flags |= RXON_FLG_TGG_PROTECT_MSK; else priv->staging_rxon.flags &= ~RXON_FLG_TGG_PROTECT_MSK; } + if (changes & BSS_CHANGED_ASSOC) { + /* + * TODO: + * do stuff instead of sniffing assoc resp + */ + } + if (iwl4965_is_associated(priv)) iwl4965_send_rxon_assoc(priv); } @@ -8952,7 +8962,7 @@ static struct ieee80211_ops iwl4965_hw_ops = { .get_tsf = iwl4965_mac_get_tsf, .reset_tsf = iwl4965_mac_reset_tsf, .beacon_update = iwl4965_mac_beacon_update, - .erp_ie_changed = iwl4965_mac_erp_ie_changed, + .bss_info_changed = iwl4965_bss_info_changed, #ifdef CONFIG_IWL4965_HT .conf_ht = iwl4965_mac_conf_ht, .ampdu_action = iwl4965_mac_ampdu_action, diff --git a/drivers/net/wireless/rt2x00/rt2400pci.c b/drivers/net/wireless/rt2x00/rt2400pci.c index f4d0c779ac78..d6cba138c7ab 100644 --- a/drivers/net/wireless/rt2x00/rt2400pci.c +++ b/drivers/net/wireless/rt2x00/rt2400pci.c @@ -1524,7 +1524,7 @@ static const struct ieee80211_ops rt2400pci_mac80211_ops = { .configure_filter = rt2400pci_configure_filter, .get_stats = rt2x00mac_get_stats, .set_retry_limit = rt2400pci_set_retry_limit, - .erp_ie_changed = rt2x00mac_erp_ie_changed, + .bss_info_changed = rt2x00mac_bss_info_changed, .conf_tx = rt2400pci_conf_tx, .get_tx_stats = rt2x00mac_get_tx_stats, .get_tsf = rt2400pci_get_tsf, diff --git a/drivers/net/wireless/rt2x00/rt2500pci.c b/drivers/net/wireless/rt2x00/rt2500pci.c index 206b50ff831f..e874fdcae204 100644 --- a/drivers/net/wireless/rt2x00/rt2500pci.c +++ b/drivers/net/wireless/rt2x00/rt2500pci.c @@ -1835,7 +1835,7 @@ static const struct ieee80211_ops rt2500pci_mac80211_ops = { .configure_filter = rt2500pci_configure_filter, .get_stats = rt2x00mac_get_stats, .set_retry_limit = rt2500pci_set_retry_limit, - .erp_ie_changed = rt2x00mac_erp_ie_changed, + .bss_info_changed = rt2x00mac_bss_info_changed, .conf_tx = rt2x00mac_conf_tx, .get_tx_stats = rt2x00mac_get_tx_stats, .get_tsf = rt2500pci_get_tsf, diff --git a/drivers/net/wireless/rt2x00/rt2500usb.c b/drivers/net/wireless/rt2x00/rt2500usb.c index 6579718f36ad..1933113d7baf 100644 --- a/drivers/net/wireless/rt2x00/rt2500usb.c +++ b/drivers/net/wireless/rt2x00/rt2500usb.c @@ -1776,7 +1776,7 @@ static const struct ieee80211_ops rt2500usb_mac80211_ops = { .config_interface = rt2x00mac_config_interface, .configure_filter = rt2500usb_configure_filter, .get_stats = rt2x00mac_get_stats, - .erp_ie_changed = rt2x00mac_erp_ie_changed, + .bss_info_changed = rt2x00mac_bss_info_changed, .conf_tx = rt2x00mac_conf_tx, .get_tx_stats = rt2x00mac_get_tx_stats, .beacon_update = rt2500usb_beacon_update, diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h index 94a8a7ce5382..05927b908f80 100644 --- a/drivers/net/wireless/rt2x00/rt2x00.h +++ b/drivers/net/wireless/rt2x00/rt2x00.h @@ -936,8 +936,10 @@ int rt2x00mac_get_stats(struct ieee80211_hw *hw, struct ieee80211_low_level_stats *stats); int rt2x00mac_get_tx_stats(struct ieee80211_hw *hw, struct ieee80211_tx_queue_stats *stats); -void rt2x00mac_erp_ie_changed(struct ieee80211_hw *hw, u8 changes, - int cts_protection, int preamble); +void rt2x00mac_bss_info_changed(struct ieee80211_hw *hw, + struct ieee80211_vif *vif, + struct ieee80211_bss_conf *bss_conf, + u32 changes); int rt2x00mac_conf_tx(struct ieee80211_hw *hw, int queue, const struct ieee80211_tx_queue_params *params); diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c index b26c634f210b..72cfe6f866f8 100644 --- a/drivers/net/wireless/rt2x00/rt2x00dev.c +++ b/drivers/net/wireless/rt2x00/rt2x00dev.c @@ -481,10 +481,17 @@ static void rt2x00lib_configuration_scheduled(struct work_struct *work) { struct rt2x00_dev *rt2x00dev = container_of(work, struct rt2x00_dev, config_work); - int preamble = !test_bit(CONFIG_SHORT_PREAMBLE, &rt2x00dev->flags); + struct ieee80211_bss_conf bss_conf; - rt2x00mac_erp_ie_changed(rt2x00dev->hw, - IEEE80211_ERP_CHANGE_PREAMBLE, 0, preamble); + bss_conf.use_short_preamble = + test_bit(CONFIG_SHORT_PREAMBLE, &rt2x00dev->flags); + + /* + * FIXME: shouldn't invoke it this way because all other contents + * of bss_conf is invalid. + */ + rt2x00mac_bss_info_changed(rt2x00dev->hw, rt2x00dev->interface.id, + &bss_conf, BSS_CHANGED_ERP_PREAMBLE); } /* diff --git a/drivers/net/wireless/rt2x00/rt2x00mac.c b/drivers/net/wireless/rt2x00/rt2x00mac.c index 1d67bcd46bcb..e3f15e518c76 100644 --- a/drivers/net/wireless/rt2x00/rt2x00mac.c +++ b/drivers/net/wireless/rt2x00/rt2x00mac.c @@ -342,23 +342,27 @@ int rt2x00mac_get_tx_stats(struct ieee80211_hw *hw, } EXPORT_SYMBOL_GPL(rt2x00mac_get_tx_stats); -void rt2x00mac_erp_ie_changed(struct ieee80211_hw *hw, u8 changes, - int cts_protection, int preamble) +void rt2x00mac_bss_info_changed(struct ieee80211_hw *hw, + struct ieee80211_vif *vif, + struct ieee80211_bss_conf *bss_conf, + u32 changes) { struct rt2x00_dev *rt2x00dev = hw->priv; int short_preamble; int ack_timeout; int ack_consume_time; int difs; + int preamble; /* * We only support changing preamble mode. */ - if (!(changes & IEEE80211_ERP_CHANGE_PREAMBLE)) + if (!(changes & BSS_CHANGED_ERP_PREAMBLE)) return; - short_preamble = !preamble; - preamble = !!(preamble) ? PREAMBLE : SHORT_PREAMBLE; + short_preamble = bss_conf->use_short_preamble; + preamble = bss_conf->use_short_preamble ? + SHORT_PREAMBLE : PREAMBLE; difs = (hw->conf.flags & IEEE80211_CONF_SHORT_SLOT_TIME) ? SHORT_DIFS : DIFS; @@ -374,7 +378,7 @@ void rt2x00mac_erp_ie_changed(struct ieee80211_hw *hw, u8 changes, rt2x00dev->ops->lib->config_preamble(rt2x00dev, short_preamble, ack_timeout, ack_consume_time); } -EXPORT_SYMBOL_GPL(rt2x00mac_erp_ie_changed); +EXPORT_SYMBOL_GPL(rt2x00mac_bss_info_changed); int rt2x00mac_conf_tx(struct ieee80211_hw *hw, int queue, const struct ieee80211_tx_queue_params *params) diff --git a/drivers/net/wireless/rt2x00/rt61pci.c b/drivers/net/wireless/rt2x00/rt61pci.c index 88d169800886..ab52f221cd71 100644 --- a/drivers/net/wireless/rt2x00/rt61pci.c +++ b/drivers/net/wireless/rt2x00/rt61pci.c @@ -2441,7 +2441,7 @@ static const struct ieee80211_ops rt61pci_mac80211_ops = { .configure_filter = rt61pci_configure_filter, .get_stats = rt2x00mac_get_stats, .set_retry_limit = rt61pci_set_retry_limit, - .erp_ie_changed = rt2x00mac_erp_ie_changed, + .bss_info_changed = rt2x00mac_bss_info_changed, .conf_tx = rt2x00mac_conf_tx, .get_tx_stats = rt2x00mac_get_tx_stats, .get_tsf = rt61pci_get_tsf, diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c index 47ed3070ae0b..f9518764aeb0 100644 --- a/drivers/net/wireless/rt2x00/rt73usb.c +++ b/drivers/net/wireless/rt2x00/rt73usb.c @@ -2024,7 +2024,7 @@ static const struct ieee80211_ops rt73usb_mac80211_ops = { .configure_filter = rt73usb_configure_filter, .get_stats = rt2x00mac_get_stats, .set_retry_limit = rt73usb_set_retry_limit, - .erp_ie_changed = rt2x00mac_erp_ie_changed, + .bss_info_changed = rt2x00mac_bss_info_changed, .conf_tx = rt2x00mac_conf_tx, .get_tx_stats = rt2x00mac_get_tx_stats, .get_tsf = rt73usb_get_tsf, diff --git a/drivers/net/wireless/zd1211rw/zd_mac.c b/drivers/net/wireless/zd1211rw/zd_mac.c index 3409cf97f5f8..49127e4b42c2 100644 --- a/drivers/net/wireless/zd1211rw/zd_mac.c +++ b/drivers/net/wireless/zd1211rw/zd_mac.c @@ -849,17 +849,19 @@ static void set_rts_cts_work(struct work_struct *work) mutex_unlock(&mac->chip.mutex); } -static void zd_op_erp_ie_changed(struct ieee80211_hw *hw, u8 changes, - int cts_protection, int preamble) +static void zd_op_bss_info_changed(struct ieee80211_hw *hw, + struct ieee80211_vif *vif, + struct ieee80211_bss_conf *bss_conf, + u32 changes) { struct zd_mac *mac = zd_hw_mac(hw); unsigned long flags; dev_dbg_f(zd_mac_dev(mac), "changes: %x\n", changes); - if (changes & IEEE80211_ERP_CHANGE_PREAMBLE) { + if (changes & BSS_CHANGED_ERP_PREAMBLE) { spin_lock_irqsave(&mac->lock, flags); - mac->short_preamble = !preamble; + mac->short_preamble = bss_conf->use_short_preamble; if (!mac->updating_rts_rate) { mac->updating_rts_rate = 1; /* FIXME: should disable TX here, until work has @@ -879,7 +881,7 @@ static const struct ieee80211_ops zd_ops = { .config = zd_op_config, .config_interface = zd_op_config_interface, .configure_filter = zd_op_configure_filter, - .erp_ie_changed = zd_op_erp_ie_changed, + .bss_info_changed = zd_op_bss_info_changed, }; struct ieee80211_hw *zd_mac_alloc_hw(struct usb_interface *intf) -- cgit v1.2.3