diff options
author | Tomas Winkler <tomas.winkler@intel.com> | 2009-06-19 16:52:45 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-07-10 15:01:57 -0400 |
commit | 2c2f3b33888419fb9e7d015b9dc67b9db4437efa (patch) | |
tree | 35b4bb6bd4844ed66ccccf52dffbbed972aa4e9d /drivers/net/wireless/iwlwifi/iwl3945-base.c | |
parent | 4e05c2347a50f1d0892ff3475d7609eec428f781 (diff) |
iwlwifi: unify iwl_setup_rxon_timing
This patch unifies setup_rxon_timing funcions
of AGN and 3945. HWs differ only in supported maximal
beacon interval. This is reflected in hw_paras.max_beacon_itrvl
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl3945-base.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl3945-base.c | 74 |
1 files changed, 2 insertions, 72 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c index 016567f3e88e..303c4b483f5b 100644 --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c | |||
@@ -361,76 +361,6 @@ static void iwl3945_unset_hw_params(struct iwl_priv *priv) | |||
361 | priv->shared_phys); | 361 | priv->shared_phys); |
362 | } | 362 | } |
363 | 363 | ||
364 | #define MAX_UCODE_BEACON_INTERVAL 1024 | ||
365 | #define INTEL_CONN_LISTEN_INTERVAL cpu_to_le16(0xA) | ||
366 | |||
367 | static __le16 iwl3945_adjust_beacon_interval(u16 beacon_val) | ||
368 | { | ||
369 | u16 new_val = 0; | ||
370 | u16 beacon_factor = 0; | ||
371 | |||
372 | beacon_factor = | ||
373 | (beacon_val + MAX_UCODE_BEACON_INTERVAL) | ||
374 | / MAX_UCODE_BEACON_INTERVAL; | ||
375 | new_val = beacon_val / beacon_factor; | ||
376 | |||
377 | return cpu_to_le16(new_val); | ||
378 | } | ||
379 | |||
380 | static void iwl3945_setup_rxon_timing(struct iwl_priv *priv) | ||
381 | { | ||
382 | u64 interval_tm_unit; | ||
383 | u64 tsf, result; | ||
384 | unsigned long flags; | ||
385 | struct ieee80211_conf *conf = NULL; | ||
386 | u16 beacon_int = 0; | ||
387 | |||
388 | conf = ieee80211_get_hw_conf(priv->hw); | ||
389 | |||
390 | spin_lock_irqsave(&priv->lock, flags); | ||
391 | priv->rxon_timing.timestamp = cpu_to_le64(priv->timestamp); | ||
392 | priv->rxon_timing.listen_interval = INTEL_CONN_LISTEN_INTERVAL; | ||
393 | |||
394 | tsf = priv->timestamp; | ||
395 | |||
396 | beacon_int = priv->beacon_int; | ||
397 | spin_unlock_irqrestore(&priv->lock, flags); | ||
398 | |||
399 | if (priv->iw_mode == NL80211_IFTYPE_STATION) { | ||
400 | if (beacon_int == 0) { | ||
401 | priv->rxon_timing.beacon_interval = cpu_to_le16(100); | ||
402 | priv->rxon_timing.beacon_init_val = cpu_to_le32(102400); | ||
403 | } else { | ||
404 | priv->rxon_timing.beacon_interval = | ||
405 | cpu_to_le16(beacon_int); | ||
406 | priv->rxon_timing.beacon_interval = | ||
407 | iwl3945_adjust_beacon_interval( | ||
408 | le16_to_cpu(priv->rxon_timing.beacon_interval)); | ||
409 | } | ||
410 | |||
411 | priv->rxon_timing.atim_window = 0; | ||
412 | } else { | ||
413 | priv->rxon_timing.beacon_interval = | ||
414 | iwl3945_adjust_beacon_interval( | ||
415 | priv->vif->bss_conf.beacon_int); | ||
416 | /* TODO: we need to get atim_window from upper stack | ||
417 | * for now we set to 0 */ | ||
418 | priv->rxon_timing.atim_window = 0; | ||
419 | } | ||
420 | |||
421 | interval_tm_unit = | ||
422 | (le16_to_cpu(priv->rxon_timing.beacon_interval) * 1024); | ||
423 | result = do_div(tsf, interval_tm_unit); | ||
424 | priv->rxon_timing.beacon_init_val = | ||
425 | cpu_to_le32((u32) ((u64) interval_tm_unit - result)); | ||
426 | |||
427 | IWL_DEBUG_ASSOC(priv, | ||
428 | "beacon interval %d beacon timer %d beacon tim %d\n", | ||
429 | le16_to_cpu(priv->rxon_timing.beacon_interval), | ||
430 | le32_to_cpu(priv->rxon_timing.beacon_init_val), | ||
431 | le16_to_cpu(priv->rxon_timing.atim_window)); | ||
432 | } | ||
433 | |||
434 | static void iwl3945_build_tx_cmd_hwcrypto(struct iwl_priv *priv, | 364 | static void iwl3945_build_tx_cmd_hwcrypto(struct iwl_priv *priv, |
435 | struct ieee80211_tx_info *info, | 365 | struct ieee80211_tx_info *info, |
436 | struct iwl_cmd *cmd, | 366 | struct iwl_cmd *cmd, |
@@ -3066,7 +2996,7 @@ void iwl3945_post_associate(struct iwl_priv *priv) | |||
3066 | iwlcore_commit_rxon(priv); | 2996 | iwlcore_commit_rxon(priv); |
3067 | 2997 | ||
3068 | memset(&priv->rxon_timing, 0, sizeof(struct iwl_rxon_time_cmd)); | 2998 | memset(&priv->rxon_timing, 0, sizeof(struct iwl_rxon_time_cmd)); |
3069 | iwl3945_setup_rxon_timing(priv); | 2999 | iwl_setup_rxon_timing(priv); |
3070 | rc = iwl_send_cmd_pdu(priv, REPLY_RXON_TIMING, | 3000 | rc = iwl_send_cmd_pdu(priv, REPLY_RXON_TIMING, |
3071 | sizeof(priv->rxon_timing), &priv->rxon_timing); | 3001 | sizeof(priv->rxon_timing), &priv->rxon_timing); |
3072 | if (rc) | 3002 | if (rc) |
@@ -3261,7 +3191,7 @@ void iwl3945_config_ap(struct iwl_priv *priv) | |||
3261 | 3191 | ||
3262 | /* RXON Timing */ | 3192 | /* RXON Timing */ |
3263 | memset(&priv->rxon_timing, 0, sizeof(struct iwl_rxon_time_cmd)); | 3193 | memset(&priv->rxon_timing, 0, sizeof(struct iwl_rxon_time_cmd)); |
3264 | iwl3945_setup_rxon_timing(priv); | 3194 | iwl_setup_rxon_timing(priv); |
3265 | rc = iwl_send_cmd_pdu(priv, REPLY_RXON_TIMING, | 3195 | rc = iwl_send_cmd_pdu(priv, REPLY_RXON_TIMING, |
3266 | sizeof(priv->rxon_timing), | 3196 | sizeof(priv->rxon_timing), |
3267 | &priv->rxon_timing); | 3197 | &priv->rxon_timing); |