aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-4965-rs.c17
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-dev.h1
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-helpers.h19
-rw-r--r--drivers/net/wireless/iwlwifi/iwl3945-base.c35
-rw-r--r--drivers/net/wireless/iwlwifi/iwl4965-base.c51
5 files changed, 63 insertions, 60 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965-rs.c b/drivers/net/wireless/iwlwifi/iwl-4965-rs.c
index ce70f2b29b61..071c7b6ebef2 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965-rs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-4965-rs.c
@@ -282,14 +282,20 @@ static void rs_tl_rm_old_stats(struct iwl4965_traffic_load *tl, u32 curr_time)
282 * increment traffic load value for tid and also remove 282 * increment traffic load value for tid and also remove
283 * any old values if passed the certain time period 283 * any old values if passed the certain time period
284 */ 284 */
285static void rs_tl_add_packet(struct iwl4965_lq_sta *lq_data, u8 tid) 285static void rs_tl_add_packet(struct iwl4965_lq_sta *lq_data,
286 struct ieee80211_hdr *hdr)
286{ 287{
287 u32 curr_time = jiffies_to_msecs(jiffies); 288 u32 curr_time = jiffies_to_msecs(jiffies);
288 u32 time_diff; 289 u32 time_diff;
289 s32 index; 290 s32 index;
290 struct iwl4965_traffic_load *tl = NULL; 291 struct iwl4965_traffic_load *tl = NULL;
292 u16 fc = le16_to_cpu(hdr->frame_control);
293 u8 tid;
291 294
292 if (tid >= TID_MAX_LOAD_COUNT) 295 if (ieee80211_is_qos_data(fc)) {
296 u8 *qc = ieee80211_get_qos_ctrl(hdr, ieee80211_get_hdrlen(fc));
297 tid = qc[0] & 0xf;
298 } else
293 return; 299 return;
294 300
295 tl = &lq_data->load[tid]; 301 tl = &lq_data->load[tid];
@@ -1670,7 +1676,6 @@ static void rs_rate_scale_perform(struct iwl_priv *priv,
1670 u16 high_low; 1676 u16 high_low;
1671#ifdef CONFIG_IWL4965_HT 1677#ifdef CONFIG_IWL4965_HT
1672 u8 tid = MAX_TID_COUNT; 1678 u8 tid = MAX_TID_COUNT;
1673 __le16 *qc;
1674#endif 1679#endif
1675 1680
1676 IWL_DEBUG_RATE("rate scale calculate new rate for skb\n"); 1681 IWL_DEBUG_RATE("rate scale calculate new rate for skb\n");
@@ -1693,11 +1698,7 @@ static void rs_rate_scale_perform(struct iwl_priv *priv,
1693 lq_sta = (struct iwl4965_lq_sta *)sta->rate_ctrl_priv; 1698 lq_sta = (struct iwl4965_lq_sta *)sta->rate_ctrl_priv;
1694 1699
1695#ifdef CONFIG_IWL4965_HT 1700#ifdef CONFIG_IWL4965_HT
1696 qc = ieee80211_get_qos_ctrl(hdr); 1701 rs_tl_add_packet(lq_sta, hdr);
1697 if (qc) {
1698 tid = (u8)(le16_to_cpu(*qc) & 0xf);
1699 rs_tl_add_packet(lq_sta, tid);
1700 }
1701#endif 1702#endif
1702 /* 1703 /*
1703 * Select rate-scale / modulation-mode table to work with in 1704 * Select rate-scale / modulation-mode table to work with in
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h
index ddb950ee25b6..7bd99f942f10 100644
--- a/drivers/net/wireless/iwlwifi/iwl-dev.h
+++ b/drivers/net/wireless/iwlwifi/iwl-dev.h
@@ -650,7 +650,6 @@ extern int iwl4965_calc_sig_qual(int rssi_dbm, int noise_dbm);
650extern unsigned int iwl4965_fill_beacon_frame(struct iwl_priv *priv, 650extern unsigned int iwl4965_fill_beacon_frame(struct iwl_priv *priv,
651 struct ieee80211_hdr *hdr, 651 struct ieee80211_hdr *hdr,
652 const u8 *dest, int left); 652 const u8 *dest, int left);
653extern __le16 *ieee80211_get_qos_ctrl(struct ieee80211_hdr *hdr);
654extern void iwl4965_update_chain_flags(struct iwl_priv *priv); 653extern void iwl4965_update_chain_flags(struct iwl_priv *priv);
655int iwl4965_set_pwr_src(struct iwl_priv *priv, enum iwl_pwr_src src); 654int iwl4965_set_pwr_src(struct iwl_priv *priv, enum iwl_pwr_src src);
656 655
diff --git a/drivers/net/wireless/iwlwifi/iwl-helpers.h b/drivers/net/wireless/iwlwifi/iwl-helpers.h
index a443472bea62..e4c3f84f530a 100644
--- a/drivers/net/wireless/iwlwifi/iwl-helpers.h
+++ b/drivers/net/wireless/iwlwifi/iwl-helpers.h
@@ -235,6 +235,25 @@ static inline int ieee80211_is_reassoc_response(u16 fc)
235 ((fc & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_REASSOC_RESP); 235 ((fc & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_REASSOC_RESP);
236} 236}
237 237
238static inline int ieee80211_is_qos_data(u16 fc)
239{
240 return ((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA) &&
241 ((fc & IEEE80211_FCTL_STYPE) == IEEE80211_STYPE_QOS_DATA);
242}
243/**
244 * ieee80211_get_qos_ctrl - get pointer to the QoS control field
245 *
246 * This function returns the pointer to 802.11 header QoS field (2 bytes)
247 * This function doesn't check whether hdr is a QoS hdr, use with care
248 * @hdr: struct ieee80211_hdr *hdr
249 * @hdr_len: header length
250 */
251
252static inline u8 *ieee80211_get_qos_ctrl(struct ieee80211_hdr *hdr, int hdr_len)
253{
254 return ((u8 *) hdr + hdr_len - QOS_CONTROL_LEN);
255}
256
238static inline int iwl_check_bits(unsigned long field, unsigned long mask) 257static inline int iwl_check_bits(unsigned long field, unsigned long mask)
239{ 258{
240 return ((field & mask) == mask) ? 1 : 0; 259 return ((field & mask) == mask) ? 1 : 0;
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 {
diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c
index 6d5b58f88aaa..e3f872e3381d 100644
--- a/drivers/net/wireless/iwlwifi/iwl4965-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c
@@ -89,16 +89,6 @@ MODULE_VERSION(DRV_VERSION);
89MODULE_AUTHOR(DRV_COPYRIGHT); 89MODULE_AUTHOR(DRV_COPYRIGHT);
90MODULE_LICENSE("GPL"); 90MODULE_LICENSE("GPL");
91 91
92__le16 *ieee80211_get_qos_ctrl(struct ieee80211_hdr *hdr)
93{
94 u16 fc = le16_to_cpu(hdr->frame_control);
95 int hdr_len = ieee80211_get_hdrlen(fc);
96
97 if ((fc & 0x00cc) == (IEEE80211_STYPE_QOS_DATA | IEEE80211_FTYPE_DATA))
98 return (__le16 *) ((u8 *) hdr + hdr_len - QOS_CONTROL_LEN);
99 return NULL;
100}
101
102static const struct ieee80211_supported_band *iwl_get_hw_mode( 92static const struct ieee80211_supported_band *iwl_get_hw_mode(
103 struct iwl_priv *priv, enum ieee80211_band band) 93 struct iwl_priv *priv, enum ieee80211_band band)
104{ 94{
@@ -1532,7 +1522,6 @@ static void iwl4965_build_tx_cmd_basic(struct iwl_priv *priv,
1532 struct ieee80211_hdr *hdr, 1522 struct ieee80211_hdr *hdr,
1533 int is_unicast, u8 std_id) 1523 int is_unicast, u8 std_id)
1534{ 1524{
1535 __le16 *qc;
1536 u16 fc = le16_to_cpu(hdr->frame_control); 1525 u16 fc = le16_to_cpu(hdr->frame_control);
1537 __le32 tx_flags = cmd->cmd.tx.tx_flags; 1526 __le32 tx_flags = cmd->cmd.tx.tx_flags;
1538 1527
@@ -1557,12 +1546,13 @@ static void iwl4965_build_tx_cmd_basic(struct iwl_priv *priv,
1557 if (ieee80211_get_morefrag(hdr)) 1546 if (ieee80211_get_morefrag(hdr))
1558 tx_flags |= TX_CMD_FLG_MORE_FRAG_MSK; 1547 tx_flags |= TX_CMD_FLG_MORE_FRAG_MSK;
1559 1548
1560 qc = ieee80211_get_qos_ctrl(hdr); 1549 if (ieee80211_is_qos_data(fc)) {
1561 if (qc) { 1550 u8 *qc = ieee80211_get_qos_ctrl(hdr, ieee80211_get_hdrlen(fc));
1562 cmd->cmd.tx.tid_tspec = (u8) (le16_to_cpu(*qc) & 0xf); 1551 cmd->cmd.tx.tid_tspec = qc[0] & 0xf;
1563 tx_flags &= ~TX_CMD_FLG_SEQ_CTL_MSK; 1552 tx_flags &= ~TX_CMD_FLG_SEQ_CTL_MSK;
1564 } else 1553 } else {
1565 tx_flags |= TX_CMD_FLG_SEQ_CTL_MSK; 1554 tx_flags |= TX_CMD_FLG_SEQ_CTL_MSK;
1555 }
1566 1556
1567 if (ctrl->flags & IEEE80211_TXCTL_USE_RTS_CTS) { 1557 if (ctrl->flags & IEEE80211_TXCTL_USE_RTS_CTS) {
1568 tx_flags |= TX_CMD_FLG_RTS_MSK; 1558 tx_flags |= TX_CMD_FLG_RTS_MSK;
@@ -1614,12 +1604,15 @@ static int iwl4965_tx_skb(struct iwl_priv *priv,
1614 dma_addr_t scratch_phys; 1604 dma_addr_t scratch_phys;
1615 struct iwl_cmd *out_cmd = NULL; 1605 struct iwl_cmd *out_cmd = NULL;
1616 u16 len, idx, len_org; 1606 u16 len, idx, len_org;
1617 u8 id, hdr_len, unicast; 1607 u8 hdr_len;
1608 u8 id;
1609 u8 unicast;
1618 u8 sta_id; 1610 u8 sta_id;
1611 u8 tid = 0;
1612 u8 wait_write_ptr = 0;
1619 u16 seq_number = 0; 1613 u16 seq_number = 0;
1620 u16 fc; 1614 u16 fc;
1621 __le16 *qc; 1615 u8 *qc = NULL;
1622 u8 wait_write_ptr = 0;
1623 unsigned long flags; 1616 unsigned long flags;
1624 int rc; 1617 int rc;
1625 1618
@@ -1678,9 +1671,9 @@ static int iwl4965_tx_skb(struct iwl_priv *priv,
1678 1671
1679 IWL_DEBUG_TX("station Id %d\n", sta_id); 1672 IWL_DEBUG_TX("station Id %d\n", sta_id);
1680 1673
1681 qc = ieee80211_get_qos_ctrl(hdr); 1674 if (ieee80211_is_qos_data(fc)) {
1682 if (qc) { 1675 qc = ieee80211_get_qos_ctrl(hdr, hdr_len);
1683 u8 tid = (u8)(le16_to_cpu(*qc) & 0xf); 1676 tid = qc[0] & 0xf;
1684 seq_number = priv->stations[sta_id].tid[tid].seq_number & 1677 seq_number = priv->stations[sta_id].tid[tid].seq_number &
1685 IEEE80211_SCTL_SEQ; 1678 IEEE80211_SCTL_SEQ;
1686 hdr->seq_ctrl = cpu_to_le16(seq_number) | 1679 hdr->seq_ctrl = cpu_to_le16(seq_number) |
@@ -1795,10 +1788,8 @@ static int iwl4965_tx_skb(struct iwl_priv *priv,
1795 1788
1796 if (!ieee80211_get_morefrag(hdr)) { 1789 if (!ieee80211_get_morefrag(hdr)) {
1797 txq->need_update = 1; 1790 txq->need_update = 1;
1798 if (qc) { 1791 if (qc)
1799 u8 tid = (u8)(le16_to_cpu(*qc) & 0xf);
1800 priv->stations[sta_id].tid[tid].seq_number = seq_number; 1792 priv->stations[sta_id].tid[tid].seq_number = seq_number;
1801 }
1802 } else { 1793 } else {
1803 wait_write_ptr = 1; 1794 wait_write_ptr = 1;
1804 txq->need_update = 0; 1795 txq->need_update = 0;
@@ -2377,8 +2368,9 @@ static void iwl4965_rx_reply_tx(struct iwl_priv *priv,
2377 u32 status = le32_to_cpu(tx_resp->status); 2368 u32 status = le32_to_cpu(tx_resp->status);
2378#ifdef CONFIG_IWL4965_HT 2369#ifdef CONFIG_IWL4965_HT
2379 int tid = MAX_TID_COUNT, sta_id = IWL_INVALID_STATION; 2370 int tid = MAX_TID_COUNT, sta_id = IWL_INVALID_STATION;
2371 u16 fc;
2380 struct ieee80211_hdr *hdr; 2372 struct ieee80211_hdr *hdr;
2381 __le16 *qc; 2373 u8 *qc = NULL;
2382#endif 2374#endif
2383 2375
2384 if ((index >= txq->q.n_bd) || (iwl_queue_used(&txq->q, index) == 0)) { 2376 if ((index >= txq->q.n_bd) || (iwl_queue_used(&txq->q, index) == 0)) {
@@ -2391,10 +2383,11 @@ static void iwl4965_rx_reply_tx(struct iwl_priv *priv,
2391 2383
2392#ifdef CONFIG_IWL4965_HT 2384#ifdef CONFIG_IWL4965_HT
2393 hdr = iwl4965_tx_queue_get_hdr(priv, txq_id, index); 2385 hdr = iwl4965_tx_queue_get_hdr(priv, txq_id, index);
2394 qc = ieee80211_get_qos_ctrl(hdr); 2386 fc = le16_to_cpu(hdr->frame_control);
2395 2387 if (ieee80211_is_qos_data(fc)) {
2396 if (qc) 2388 qc = ieee80211_get_qos_ctrl(hdr, ieee80211_get_hdrlen(fc));
2397 tid = le16_to_cpu(*qc) & 0xf; 2389 tid = qc[0] & 0xf;
2390 }
2398 2391
2399 sta_id = iwl4965_get_ra_sta_id(priv, hdr); 2392 sta_id = iwl4965_get_ra_sta_id(priv, hdr);
2400 if (txq->sched_retry && unlikely(sta_id == IWL_INVALID_STATION)) { 2393 if (txq->sched_retry && unlikely(sta_id == IWL_INVALID_STATION)) {