aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlegacy
diff options
context:
space:
mode:
authorStanislaw Gruszka <sgruszka@redhat.com>2012-02-03 11:32:00 -0500
committerJohn W. Linville <linville@tuxdriver.com>2012-02-06 14:56:13 -0500
commit00ea99e1d86b05e7ba90d66673b536b731af87cd (patch)
treefe903abefeb16778697e48062a4321cee42b0c99 /drivers/net/wireless/iwlegacy
parent89ef1ed2d241d3dfe884055d8446a5dd94919e54 (diff)
iwlegacy: remove struct il_tx_info
It's just wrapper to sk_buff pointers ... Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlegacy')
-rw-r--r--drivers/net/wireless/iwlegacy/3945-mac.c4
-rw-r--r--drivers/net/wireless/iwlegacy/3945.c18
-rw-r--r--drivers/net/wireless/iwlegacy/4965-mac.c33
-rw-r--r--drivers/net/wireless/iwlegacy/4965.c18
-rw-r--r--drivers/net/wireless/iwlegacy/common.c24
-rw-r--r--drivers/net/wireless/iwlegacy/common.h18
6 files changed, 46 insertions, 69 deletions
diff --git a/drivers/net/wireless/iwlegacy/3945-mac.c b/drivers/net/wireless/iwlegacy/3945-mac.c
index 40ce692b2c94..aa8f5c0bd642 100644
--- a/drivers/net/wireless/iwlegacy/3945-mac.c
+++ b/drivers/net/wireless/iwlegacy/3945-mac.c
@@ -538,9 +538,7 @@ il3945_tx_skb(struct il_priv *il, struct sk_buff *skb)
538 538
539 idx = il_get_cmd_idx(q, q->write_ptr, 0); 539 idx = il_get_cmd_idx(q, q->write_ptr, 0);
540 540
541 /* Set up driver data for this TFD */ 541 txq->skbs[q->write_ptr] = skb;
542 memset(&(txq->txb[q->write_ptr]), 0, sizeof(struct il_tx_info));
543 txq->txb[q->write_ptr].skb = skb;
544 542
545 /* Init first empty entry in queue's array of Tx/cmd buffers */ 543 /* Init first empty entry in queue's array of Tx/cmd buffers */
546 out_cmd = txq->cmd[idx]; 544 out_cmd = txq->cmd[idx];
diff --git a/drivers/net/wireless/iwlegacy/3945.c b/drivers/net/wireless/iwlegacy/3945.c
index 7c21a57d1bb5..6c1ae5fab899 100644
--- a/drivers/net/wireless/iwlegacy/3945.c
+++ b/drivers/net/wireless/iwlegacy/3945.c
@@ -293,16 +293,16 @@ il3945_tx_queue_reclaim(struct il_priv *il, int txq_id, int idx)
293{ 293{
294 struct il_tx_queue *txq = &il->txq[txq_id]; 294 struct il_tx_queue *txq = &il->txq[txq_id];
295 struct il_queue *q = &txq->q; 295 struct il_queue *q = &txq->q;
296 struct il_tx_info *tx_info; 296 struct sk_buff *skb;
297 297
298 BUG_ON(txq_id == IL39_CMD_QUEUE_NUM); 298 BUG_ON(txq_id == IL39_CMD_QUEUE_NUM);
299 299
300 for (idx = il_queue_inc_wrap(idx, q->n_bd); q->read_ptr != idx; 300 for (idx = il_queue_inc_wrap(idx, q->n_bd); q->read_ptr != idx;
301 q->read_ptr = il_queue_inc_wrap(q->read_ptr, q->n_bd)) { 301 q->read_ptr = il_queue_inc_wrap(q->read_ptr, q->n_bd)) {
302 302
303 tx_info = &txq->txb[txq->q.read_ptr]; 303 skb = txq->skbs[txq->q.read_ptr];
304 ieee80211_tx_status_irqsafe(il->hw, tx_info->skb); 304 ieee80211_tx_status_irqsafe(il->hw, skb);
305 tx_info->skb = NULL; 305 txq->skbs[txq->q.read_ptr] = NULL;
306 il->ops->lib->txq_free_tfd(il, txq); 306 il->ops->lib->txq_free_tfd(il, txq);
307 } 307 }
308 308
@@ -336,7 +336,7 @@ il3945_hdl_tx(struct il_priv *il, struct il_rx_buf *rxb)
336 } 336 }
337 337
338 txq->time_stamp = jiffies; 338 txq->time_stamp = jiffies;
339 info = IEEE80211_SKB_CB(txq->txb[txq->q.read_ptr].skb); 339 info = IEEE80211_SKB_CB(txq->skbs[txq->q.read_ptr]);
340 ieee80211_tx_info_clear_status(info); 340 ieee80211_tx_info_clear_status(info);
341 341
342 /* Fill the MRR chain with some info about on-chip retransmissions */ 342 /* Fill the MRR chain with some info about on-chip retransmissions */
@@ -660,15 +660,13 @@ il3945_hw_txq_free_tfd(struct il_priv *il, struct il_tx_queue *txq)
660 PCI_DMA_TODEVICE); 660 PCI_DMA_TODEVICE);
661 661
662 /* free SKB */ 662 /* free SKB */
663 if (txq->txb) { 663 if (txq->skbs) {
664 struct sk_buff *skb; 664 struct sk_buff *skb = txq->skbs[txq->q.read_ptr];
665
666 skb = txq->txb[txq->q.read_ptr].skb;
667 665
668 /* can be called from irqs-disabled context */ 666 /* can be called from irqs-disabled context */
669 if (skb) { 667 if (skb) {
670 dev_kfree_skb_any(skb); 668 dev_kfree_skb_any(skb);
671 txq->txb[txq->q.read_ptr].skb = NULL; 669 txq->skbs[txq->q.read_ptr] = NULL;
672 } 670 }
673 } 671 }
674} 672}
diff --git a/drivers/net/wireless/iwlegacy/4965-mac.c b/drivers/net/wireless/iwlegacy/4965-mac.c
index 49dd1e0e9a55..2a52e7b7325a 100644
--- a/drivers/net/wireless/iwlegacy/4965-mac.c
+++ b/drivers/net/wireless/iwlegacy/4965-mac.c
@@ -1753,9 +1753,7 @@ il4965_tx_skb(struct il_priv *il, struct sk_buff *skb)
1753 1753
1754 spin_unlock(&il->sta_lock); 1754 spin_unlock(&il->sta_lock);
1755 1755
1756 /* Set up driver data for this TFD */ 1756 txq->skbs[q->write_ptr] = skb;
1757 memset(&(txq->txb[q->write_ptr]), 0, sizeof(struct il_tx_info));
1758 txq->txb[q->write_ptr].skb = skb;
1759 1757
1760 /* Set up first empty entry in queue's array of Tx/cmd buffers */ 1758 /* Set up first empty entry in queue's array of Tx/cmd buffers */
1761 out_cmd = txq->cmd[q->write_ptr]; 1759 out_cmd = txq->cmd[q->write_ptr];
@@ -2435,14 +2433,14 @@ il4965_non_agg_tx_status(struct il_priv *il, const u8 *addr1)
2435} 2433}
2436 2434
2437static void 2435static void
2438il4965_tx_status(struct il_priv *il, struct il_tx_info *tx_info, bool is_agg) 2436il4965_tx_status(struct il_priv *il, struct sk_buff *skb, bool is_agg)
2439{ 2437{
2440 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)tx_info->skb->data; 2438 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
2441 2439
2442 if (!is_agg) 2440 if (!is_agg)
2443 il4965_non_agg_tx_status(il, hdr->addr1); 2441 il4965_non_agg_tx_status(il, hdr->addr1);
2444 2442
2445 ieee80211_tx_status_irqsafe(il->hw, tx_info->skb); 2443 ieee80211_tx_status_irqsafe(il->hw, skb);
2446} 2444}
2447 2445
2448int 2446int
@@ -2450,9 +2448,9 @@ il4965_tx_queue_reclaim(struct il_priv *il, int txq_id, int idx)
2450{ 2448{
2451 struct il_tx_queue *txq = &il->txq[txq_id]; 2449 struct il_tx_queue *txq = &il->txq[txq_id];
2452 struct il_queue *q = &txq->q; 2450 struct il_queue *q = &txq->q;
2453 struct il_tx_info *tx_info;
2454 int nfreed = 0; 2451 int nfreed = 0;
2455 struct ieee80211_hdr *hdr; 2452 struct ieee80211_hdr *hdr;
2453 struct sk_buff *skb;
2456 2454
2457 if (idx >= q->n_bd || il_queue_used(q, idx) == 0) { 2455 if (idx >= q->n_bd || il_queue_used(q, idx) == 0) {
2458 IL_ERR("Read idx for DMA queue txq id (%d), idx %d, " 2456 IL_ERR("Read idx for DMA queue txq id (%d), idx %d, "
@@ -2464,19 +2462,18 @@ il4965_tx_queue_reclaim(struct il_priv *il, int txq_id, int idx)
2464 for (idx = il_queue_inc_wrap(idx, q->n_bd); q->read_ptr != idx; 2462 for (idx = il_queue_inc_wrap(idx, q->n_bd); q->read_ptr != idx;
2465 q->read_ptr = il_queue_inc_wrap(q->read_ptr, q->n_bd)) { 2463 q->read_ptr = il_queue_inc_wrap(q->read_ptr, q->n_bd)) {
2466 2464
2467 tx_info = &txq->txb[txq->q.read_ptr]; 2465 skb = txq->skbs[txq->q.read_ptr];
2468 2466
2469 if (WARN_ON_ONCE(tx_info->skb == NULL)) 2467 if (WARN_ON_ONCE(skb == NULL))
2470 continue; 2468 continue;
2471 2469
2472 hdr = (struct ieee80211_hdr *)tx_info->skb->data; 2470 hdr = (struct ieee80211_hdr *) skb->data;
2473 if (ieee80211_is_data_qos(hdr->frame_control)) 2471 if (ieee80211_is_data_qos(hdr->frame_control))
2474 nfreed++; 2472 nfreed++;
2475 2473
2476 il4965_tx_status(il, tx_info, 2474 il4965_tx_status(il, skb, txq_id >= IL4965_FIRST_AMPDU_QUEUE);
2477 txq_id >= IL4965_FIRST_AMPDU_QUEUE);
2478 tx_info->skb = NULL;
2479 2475
2476 txq->skbs[txq->q.read_ptr] = NULL;
2480 il->ops->lib->txq_free_tfd(il, txq); 2477 il->ops->lib->txq_free_tfd(il, txq);
2481 } 2478 }
2482 return nfreed; 2479 return nfreed;
@@ -2540,7 +2537,7 @@ il4965_tx_status_reply_compressed_ba(struct il_priv *il, struct il_ht_agg *agg,
2540 2537
2541 D_TX_REPLY("Bitmap %llx\n", (unsigned long long)bitmap); 2538 D_TX_REPLY("Bitmap %llx\n", (unsigned long long)bitmap);
2542 2539
2543 info = IEEE80211_SKB_CB(il->txq[scd_flow].txb[agg->start_idx].skb); 2540 info = IEEE80211_SKB_CB(il->txq[scd_flow].skbs[agg->start_idx]);
2544 memset(&info->status, 0, sizeof(info->status)); 2541 memset(&info->status, 0, sizeof(info->status));
2545 info->flags |= IEEE80211_TX_STAT_ACK; 2542 info->flags |= IEEE80211_TX_STAT_ACK;
2546 info->flags |= IEEE80211_TX_STAT_AMPDU; 2543 info->flags |= IEEE80211_TX_STAT_AMPDU;
@@ -3624,15 +3621,13 @@ il4965_hw_txq_free_tfd(struct il_priv *il, struct il_tx_queue *txq)
3624 PCI_DMA_TODEVICE); 3621 PCI_DMA_TODEVICE);
3625 3622
3626 /* free SKB */ 3623 /* free SKB */
3627 if (txq->txb) { 3624 if (txq->skbs) {
3628 struct sk_buff *skb; 3625 struct sk_buff *skb = txq->skbs[txq->q.read_ptr];
3629
3630 skb = txq->txb[txq->q.read_ptr].skb;
3631 3626
3632 /* can be called from irqs-disabled context */ 3627 /* can be called from irqs-disabled context */
3633 if (skb) { 3628 if (skb) {
3634 dev_kfree_skb_any(skb); 3629 dev_kfree_skb_any(skb);
3635 txq->txb[txq->q.read_ptr].skb = NULL; 3630 txq->skbs[txq->q.read_ptr] = NULL;
3636 } 3631 }
3637 } 3632 }
3638} 3633}
diff --git a/drivers/net/wireless/iwlegacy/4965.c b/drivers/net/wireless/iwlegacy/4965.c
index cf1d0164a9a0..17a6922e890d 100644
--- a/drivers/net/wireless/iwlegacy/4965.c
+++ b/drivers/net/wireless/iwlegacy/4965.c
@@ -1873,7 +1873,7 @@ il4965_tx_status_reply_tx(struct il_priv *il, struct il_ht_agg *agg,
1873 D_TX_REPLY("FrameCnt = %d, StartIdx=%d idx=%d\n", 1873 D_TX_REPLY("FrameCnt = %d, StartIdx=%d idx=%d\n",
1874 agg->frame_count, agg->start_idx, idx); 1874 agg->frame_count, agg->start_idx, idx);
1875 1875
1876 info = IEEE80211_SKB_CB(il->txq[txq_id].txb[idx].skb); 1876 info = IEEE80211_SKB_CB(il->txq[txq_id].skbs[idx]);
1877 info->status.rates[0].count = tx_resp->failure_frame + 1; 1877 info->status.rates[0].count = tx_resp->failure_frame + 1;
1878 info->flags &= ~IEEE80211_TX_CTL_AMPDU; 1878 info->flags &= ~IEEE80211_TX_CTL_AMPDU;
1879 info->flags |= il4965_tx_status_to_mac80211(status); 1879 info->flags |= il4965_tx_status_to_mac80211(status);
@@ -1888,6 +1888,7 @@ il4965_tx_status_reply_tx(struct il_priv *il, struct il_ht_agg *agg,
1888 /* Two or more frames were attempted; expect block-ack */ 1888 /* Two or more frames were attempted; expect block-ack */
1889 u64 bitmap = 0; 1889 u64 bitmap = 0;
1890 int start = agg->start_idx; 1890 int start = agg->start_idx;
1891 struct sk_buff *skb;
1891 1892
1892 /* Construct bit-map of pending frames within Tx win */ 1893 /* Construct bit-map of pending frames within Tx win */
1893 for (i = 0; i < agg->frame_count; i++) { 1894 for (i = 0; i < agg->frame_count; i++) {
@@ -1905,12 +1906,10 @@ il4965_tx_status_reply_tx(struct il_priv *il, struct il_ht_agg *agg,
1905 D_TX_REPLY("FrameCnt = %d, txq_id=%d idx=%d\n", 1906 D_TX_REPLY("FrameCnt = %d, txq_id=%d idx=%d\n",
1906 agg->frame_count, txq_id, idx); 1907 agg->frame_count, txq_id, idx);
1907 1908
1908 hdr = il_tx_queue_get_hdr(il, txq_id, idx); 1909 skb = il->txq[txq_id].skbs[idx];
1909 if (!hdr) { 1910 if (WARN_ON_ONCE(skb == NULL))
1910 IL_ERR("BUG_ON idx doesn't point to valid skb"
1911 " idx=%d, txq_id=%d\n", idx, txq_id);
1912 return -1; 1911 return -1;
1913 } 1912 hdr = (struct ieee80211_hdr *) skb->data;
1914 1913
1915 sc = le16_to_cpu(hdr->seq_ctrl); 1914 sc = le16_to_cpu(hdr->seq_ctrl);
1916 if (idx != (SEQ_TO_SN(sc) & 0xff)) { 1915 if (idx != (SEQ_TO_SN(sc) & 0xff)) {
@@ -2018,6 +2017,7 @@ il4965_hdl_tx(struct il_priv *il, struct il_rx_buf *rxb)
2018 int txq_id = SEQ_TO_QUEUE(sequence); 2017 int txq_id = SEQ_TO_QUEUE(sequence);
2019 int idx = SEQ_TO_IDX(sequence); 2018 int idx = SEQ_TO_IDX(sequence);
2020 struct il_tx_queue *txq = &il->txq[txq_id]; 2019 struct il_tx_queue *txq = &il->txq[txq_id];
2020 struct sk_buff *skb;
2021 struct ieee80211_hdr *hdr; 2021 struct ieee80211_hdr *hdr;
2022 struct ieee80211_tx_info *info; 2022 struct ieee80211_tx_info *info;
2023 struct il4965_tx_resp *tx_resp = (void *)&pkt->u.raw[0]; 2023 struct il4965_tx_resp *tx_resp = (void *)&pkt->u.raw[0];
@@ -2036,10 +2036,12 @@ il4965_hdl_tx(struct il_priv *il, struct il_rx_buf *rxb)
2036 } 2036 }
2037 2037
2038 txq->time_stamp = jiffies; 2038 txq->time_stamp = jiffies;
2039 info = IEEE80211_SKB_CB(txq->txb[txq->q.read_ptr].skb); 2039
2040 skb = txq->skbs[txq->q.read_ptr];
2041 info = IEEE80211_SKB_CB(skb);
2040 memset(&info->status, 0, sizeof(info->status)); 2042 memset(&info->status, 0, sizeof(info->status));
2041 2043
2042 hdr = il_tx_queue_get_hdr(il, txq_id, idx); 2044 hdr = (struct ieee80211_hdr *) skb->data;
2043 if (ieee80211_is_data_qos(hdr->frame_control)) { 2045 if (ieee80211_is_data_qos(hdr->frame_control)) {
2044 qc = ieee80211_get_qos_ctl(hdr); 2046 qc = ieee80211_get_qos_ctl(hdr);
2045 tid = qc[0] & 0xf; 2047 tid = qc[0] & 0xf;
diff --git a/drivers/net/wireless/iwlegacy/common.c b/drivers/net/wireless/iwlegacy/common.c
index 1173521f21fb..04ec38e5eaaf 100644
--- a/drivers/net/wireless/iwlegacy/common.c
+++ b/drivers/net/wireless/iwlegacy/common.c
@@ -2755,8 +2755,8 @@ il_tx_queue_free(struct il_priv *il, int txq_id)
2755 txq->tfds, txq->q.dma_addr); 2755 txq->tfds, txq->q.dma_addr);
2756 2756
2757 /* De-alloc array of per-TFD driver data */ 2757 /* De-alloc array of per-TFD driver data */
2758 kfree(txq->txb); 2758 kfree(txq->skbs);
2759 txq->txb = NULL; 2759 txq->skbs = NULL;
2760 2760
2761 /* deallocate arrays */ 2761 /* deallocate arrays */
2762 kfree(txq->cmd); 2762 kfree(txq->cmd);
@@ -2930,23 +2930,21 @@ il_tx_queue_alloc(struct il_priv *il, struct il_tx_queue *txq, u32 id)
2930 /* Driver ilate data, only for Tx (not command) queues, 2930 /* Driver ilate data, only for Tx (not command) queues,
2931 * not shared with device. */ 2931 * not shared with device. */
2932 if (id != il->cmd_queue) { 2932 if (id != il->cmd_queue) {
2933 txq->txb = kcalloc(TFD_QUEUE_SIZE_MAX, sizeof(txq->txb[0]), 2933 txq->skbs = kcalloc(TFD_QUEUE_SIZE_MAX, sizeof(struct skb *),
2934 GFP_KERNEL); 2934 GFP_KERNEL);
2935 if (!txq->txb) { 2935 if (!txq->skbs) {
2936 IL_ERR("kmalloc for auxiliary BD " 2936 IL_ERR("Fail to alloc skbs\n");
2937 "structures failed\n");
2938 goto error; 2937 goto error;
2939 } 2938 }
2940 } else { 2939 } else
2941 txq->txb = NULL; 2940 txq->skbs = NULL;
2942 }
2943 2941
2944 /* Circular buffer of transmit frame descriptors (TFDs), 2942 /* Circular buffer of transmit frame descriptors (TFDs),
2945 * shared with device */ 2943 * shared with device */
2946 txq->tfds = 2944 txq->tfds =
2947 dma_alloc_coherent(dev, tfd_sz, &txq->q.dma_addr, GFP_KERNEL); 2945 dma_alloc_coherent(dev, tfd_sz, &txq->q.dma_addr, GFP_KERNEL);
2948 if (!txq->tfds) { 2946 if (!txq->tfds) {
2949 IL_ERR("pci_alloc_consistent(%zd) failed\n", tfd_sz); 2947 IL_ERR("Fail to alloc TFDs\n");
2950 goto error; 2948 goto error;
2951 } 2949 }
2952 txq->q.id = id; 2950 txq->q.id = id;
@@ -2954,8 +2952,8 @@ il_tx_queue_alloc(struct il_priv *il, struct il_tx_queue *txq, u32 id)
2954 return 0; 2952 return 0;
2955 2953
2956error: 2954error:
2957 kfree(txq->txb); 2955 kfree(txq->skbs);
2958 txq->txb = NULL; 2956 txq->skbs = NULL;
2959 2957
2960 return -ENOMEM; 2958 return -ENOMEM;
2961} 2959}
diff --git a/drivers/net/wireless/iwlegacy/common.h b/drivers/net/wireless/iwlegacy/common.h
index 21ed70a7f68c..527a1b9f99ea 100644
--- a/drivers/net/wireless/iwlegacy/common.h
+++ b/drivers/net/wireless/iwlegacy/common.h
@@ -143,11 +143,6 @@ struct il_queue {
143 * space less than this */ 143 * space less than this */
144}; 144};
145 145
146/* One for each TFD */
147struct il_tx_info {
148 struct sk_buff *skb;
149};
150
151/** 146/**
152 * struct il_tx_queue - Tx Queue for DMA 147 * struct il_tx_queue - Tx Queue for DMA
153 * @q: generic Rx/Tx queue descriptor 148 * @q: generic Rx/Tx queue descriptor
@@ -155,7 +150,7 @@ struct il_tx_info {
155 * @cmd: array of command/TX buffer pointers 150 * @cmd: array of command/TX buffer pointers
156 * @meta: array of meta data for each command/tx buffer 151 * @meta: array of meta data for each command/tx buffer
157 * @dma_addr_cmd: physical address of cmd/tx buffer array 152 * @dma_addr_cmd: physical address of cmd/tx buffer array
158 * @txb: array of per-TFD driver data 153 * @skbs: array of per-TFD socket buffer pointers
159 * @time_stamp: time (in jiffies) of last read_ptr change 154 * @time_stamp: time (in jiffies) of last read_ptr change
160 * @need_update: indicates need to update read/write idx 155 * @need_update: indicates need to update read/write idx
161 * @sched_retry: indicates queue is high-throughput aggregation (HT AGG) enabled 156 * @sched_retry: indicates queue is high-throughput aggregation (HT AGG) enabled
@@ -171,7 +166,7 @@ struct il_tx_queue {
171 void *tfds; 166 void *tfds;
172 struct il_device_cmd **cmd; 167 struct il_device_cmd **cmd;
173 struct il_cmd_meta *meta; 168 struct il_cmd_meta *meta;
174 struct il_tx_info *txb; 169 struct sk_buff **skbs;
175 unsigned long time_stamp; 170 unsigned long time_stamp;
176 u8 need_update; 171 u8 need_update;
177 u8 sched_retry; 172 u8 sched_retry;
@@ -1482,15 +1477,6 @@ il_txq_ctx_deactivate(struct il_priv *il, int txq_id)
1482 clear_bit(txq_id, &il->txq_ctx_active_msk); 1477 clear_bit(txq_id, &il->txq_ctx_active_msk);
1483} 1478}
1484 1479
1485static inline struct ieee80211_hdr *
1486il_tx_queue_get_hdr(struct il_priv *il, int txq_id, int idx)
1487{
1488 if (il->txq[txq_id].txb[idx].skb)
1489 return (struct ieee80211_hdr *)il->txq[txq_id].txb[idx].skb->
1490 data;
1491 return NULL;
1492}
1493
1494static inline int 1480static inline int
1495il_is_associated(struct il_priv *il) 1481il_is_associated(struct il_priv *il)
1496{ 1482{