diff options
author | Tomas Winkler <tomas.winkler@intel.com> | 2008-07-18 01:53:03 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-08-04 15:09:07 -0400 |
commit | 4bf64efd26f5610cde4fb7846e2f37bd1f62d3a9 (patch) | |
tree | 00e54951b21ffaf2e1c5f2e1459698cb4065ff3a /drivers/net | |
parent | d783b061077f92af55244aef1df8780b0f46b5af (diff) |
iwlwifi: move beacon handling to iwl4965-base.c
This patch concentrates becaon handling in iwl4965-base.c.
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Zhu Yi <yi.zhu@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-4965.c | 32 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-commands.h | 2 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-dev.h | 3 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl4965-base.c | 39 |
4 files changed, 37 insertions, 39 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c index 3cc6f00d96cd..9ae8525b9b60 100644 --- a/drivers/net/wireless/iwlwifi/iwl-4965.c +++ b/drivers/net/wireless/iwlwifi/iwl-4965.c | |||
@@ -1689,38 +1689,6 @@ static int iwl4965_shared_mem_rx_idx(struct iwl_priv *priv) | |||
1689 | return le32_to_cpu(s->rb_closed) & 0xFFF; | 1689 | return le32_to_cpu(s->rb_closed) & 0xFFF; |
1690 | } | 1690 | } |
1691 | 1691 | ||
1692 | unsigned int iwl4965_hw_get_beacon_cmd(struct iwl_priv *priv, | ||
1693 | struct iwl_frame *frame, u8 rate) | ||
1694 | { | ||
1695 | struct iwl4965_tx_beacon_cmd *tx_beacon_cmd; | ||
1696 | unsigned int frame_size; | ||
1697 | |||
1698 | tx_beacon_cmd = &frame->u.beacon; | ||
1699 | memset(tx_beacon_cmd, 0, sizeof(*tx_beacon_cmd)); | ||
1700 | |||
1701 | tx_beacon_cmd->tx.sta_id = priv->hw_params.bcast_sta_id; | ||
1702 | tx_beacon_cmd->tx.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE; | ||
1703 | |||
1704 | frame_size = iwl4965_fill_beacon_frame(priv, | ||
1705 | tx_beacon_cmd->frame, | ||
1706 | iwl_bcast_addr, | ||
1707 | sizeof(frame->u) - sizeof(*tx_beacon_cmd)); | ||
1708 | |||
1709 | BUG_ON(frame_size > MAX_MPDU_SIZE); | ||
1710 | tx_beacon_cmd->tx.len = cpu_to_le16((u16)frame_size); | ||
1711 | |||
1712 | if ((rate == IWL_RATE_1M_PLCP) || (rate >= IWL_RATE_2M_PLCP)) | ||
1713 | tx_beacon_cmd->tx.rate_n_flags = | ||
1714 | iwl_hw_set_rate_n_flags(rate, RATE_MCS_CCK_MSK); | ||
1715 | else | ||
1716 | tx_beacon_cmd->tx.rate_n_flags = | ||
1717 | iwl_hw_set_rate_n_flags(rate, 0); | ||
1718 | |||
1719 | tx_beacon_cmd->tx.tx_flags = (TX_CMD_FLG_SEQ_CTL_MSK | | ||
1720 | TX_CMD_FLG_TSF_MSK | TX_CMD_FLG_STA_RATE_MSK); | ||
1721 | return (sizeof(*tx_beacon_cmd) + frame_size); | ||
1722 | } | ||
1723 | |||
1724 | static int iwl4965_alloc_shared_mem(struct iwl_priv *priv) | 1692 | static int iwl4965_alloc_shared_mem(struct iwl_priv *priv) |
1725 | { | 1693 | { |
1726 | priv->shared_virt = pci_alloc_consistent(priv->pci_dev, | 1694 | priv->shared_virt = pci_alloc_consistent(priv->pci_dev, |
diff --git a/drivers/net/wireless/iwlwifi/iwl-commands.h b/drivers/net/wireless/iwlwifi/iwl-commands.h index 6f3555ffe527..cd6d668f4e00 100644 --- a/drivers/net/wireless/iwlwifi/iwl-commands.h +++ b/drivers/net/wireless/iwlwifi/iwl-commands.h | |||
@@ -2324,7 +2324,7 @@ struct iwl4965_beacon_notif { | |||
2324 | /* | 2324 | /* |
2325 | * REPLY_TX_BEACON = 0x91 (command, has simple generic response) | 2325 | * REPLY_TX_BEACON = 0x91 (command, has simple generic response) |
2326 | */ | 2326 | */ |
2327 | struct iwl4965_tx_beacon_cmd { | 2327 | struct iwl_tx_beacon_cmd { |
2328 | struct iwl_tx_cmd tx; | 2328 | struct iwl_tx_cmd tx; |
2329 | __le16 tim_idx; | 2329 | __le16 tim_idx; |
2330 | u8 tim_size; | 2330 | u8 tim_size; |
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h index d2d4beab82a0..ff16cca2b8c7 100644 --- a/drivers/net/wireless/iwlwifi/iwl-dev.h +++ b/drivers/net/wireless/iwlwifi/iwl-dev.h | |||
@@ -219,7 +219,7 @@ enum iwl_pwr_src { | |||
219 | struct iwl_frame { | 219 | struct iwl_frame { |
220 | union { | 220 | union { |
221 | struct ieee80211_hdr frame; | 221 | struct ieee80211_hdr frame; |
222 | struct iwl4965_tx_beacon_cmd beacon; | 222 | struct iwl_tx_beacon_cmd beacon; |
223 | u8 raw[IEEE80211_FRAME_LEN]; | 223 | u8 raw[IEEE80211_FRAME_LEN]; |
224 | u8 cmd[360]; | 224 | u8 cmd[360]; |
225 | } u; | 225 | } u; |
@@ -286,7 +286,6 @@ struct iwl_cmd { | |||
286 | struct iwl_powertable_cmd powertable; | 286 | struct iwl_powertable_cmd powertable; |
287 | struct iwl_qosparam_cmd qosparam; | 287 | struct iwl_qosparam_cmd qosparam; |
288 | struct iwl_tx_cmd tx; | 288 | struct iwl_tx_cmd tx; |
289 | struct iwl4965_tx_beacon_cmd tx_beacon; | ||
290 | struct iwl4965_rxon_assoc_cmd rxon_assoc; | 289 | struct iwl4965_rxon_assoc_cmd rxon_assoc; |
291 | struct iwl_rem_sta_cmd rm_sta; | 290 | struct iwl_rem_sta_cmd rm_sta; |
292 | u8 *indirect; | 291 | u8 *indirect; |
diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c index a34280f65c1a..94ce026ba602 100644 --- a/drivers/net/wireless/iwlwifi/iwl4965-base.c +++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c | |||
@@ -444,11 +444,10 @@ static void iwl_free_frame(struct iwl_priv *priv, struct iwl_frame *frame) | |||
444 | list_add(&frame->list, &priv->free_frames); | 444 | list_add(&frame->list, &priv->free_frames); |
445 | } | 445 | } |
446 | 446 | ||
447 | unsigned int iwl4965_fill_beacon_frame(struct iwl_priv *priv, | 447 | static unsigned int iwl_fill_beacon_frame(struct iwl_priv *priv, |
448 | struct ieee80211_hdr *hdr, | 448 | struct ieee80211_hdr *hdr, |
449 | const u8 *dest, int left) | 449 | const u8 *dest, int left) |
450 | { | 450 | { |
451 | |||
452 | if (!iwl_is_associated(priv) || !priv->ibss_beacon || | 451 | if (!iwl_is_associated(priv) || !priv->ibss_beacon || |
453 | ((priv->iw_mode != IEEE80211_IF_TYPE_IBSS) && | 452 | ((priv->iw_mode != IEEE80211_IF_TYPE_IBSS) && |
454 | (priv->iw_mode != IEEE80211_IF_TYPE_AP))) | 453 | (priv->iw_mode != IEEE80211_IF_TYPE_AP))) |
@@ -487,6 +486,38 @@ static u8 iwl4965_rate_get_lowest_plcp(struct iwl_priv *priv) | |||
487 | return IWL_RATE_6M_PLCP; | 486 | return IWL_RATE_6M_PLCP; |
488 | } | 487 | } |
489 | 488 | ||
489 | unsigned int iwl4965_hw_get_beacon_cmd(struct iwl_priv *priv, | ||
490 | struct iwl_frame *frame, u8 rate) | ||
491 | { | ||
492 | struct iwl_tx_beacon_cmd *tx_beacon_cmd; | ||
493 | unsigned int frame_size; | ||
494 | |||
495 | tx_beacon_cmd = &frame->u.beacon; | ||
496 | memset(tx_beacon_cmd, 0, sizeof(*tx_beacon_cmd)); | ||
497 | |||
498 | tx_beacon_cmd->tx.sta_id = priv->hw_params.bcast_sta_id; | ||
499 | tx_beacon_cmd->tx.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE; | ||
500 | |||
501 | frame_size = iwl_fill_beacon_frame(priv, tx_beacon_cmd->frame, | ||
502 | iwl_bcast_addr, | ||
503 | sizeof(frame->u) - sizeof(*tx_beacon_cmd)); | ||
504 | |||
505 | BUG_ON(frame_size > MAX_MPDU_SIZE); | ||
506 | tx_beacon_cmd->tx.len = cpu_to_le16((u16)frame_size); | ||
507 | |||
508 | if ((rate == IWL_RATE_1M_PLCP) || (rate >= IWL_RATE_2M_PLCP)) | ||
509 | tx_beacon_cmd->tx.rate_n_flags = | ||
510 | iwl_hw_set_rate_n_flags(rate, RATE_MCS_CCK_MSK); | ||
511 | else | ||
512 | tx_beacon_cmd->tx.rate_n_flags = | ||
513 | iwl_hw_set_rate_n_flags(rate, 0); | ||
514 | |||
515 | tx_beacon_cmd->tx.tx_flags = TX_CMD_FLG_SEQ_CTL_MSK | | ||
516 | TX_CMD_FLG_TSF_MSK | | ||
517 | TX_CMD_FLG_STA_RATE_MSK; | ||
518 | |||
519 | return sizeof(*tx_beacon_cmd) + frame_size; | ||
520 | } | ||
490 | static int iwl4965_send_beacon_cmd(struct iwl_priv *priv) | 521 | static int iwl4965_send_beacon_cmd(struct iwl_priv *priv) |
491 | { | 522 | { |
492 | struct iwl_frame *frame; | 523 | struct iwl_frame *frame; |