aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl3945-base.c
diff options
context:
space:
mode:
authorTomas Winkler <tomas.winkler@intel.com>2008-05-15 01:54:06 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-05-21 21:47:59 -0400
commit54dbb525e7b8580b86af352cf60b27cc889c2ae4 (patch)
treecd791dd579945e8db57de6328f8cd8933b9760d4 /drivers/net/wireless/iwlwifi/iwl3945-base.c
parent83d527d9e8f9aff92cbd33f208f77c055dabb499 (diff)
iwlwifi: refactor ieee80211_get_qos_ctrl
This patch refactors ieee80211_get_qos_ctrl function and its usage in iwlwifi drivers. Function is moved as inline into iwl-helpers.h. Signed-off-by: Tomas Winkler <tomas.winkler@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.c35
1 files changed, 13 insertions, 22 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index c1234ff4fc98..b8fb8d8d95ff 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -102,16 +102,6 @@ MODULE_VERSION(DRV_VERSION);
102MODULE_AUTHOR(DRV_COPYRIGHT); 102MODULE_AUTHOR(DRV_COPYRIGHT);
103MODULE_LICENSE("GPL"); 103MODULE_LICENSE("GPL");
104 104
105static __le16 *ieee80211_get_qos_ctrl(struct ieee80211_hdr *hdr)
106{
107 u16 fc = le16_to_cpu(hdr->frame_control);
108 int hdr_len = ieee80211_get_hdrlen(fc);
109
110 if ((fc & 0x00cc) == (IEEE80211_STYPE_QOS_DATA | IEEE80211_FTYPE_DATA))
111 return (__le16 *) ((u8 *) hdr + hdr_len - QOS_CONTROL_LEN);
112 return NULL;
113}
114
115static const struct ieee80211_supported_band *iwl3945_get_band( 105static const struct ieee80211_supported_band *iwl3945_get_band(
116 struct iwl3945_priv *priv, enum ieee80211_band band) 106 struct iwl3945_priv *priv, enum ieee80211_band band)
117{ 107{
@@ -2441,7 +2431,6 @@ static void iwl3945_build_tx_cmd_basic(struct iwl3945_priv *priv,
2441 struct ieee80211_hdr *hdr, 2431 struct ieee80211_hdr *hdr,
2442 int is_unicast, u8 std_id) 2432 int is_unicast, u8 std_id)
2443{ 2433{
2444 __le16 *qc;
2445 u16 fc = le16_to_cpu(hdr->frame_control); 2434 u16 fc = le16_to_cpu(hdr->frame_control);
2446 __le32 tx_flags = cmd->cmd.tx.tx_flags; 2435 __le32 tx_flags = cmd->cmd.tx.tx_flags;
2447 2436
@@ -2462,12 +2451,13 @@ static void iwl3945_build_tx_cmd_basic(struct iwl3945_priv *priv,
2462 if (ieee80211_get_morefrag(hdr)) 2451 if (ieee80211_get_morefrag(hdr))
2463 tx_flags |= TX_CMD_FLG_MORE_FRAG_MSK; 2452 tx_flags |= TX_CMD_FLG_MORE_FRAG_MSK;
2464 2453
2465 qc = ieee80211_get_qos_ctrl(hdr); 2454 if (ieee80211_is_qos_data(fc)) {
2466 if (qc) { 2455 u8 *qc = ieee80211_get_qos_ctrl(hdr, ieee80211_get_hdrlen(fc));
2467 cmd->cmd.tx.tid_tspec = (u8) (le16_to_cpu(*qc) & 0xf); 2456 cmd->cmd.tx.tid_tspec = qc[0] & 0xf;
2468 tx_flags &= ~TX_CMD_FLG_SEQ_CTL_MSK; 2457 tx_flags &= ~TX_CMD_FLG_SEQ_CTL_MSK;
2469 } else 2458 } else {
2470 tx_flags |= TX_CMD_FLG_SEQ_CTL_MSK; 2459 tx_flags |= TX_CMD_FLG_SEQ_CTL_MSK;
2460 }
2471 2461
2472 if (ctrl->flags & IEEE80211_TXCTL_USE_RTS_CTS) { 2462 if (ctrl->flags & IEEE80211_TXCTL_USE_RTS_CTS) {
2473 tx_flags |= TX_CMD_FLG_RTS_MSK; 2463 tx_flags |= TX_CMD_FLG_RTS_MSK;
@@ -2568,13 +2558,15 @@ static int iwl3945_tx_skb(struct iwl3945_priv *priv,
2568 dma_addr_t phys_addr; 2558 dma_addr_t phys_addr;
2569 dma_addr_t txcmd_phys; 2559 dma_addr_t txcmd_phys;
2570 struct iwl3945_cmd *out_cmd = NULL; 2560 struct iwl3945_cmd *out_cmd = NULL;
2571 u16 len, idx, len_org; 2561 u16 len, idx, len_org, hdr_len;
2572 u8 id, hdr_len, unicast; 2562 u8 id;
2563 u8 unicast;
2573 u8 sta_id; 2564 u8 sta_id;
2565 u8 tid = 0;
2574 u16 seq_number = 0; 2566 u16 seq_number = 0;
2575 u16 fc; 2567 u16 fc;
2576 __le16 *qc;
2577 u8 wait_write_ptr = 0; 2568 u8 wait_write_ptr = 0;
2569 u8 *qc = NULL;
2578 unsigned long flags; 2570 unsigned long flags;
2579 int rc; 2571 int rc;
2580 2572
@@ -2632,9 +2624,9 @@ static int iwl3945_tx_skb(struct iwl3945_priv *priv,
2632 2624
2633 IWL_DEBUG_RATE("station Id %d\n", sta_id); 2625 IWL_DEBUG_RATE("station Id %d\n", sta_id);
2634 2626
2635 qc = ieee80211_get_qos_ctrl(hdr); 2627 if (ieee80211_is_qos_data(fc)) {
2636 if (qc) { 2628 qc = ieee80211_get_qos_ctrl(hdr, hdr_len);
2637 u8 tid = (u8)(le16_to_cpu(*qc) & 0xf); 2629 tid = qc[0] & 0xf;
2638 seq_number = priv->stations[sta_id].tid[tid].seq_number & 2630 seq_number = priv->stations[sta_id].tid[tid].seq_number &
2639 IEEE80211_SCTL_SEQ; 2631 IEEE80211_SCTL_SEQ;
2640 hdr->seq_ctrl = cpu_to_le16(seq_number) | 2632 hdr->seq_ctrl = cpu_to_le16(seq_number) |
@@ -2745,7 +2737,6 @@ static int iwl3945_tx_skb(struct iwl3945_priv *priv,
2745 if (!ieee80211_get_morefrag(hdr)) { 2737 if (!ieee80211_get_morefrag(hdr)) {
2746 txq->need_update = 1; 2738 txq->need_update = 1;
2747 if (qc) { 2739 if (qc) {
2748 u8 tid = (u8)(le16_to_cpu(*qc) & 0xf);
2749 priv->stations[sta_id].tid[tid].seq_number = seq_number; 2740 priv->stations[sta_id].tid[tid].seq_number = seq_number;
2750 } 2741 }
2751 } else { 2742 } else {