Skip to content

Commit

Permalink
iwl3945: use iwl_mac_reset_tsf from iwlwifi
Browse files Browse the repository at this point in the history
3945 can now use iwl_mac_reset_tsf from iwlwifi.

Signed-off-by: Abhijeet Kolekar <abhijeet.kolekar@intel.com>
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
  • Loading branch information
Abhijeet Kolekar authored and John W. Linville committed Apr 22, 2009
1 parent aa89f31 commit bd56426
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 134 deletions.
75 changes: 0 additions & 75 deletions drivers/net/wireless/iwlwifi/iwl-agn.c
Original file line number Diff line number Diff line change
Expand Up @@ -2235,81 +2235,6 @@ static int iwl_mac_get_stats(struct ieee80211_hw *hw,
return 0;
}

static void iwl_mac_reset_tsf(struct ieee80211_hw *hw)
{
struct iwl_priv *priv = hw->priv;
unsigned long flags;

mutex_lock(&priv->mutex);
IWL_DEBUG_MAC80211(priv, "enter\n");

spin_lock_irqsave(&priv->lock, flags);
memset(&priv->current_ht_config, 0, sizeof(struct iwl_ht_info));
spin_unlock_irqrestore(&priv->lock, flags);

iwl_reset_qos(priv);

spin_lock_irqsave(&priv->lock, flags);
priv->assoc_id = 0;
priv->assoc_capability = 0;
priv->assoc_station_added = 0;

/* new association get rid of ibss beacon skb */
if (priv->ibss_beacon)
dev_kfree_skb(priv->ibss_beacon);

priv->ibss_beacon = NULL;

priv->beacon_int = priv->hw->conf.beacon_int;
priv->timestamp = 0;
if ((priv->iw_mode == NL80211_IFTYPE_STATION))
priv->beacon_int = 0;

spin_unlock_irqrestore(&priv->lock, flags);

if (!iwl_is_ready_rf(priv)) {
IWL_DEBUG_MAC80211(priv, "leave - not ready\n");
mutex_unlock(&priv->mutex);
return;
}

/* we are restarting association process
* clear RXON_FILTER_ASSOC_MSK bit
*/
if (priv->iw_mode != NL80211_IFTYPE_AP) {
iwl_scan_cancel_timeout(priv, 100);
priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
iwlcore_commit_rxon(priv);
}

iwl_power_update_mode(priv, 0);

/* Per mac80211.h: This is only used in IBSS mode... */
if (priv->iw_mode != NL80211_IFTYPE_ADHOC) {

/* switch to CAM during association period.
* the ucode will block any association/authentication
* frome during assiciation period if it can not hear
* the AP because of PM. the timer enable PM back is
* association do not complete
*/
if (priv->hw->conf.channel->flags & (IEEE80211_CHAN_PASSIVE_SCAN |
IEEE80211_CHAN_RADAR))
iwl_power_disable_management(priv, 3000);

IWL_DEBUG_MAC80211(priv, "leave - not in IBSS\n");
mutex_unlock(&priv->mutex);
return;
}

iwl_set_rate(priv);

mutex_unlock(&priv->mutex);

IWL_DEBUG_MAC80211(priv, "leave\n");
}


/*****************************************************************************
*
* sysfs attributes
Expand Down
75 changes: 75 additions & 0 deletions drivers/net/wireless/iwlwifi/iwl-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -2715,6 +2715,81 @@ int iwl_mac_get_tx_stats(struct ieee80211_hw *hw,
}
EXPORT_SYMBOL(iwl_mac_get_tx_stats);

void iwl_mac_reset_tsf(struct ieee80211_hw *hw)
{
struct iwl_priv *priv = hw->priv;
unsigned long flags;

mutex_lock(&priv->mutex);
IWL_DEBUG_MAC80211(priv, "enter\n");

spin_lock_irqsave(&priv->lock, flags);
memset(&priv->current_ht_config, 0, sizeof(struct iwl_ht_info));
spin_unlock_irqrestore(&priv->lock, flags);

iwl_reset_qos(priv);

spin_lock_irqsave(&priv->lock, flags);
priv->assoc_id = 0;
priv->assoc_capability = 0;
priv->assoc_station_added = 0;

/* new association get rid of ibss beacon skb */
if (priv->ibss_beacon)
dev_kfree_skb(priv->ibss_beacon);

priv->ibss_beacon = NULL;

priv->beacon_int = priv->hw->conf.beacon_int;
priv->timestamp = 0;
if ((priv->iw_mode == NL80211_IFTYPE_STATION))
priv->beacon_int = 0;

spin_unlock_irqrestore(&priv->lock, flags);

