aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorWinkler, Tomas <tomas.winkler@intel.com>2008-11-07 12:58:39 -0500
committerJohn W. Linville <linville@tuxdriver.com>2008-11-21 11:07:22 -0500
commit8d86422a83d79e3d3241cf0f269fca0c2640bcee (patch)
treeb9791deaa104a7254891d962dceb551864235ee0 /drivers
parent5c5aa3f13a50881b8f6e529e321bbefb5faec37b (diff)
iwlwifi: move rx queue read pointer into rxq
This patch moves rx status/read registers into iwl_rx_queue structures. This solution is more memory hungry but is more structured and provides needed RX/TX separation Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: Reinette Chatre <reinette.chatre@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-4965-hw.h27
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-4965.c9
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-5000-hw.h29
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-5000.c9
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.h1
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-dev.h9
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-fh.h16
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-rx.c18
9 files changed, 37 insertions, 83 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965-hw.h b/drivers/net/wireless/iwlwifi/iwl-4965-hw.h
index 9da7c7bea752..94ae1a84f786 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965-hw.h
+++ b/drivers/net/wireless/iwlwifi/iwl-4965-hw.h
@@ -927,33 +927,6 @@ struct iwl4965_schedq_bc_tbl {
927 */ 927 */
928struct iwl4965_shared { 928struct iwl4965_shared {
929 struct iwl4965_schedq_bc_tbl queues_bc_tbls[IWL49_NUM_QUEUES]; 929 struct iwl4965_schedq_bc_tbl queues_bc_tbls[IWL49_NUM_QUEUES];
930 __le32 rb_closed;
931
932 /* __le32 rb_closed_stts_rb_num:12; */
933#define IWL_rb_closed_stts_rb_num_POS 0
934#define IWL_rb_closed_stts_rb_num_LEN 12
935#define IWL_rb_closed_stts_rb_num_SYM rb_closed
936 /* __le32 rsrv1:4; */
937 /* __le32 rb_closed_stts_rx_frame_num:12; */
938#define IWL_rb_closed_stts_rx_frame_num_POS 16
939#define IWL_rb_closed_stts_rx_frame_num_LEN 12
940#define IWL_rb_closed_stts_rx_frame_num_SYM rb_closed
941 /* __le32 rsrv2:4; */
942
943 __le32 frm_finished;
944 /* __le32 frame_finished_stts_rb_num:12; */
945#define IWL_frame_finished_stts_rb_num_POS 0
946#define IWL_frame_finished_stts_rb_num_LEN 12
947#define IWL_frame_finished_stts_rb_num_SYM frm_finished
948 /* __le32 rsrv3:4; */
949 /* __le32 frame_finished_stts_rx_frame_num:12; */
950#define IWL_frame_finished_stts_rx_frame_num_POS 16
951#define IWL_frame_finished_stts_rx_frame_num_LEN 12
952#define IWL_frame_finished_stts_rx_frame_num_SYM frm_finished
953 /* __le32 rsrv4:4; */
954
955 __le32 padding1; /* so that allocation will be aligned to 16B */
956 __le32 padding2;
957} __attribute__ ((packed)); 930} __attribute__ ((packed));
958 931
959#endif /* __iwl4965_4965_hw_h__ */ 932#endif /* __iwl4965_4965_hw_h__ */
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c
index 157cad4e9da0..017e5ea58de6 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965.c
+++ b/drivers/net/wireless/iwlwifi/iwl-4965.c
@@ -1631,12 +1631,6 @@ static int iwl4965_hw_channel_switch(struct iwl_priv *priv, u16 channel)
1631} 1631}
1632#endif 1632#endif
1633 1633
1634static int iwl4965_shared_mem_rx_idx(struct iwl_priv *priv)
1635{
1636 struct iwl4965_shared *s = priv->shared_virt;
1637 return le32_to_cpu(s->rb_closed) & 0xFFF;
1638}
1639
1640static int iwl4965_alloc_shared_mem(struct iwl_priv *priv) 1634static int iwl4965_alloc_shared_mem(struct iwl_priv *priv)
1641{ 1635{
1642 priv->shared_virt = pci_alloc_consistent(priv->pci_dev, 1636 priv->shared_virt = pci_alloc_consistent(priv->pci_dev,
@@ -1647,8 +1641,6 @@ static int iwl4965_alloc_shared_mem(struct iwl_priv *priv)
1647 1641
1648 memset(priv->shared_virt, 0, sizeof(struct iwl4965_shared)); 1642 memset(priv->shared_virt, 0, sizeof(struct iwl4965_shared));
1649 1643
1650 priv->rb_closed_offset = offsetof(struct iwl4965_shared, rb_closed);
1651
1652 return 0; 1644 return 0;
1653} 1645}
1654 1646
@@ -2306,7 +2298,6 @@ static struct iwl_lib_ops iwl4965_lib = {
2306 .set_hw_params = iwl4965_hw_set_hw_params, 2298 .set_hw_params = iwl4965_hw_set_hw_params,
2307 .alloc_shared_mem = iwl4965_alloc_shared_mem, 2299 .alloc_shared_mem = iwl4965_alloc_shared_mem,
2308 .free_shared_mem = iwl4965_free_shared_mem, 2300 .free_shared_mem = iwl4965_free_shared_mem,
2309 .shared_mem_rx_idx = iwl4965_shared_mem_rx_idx,
2310 .txq_update_byte_cnt_tbl = iwl4965_txq_update_byte_cnt_tbl, 2301 .txq_update_byte_cnt_tbl = iwl4965_txq_update_byte_cnt_tbl,
2311 .txq_set_sched = iwl4965_txq_set_sched, 2302 .txq_set_sched = iwl4965_txq_set_sched,
2312 .txq_agg_enable = iwl4965_txq_agg_enable, 2303 .txq_agg_enable = iwl4965_txq_agg_enable,
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000-hw.h b/drivers/net/wireless/iwlwifi/iwl-5000-hw.h
index 12c74048a396..8f9edc79e254 100644
--- a/drivers/net/wireless/iwlwifi/iwl-5000-hw.h
+++ b/drivers/net/wireless/iwlwifi/iwl-5000-hw.h
@@ -96,38 +96,9 @@ struct iwl5000_schedq_bc_tbl {
96 96
97/** 97/**
98 * struct iwl5000_shared 98 * struct iwl5000_shared
99 * @rb_closed
100 * address is provided to FH_RSCSR_CHNL0_STTS_WPTR_REG
101 */ 99 */
102struct iwl5000_shared { 100struct iwl5000_shared {
103 struct iwl5000_schedq_bc_tbl queues_bc_tbls[IWL50_NUM_QUEUES]; 101 struct iwl5000_schedq_bc_tbl queues_bc_tbls[IWL50_NUM_QUEUES];
104 __le32 rb_closed;
105
106 /* __le32 rb_closed_stts_rb_num:12; */
107#define IWL_rb_closed_stts_rb_num_POS 0
108#define IWL_rb_closed_stts_rb_num_LEN 12
109#define IWL_rb_closed_stts_rb_num_SYM rb_closed
110 /* __le32 rsrv1:4; */
111 /* __le32 rb_closed_stts_rx_frame_num:12; */
112#define IWL_rb_closed_stts_rx_frame_num_POS 16
113#define IWL_rb_closed_stts_rx_frame_num_LEN 12
114#define IWL_rb_closed_stts_rx_frame_num_SYM rb_closed
115 /* __le32 rsrv2:4; */
116
117 __le32 frm_finished;
118 /* __le32 frame_finished_stts_rb_num:12; */
119#define IWL_frame_finished_stts_rb_num_POS 0
120#define IWL_frame_finished_stts_rb_num_LEN 12
121#define IWL_frame_finished_stts_rb_num_SYM frm_finished
122 /* __le32 rsrv3:4; */
123 /* __le32 frame_finished_stts_rx_frame_num:12; */
124#define IWL_frame_finished_stts_rx_frame_num_POS 16
125#define IWL_frame_finished_stts_rx_frame_num_LEN 12
126#define IWL_frame_finished_stts_rx_frame_num_SYM frm_finished
127 /* __le32 rsrv4:4; */
128
129 __le32 padding1; /* so that allocation will be aligned to 16B */
130 __le32 padding2;
131} __attribute__ ((packed)); 102} __attribute__ ((packed));
132 103
133#endif /* __iwl_5000_hw_h__ */ 104#endif /* __iwl_5000_hw_h__ */
diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c
index 31e62a838ad4..e81000cdcbc5 100644
--- a/drivers/net/wireless/iwlwifi/iwl-5000.c
+++ b/drivers/net/wireless/iwlwifi/iwl-5000.c
@@ -863,8 +863,6 @@ static int iwl5000_alloc_shared_mem(struct iwl_priv *priv)
863 863
864 memset(priv->shared_virt, 0, sizeof(struct iwl5000_shared)); 864 memset(priv->shared_virt, 0, sizeof(struct iwl5000_shared));
865 865
866 priv->rb_closed_offset = offsetof(struct iwl5000_shared, rb_closed);
867
868 return 0; 866 return 0;
869} 867}
870 868
@@ -877,12 +875,6 @@ static void iwl5000_free_shared_mem(struct iwl_priv *priv)
877 priv->shared_phys); 875 priv->shared_phys);
878} 876}
879 877
880static int iwl5000_shared_mem_rx_idx(struct iwl_priv *priv)
881{
882 struct iwl5000_shared *s = priv->shared_virt;
883 return le32_to_cpu(s->rb_closed) & 0xFFF;
884}
885
886/** 878/**
887 * iwl5000_txq_update_byte_cnt_tbl - Set up entry in Tx byte-count array 879 * iwl5000_txq_update_byte_cnt_tbl - Set up entry in Tx byte-count array
888 */ 880 */
@@ -1460,7 +1452,6 @@ static struct iwl_lib_ops iwl5000_lib = {
1460 .set_hw_params = iwl5000_hw_set_hw_params, 1452 .set_hw_params = iwl5000_hw_set_hw_params,
1461 .alloc_shared_mem = iwl5000_alloc_shared_mem, 1453 .alloc_shared_mem = iwl5000_alloc_shared_mem,
1462 .free_shared_mem = iwl5000_free_shared_mem, 1454 .free_shared_mem = iwl5000_free_shared_mem,
1463 .shared_mem_rx_idx = iwl5000_shared_mem_rx_idx,
1464 .txq_update_byte_cnt_tbl = iwl5000_txq_update_byte_cnt_tbl, 1455 .txq_update_byte_cnt_tbl = iwl5000_txq_update_byte_cnt_tbl,
1465 .txq_inval_byte_cnt_tbl = iwl5000_txq_inval_byte_cnt_tbl, 1456 .txq_inval_byte_cnt_tbl = iwl5000_txq_inval_byte_cnt_tbl,
1466 .txq_set_sched = iwl5000_txq_set_sched, 1457 .txq_set_sched = iwl5000_txq_set_sched,
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index 6404093e5366..c1ed02e206bb 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -1359,7 +1359,7 @@ void iwl_rx_handle(struct iwl_priv *priv)
1359 1359
1360 /* uCode's read index (stored in shared DRAM) indicates the last Rx 1360 /* uCode's read index (stored in shared DRAM) indicates the last Rx
1361 * buffer that the driver may process (last buffer filled by ucode). */ 1361 * buffer that the driver may process (last buffer filled by ucode). */
1362 r = priv->cfg->ops->lib->shared_mem_rx_idx(priv); 1362 r = le16_to_cpu(rxq->rb_stts->closed_rb_num) & 0x0FFF;
1363 i = rxq->read; 1363 i = rxq->read;
1364 1364
1365 /* Rx interrupt, but nothing sent from uCode */ 1365 /* Rx interrupt, but nothing sent from uCode */
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h
index 10f07f6e1737..1dca9d36f8c2 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.h
+++ b/drivers/net/wireless/iwlwifi/iwl-core.h
@@ -105,7 +105,6 @@ struct iwl_lib_ops {
105 /* ucode shared memory */ 105 /* ucode shared memory */
106 int (*alloc_shared_mem)(struct iwl_priv *priv); 106 int (*alloc_shared_mem)(struct iwl_priv *priv);
107 void (*free_shared_mem)(struct iwl_priv *priv); 107 void (*free_shared_mem)(struct iwl_priv *priv);
108 int (*shared_mem_rx_idx)(struct iwl_priv *priv);
109 /* Handling TX */ 108 /* Handling TX */
110 void (*txq_update_byte_cnt_tbl)(struct iwl_priv *priv, 109 void (*txq_update_byte_cnt_tbl)(struct iwl_priv *priv,
111 struct iwl_tx_queue *txq, 110 struct iwl_tx_queue *txq,
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h
index d509aed5567a..55590a55198d 100644
--- a/drivers/net/wireless/iwlwifi/iwl-dev.h
+++ b/drivers/net/wireless/iwlwifi/iwl-dev.h
@@ -301,7 +301,6 @@ struct iwl_host_cmd {
301 301
302/** 302/**
303 * struct iwl_rx_queue - Rx queue 303 * struct iwl_rx_queue - Rx queue
304 * @processed: Internal index to last handled Rx packet
305 * @read: Shared index to newest available Rx buffer 304 * @read: Shared index to newest available Rx buffer
306 * @write: Shared index to oldest written Rx packet 305 * @write: Shared index to oldest written Rx packet
307 * @free_count: Number of pre-allocated buffers in rx_free 306 * @free_count: Number of pre-allocated buffers in rx_free
@@ -316,13 +315,14 @@ struct iwl_rx_queue {
316 dma_addr_t dma_addr; 315 dma_addr_t dma_addr;
317 struct iwl_rx_mem_buffer pool[RX_QUEUE_SIZE + RX_FREE_BUFFERS]; 316 struct iwl_rx_mem_buffer pool[RX_QUEUE_SIZE + RX_FREE_BUFFERS];
318 struct iwl_rx_mem_buffer *queue[RX_QUEUE_SIZE]; 317 struct iwl_rx_mem_buffer *queue[RX_QUEUE_SIZE];
319 u32 processed;
320 u32 read; 318 u32 read;
321 u32 write; 319 u32 write;
322 u32 free_count; 320 u32 free_count;
323 struct list_head rx_free; 321 struct list_head rx_free;
324 struct list_head rx_used; 322 struct list_head rx_used;
325 int need_update; 323 int need_update;
324 struct iwl_rb_status *rb_stts;
325 dma_addr_t rb_stts_dma;
326 spinlock_t lock; 326 spinlock_t lock;
327}; 327};
328 328
@@ -967,10 +967,9 @@ struct iwl_priv {
967 struct ieee80211_vif *vif; 967 struct ieee80211_vif *vif;
968 968
969 struct iwl_hw_params hw_params; 969 struct iwl_hw_params hw_params;
970 /* driver/uCode shared Tx Byte Counts and Rx status */ 970 /* driver/uCode shared Tx Byte Counts */
971 void *shared_virt; 971 void *shared_virt;
972 int rb_closed_offset; 972 /* Physical Pointer to Tx Byte Counts */
973 /* Physical Pointer to Tx Byte Counts and Rx status */
974 dma_addr_t shared_phys; 973 dma_addr_t shared_phys;
975 974
976 /* Current association information needed to configure the 975 /* Current association information needed to configure the
diff --git a/drivers/net/wireless/iwlwifi/iwl-fh.h b/drivers/net/wireless/iwlwifi/iwl-fh.h
index 97e2cf41258d..153754277e07 100644
--- a/drivers/net/wireless/iwlwifi/iwl-fh.h
+++ b/drivers/net/wireless/iwlwifi/iwl-fh.h
@@ -403,5 +403,21 @@
403#define TFD_QUEUE_SIZE_BC_DUP (64) 403#define TFD_QUEUE_SIZE_BC_DUP (64)
404#define TFD_QUEUE_BC_SIZE (TFD_QUEUE_SIZE_MAX + TFD_QUEUE_SIZE_BC_DUP) 404#define TFD_QUEUE_BC_SIZE (TFD_QUEUE_SIZE_MAX + TFD_QUEUE_SIZE_BC_DUP)
405 405
406/**
407 * struct iwl_rb_status - reseve buffer status
408 * host memory mapped FH registers
409 * @closed_rb_num [0:11] - Indicates the index of the RB which was closed
410 * @closed_fr_num [0:11] - Indicates the index of the RX Frame which was closed
411 * @finished_rb_num [0:11] - Indicates the index of the current RB
412 * in which the last frame was written to
413 * @finished_fr_num [0:11] - Indicates the index of the RX Frame
414 * which was transfered
415 */
416struct iwl_rb_status {
417 __le16 closed_rb_num;
418 __le16 closed_fr_num;
419 __le16 finished_rb_num;
420 __le16 finished_fr_nam;
421} __attribute__ ((packed));
406 422
407#endif /* !__iwl_fh_h__ */ 423#endif /* !__iwl_fh_h__ */
diff --git a/drivers/net/wireless/iwlwifi/iwl-rx.c b/drivers/net/wireless/iwlwifi/iwl-rx.c
index b3c35c64d042..48d55741b769 100644
--- a/drivers/net/wireless/iwlwifi/iwl-rx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-rx.c
@@ -317,7 +317,10 @@ void iwl_rx_queue_free(struct iwl_priv *priv, struct iwl_rx_queue *rxq)
317 317
318 pci_free_consistent(priv->pci_dev, 4 * RX_QUEUE_SIZE, rxq->bd, 318 pci_free_consistent(priv->pci_dev, 4 * RX_QUEUE_SIZE, rxq->bd,
319 rxq->dma_addr); 319 rxq->dma_addr);
320 pci_free_consistent(priv->pci_dev, sizeof(struct iwl_rb_status),
321 rxq->rb_stts, rxq->rb_stts_dma);
320 rxq->bd = NULL; 322 rxq->bd = NULL;
323 rxq->rb_stts = NULL;
321} 324}
322EXPORT_SYMBOL(iwl_rx_queue_free); 325EXPORT_SYMBOL(iwl_rx_queue_free);
323 326
@@ -334,7 +337,12 @@ int iwl_rx_queue_alloc(struct iwl_priv *priv)
334 /* Alloc the circular buffer of Read Buffer Descriptors (RBDs) */ 337 /* Alloc the circular buffer of Read Buffer Descriptors (RBDs) */
335 rxq->bd = pci_alloc_consistent(dev, 4 * RX_QUEUE_SIZE, &rxq->dma_addr); 338 rxq->bd = pci_alloc_consistent(dev, 4 * RX_QUEUE_SIZE, &rxq->dma_addr);
336 if (!rxq->bd) 339 if (!rxq->bd)
337 return -ENOMEM; 340 goto err_bd;
341
342 rxq->rb_stts = pci_alloc_consistent(dev, sizeof(struct iwl_rb_status),
343 &rxq->rb_stts_dma);
344 if (!rxq->rb_stts)
345 goto err_rb;
338 346
339 /* Fill the rx_used queue with _all_ of the Rx buffers */ 347 /* Fill the rx_used queue with _all_ of the Rx buffers */
340 for (i = 0; i < RX_FREE_BUFFERS + RX_QUEUE_SIZE; i++) 348 for (i = 0; i < RX_FREE_BUFFERS + RX_QUEUE_SIZE; i++)
@@ -346,6 +354,12 @@ int iwl_rx_queue_alloc(struct iwl_priv *priv)
346 rxq->free_count = 0; 354 rxq->free_count = 0;
347 rxq->need_update = 0; 355 rxq->need_update = 0;
348 return 0; 356 return 0;
357
358err_rb:
359 pci_free_consistent(priv->pci_dev, 4 * RX_QUEUE_SIZE, rxq->bd,
360 rxq->dma_addr);
361err_bd:
362 return -ENOMEM;
349} 363}
350EXPORT_SYMBOL(iwl_rx_queue_alloc); 364EXPORT_SYMBOL(iwl_rx_queue_alloc);
351 365
@@ -412,7 +426,7 @@ int iwl_rx_init(struct iwl_priv *priv, struct iwl_rx_queue *rxq)
412 426
413 /* Tell device where in DRAM to update its Rx status */ 427 /* Tell device where in DRAM to update its Rx status */
414 iwl_write_direct32(priv, FH_RSCSR_CHNL0_STTS_WPTR_REG, 428 iwl_write_direct32(priv, FH_RSCSR_CHNL0_STTS_WPTR_REG,
415 (priv->shared_phys + priv->rb_closed_offset) >> 4); 429 rxq->rb_stts_dma >> 4);
416 430
417 /* Enable Rx DMA 431 /* Enable Rx DMA
418 * FH_RCSR_CHNL0_RX_IGNORE_RXF_EMPTY is set because of HW bug in 432 * FH_RCSR_CHNL0_RX_IGNORE_RXF_EMPTY is set because of HW bug in