aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKolekar, Abhijeet <abhijeet.kolekar@intel.com>2008-11-07 12:58:44 -0500
committerJohn W. Linville <linville@tuxdriver.com>2008-11-21 11:07:23 -0500
commitc24f0817458464fc9c54489dba19cd94787e5eaf (patch)
treedf62f4c14ffb4ff1c83abc7d5fb465e7b7c763a4
parentcb299bae8929705bf025fdbd6ce0ffcc62f5b3d0 (diff)
iwl3945 : Simplify iwl3945_send_beacon_cmd
Moved rate_msk calculation to iwl3945_rate_get_lowest_plcp. 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>
-rw-r--r--drivers/net/wireless/iwlwifi/iwl3945-base.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index dc4c48983bcf..3344841b7662 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -1418,9 +1418,16 @@ unsigned int iwl3945_fill_beacon_frame(struct iwl3945_priv *priv,
1418 return priv->ibss_beacon->len; 1418 return priv->ibss_beacon->len;
1419} 1419}
1420 1420
1421static u8 iwl3945_rate_get_lowest_plcp(int rate_mask) 1421static u8 iwl3945_rate_get_lowest_plcp(struct iwl3945_priv *priv)
1422{ 1422{
1423 u8 i; 1423 u8 i;
1424 int rate_mask;
1425
1426 /* Set rate mask*/
1427 if (priv->staging_rxon.flags & RXON_FLG_BAND_24G_MSK)
1428 rate_mask = priv->active_rate_basic & 0xF;
1429 else
1430 rate_mask = priv->active_rate_basic & 0xFF0;
1424 1431
1425 for (i = IWL_RATE_1M_INDEX; i != IWL_RATE_INVALID; 1432 for (i = IWL_RATE_1M_INDEX; i != IWL_RATE_INVALID;
1426 i = iwl3945_rates[i].next_ieee) { 1433 i = iwl3945_rates[i].next_ieee) {
@@ -1428,7 +1435,11 @@ static u8 iwl3945_rate_get_lowest_plcp(int rate_mask)
1428 return iwl3945_rates[i].plcp; 1435 return iwl3945_rates[i].plcp;
1429 } 1436 }
1430 1437
1431 return IWL_RATE_INVALID; 1438 /* No valid rate was found. Assign the lowest one */
1439 if (priv->staging_rxon.flags & RXON_FLG_BAND_24G_MSK)
1440 return IWL_RATE_1M_PLCP;
1441 else
1442 return IWL_RATE_6M_PLCP;
1432} 1443}
1433 1444
1434static int iwl3945_send_beacon_cmd(struct iwl3945_priv *priv) 1445static int iwl3945_send_beacon_cmd(struct iwl3945_priv *priv)
@@ -1446,16 +1457,7 @@ static int iwl3945_send_beacon_cmd(struct iwl3945_priv *priv)
1446 return -ENOMEM; 1457 return -ENOMEM;
1447 } 1458 }
1448 1459
1449 if (!(priv->staging_rxon.flags & RXON_FLG_BAND_24G_MSK)) { 1460 rate = iwl3945_rate_get_lowest_plcp(priv);
1450 rate = iwl3945_rate_get_lowest_plcp(priv->active_rate_basic &
1451 0xFF0);
1452 if (rate == IWL_INVALID_RATE)
1453 rate = IWL_RATE_6M_PLCP;
1454 } else {
1455 rate = iwl3945_rate_get_lowest_plcp(priv->active_rate_basic & 0xF);
1456 if (rate == IWL_INVALID_RATE)
1457 rate = IWL_RATE_1M_PLCP;
1458 }
1459 1461
1460 frame_size = iwl3945_hw_get_beacon_cmd(priv, frame, rate); 1462 frame_size = iwl3945_hw_get_beacon_cmd(priv, frame, rate);
1461 1463