if (!iwl_is_ready_rf(priv)) {
IWL_DEBUG_MAC80211(priv, "leave - not ready\n");
mutex_unlock(&priv->mutex);
return;
}

/* we are restarting association process
* clear RXON_FILTER_ASSOC_MSK bit
*/
if (priv->iw_mode != NL80211_IFTYPE_AP) {
iwl_scan_cancel_timeout(priv, 100);
priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
iwlcore_commit_rxon(priv);
}

iwl_power_update_mode(priv, 0);

/* Per mac80211.h: This is only used in IBSS mode... */
if (priv->iw_mode != NL80211_IFTYPE_ADHOC) {

/* switch to CAM during association period.
* the ucode will block any association/authentication
* frome during assiciation period if it can not hear
* the AP because of PM. the timer enable PM back is
* association do not complete
*/
if (priv->hw->conf.channel->flags &
(IEEE80211_CHAN_PASSIVE_SCAN | IEEE80211_CHAN_RADAR))
iwl_power_disable_management(priv, 3000);

IWL_DEBUG_MAC80211(priv, "leave - not in IBSS\n");
mutex_unlock(&priv->mutex);
return;
}

iwl_set_rate(priv);

mutex_unlock(&priv->mutex);

IWL_DEBUG_MAC80211(priv, "leave\n");
}
EXPORT_SYMBOL(iwl_mac_reset_tsf);

#ifdef CONFIG_PM

int iwl_pci_suspend(struct pci_dev *pdev, pm_message_t state)
Expand Down
1 change: 1 addition & 0 deletions drivers/net/wireless/iwlwifi/iwl-core.h
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ int iwl_mac_config_interface(struct ieee80211_hw *hw,
struct ieee80211_if_conf *conf);
int iwl_mac_get_tx_stats(struct ieee80211_hw *hw,
struct ieee80211_tx_queue_stats *stats);
void iwl_mac_reset_tsf(struct ieee80211_hw *hw);

/*****************************************************
* RX handlers.
Expand Down
60 changes: 1 addition & 59 deletions drivers/net/wireless/iwlwifi/iwl3945-base.c
Original file line number Diff line number Diff line change
Expand Up @@ -3494,64 +3494,6 @@ static int iwl3945_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
return ret;
}

static void iwl3945_mac_reset_tsf(struct ieee80211_hw *hw)
{
struct iwl_priv *priv = hw->priv;
unsigned long flags;

mutex_lock(&priv->mutex);
IWL_DEBUG_MAC80211(priv, "enter\n");

iwl_reset_qos(priv);

spin_lock_irqsave(&priv->lock, flags);
priv->assoc_id = 0;
priv->assoc_capability = 0;

/* new association get rid of ibss beacon skb */
if (priv->ibss_beacon)
dev_kfree_skb(priv->ibss_beacon);

priv->ibss_beacon = NULL;

priv->beacon_int = priv->hw->conf.beacon_int;
priv->timestamp = 0;
if ((priv->iw_mode == NL80211_IFTYPE_STATION))
priv->beacon_int = 0;

spin_unlock_irqrestore(&priv->lock, flags);

if (!iwl_is_ready_rf(priv)) {
IWL_DEBUG_MAC80211(priv, "leave - not ready\n");
mutex_unlock(&priv->mutex);
return;
}

/* we are restarting association process
* clear RXON_FILTER_ASSOC_MSK bit
*/
if (priv->iw_mode != NL80211_IFTYPE_AP) {
iwl_scan_cancel_timeout(priv, 100);
priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
iwlcore_commit_rxon(priv);
}

/* Per mac80211.h: This is only used in IBSS mode... */
if (priv->iw_mode != NL80211_IFTYPE_ADHOC) {

IWL_DEBUG_MAC80211(priv, "leave - not in IBSS\n");
mutex_unlock(&priv->mutex);
return;
}

iwl_set_rate(priv);

mutex_unlock(&priv->mutex);

IWL_DEBUG_MAC80211(priv, "leave\n");

}

/*****************************************************************************
*
* sysfs attributes
Expand Down Expand Up @@ -4083,7 +4025,7 @@ static struct ieee80211_ops iwl3945_hw_ops = {
.set_key = iwl3945_mac_set_key,
.get_tx_stats = iwl_mac_get_tx_stats,
.conf_tx = iwl_mac_conf_tx,
.reset_tsf = iwl3945_mac_reset_tsf,
.reset_tsf = iwl_mac_reset_tsf,
.bss_info_changed = iwl_bss_info_changed,
.hw_scan = iwl_mac_hw_scan
};
Expand Down

0 comments on commit bd56426

Please sign in to comment.