aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGertjan van Wingerde <gwingerde@gmail.com>2011-03-03 13:46:09 -0500
committerJohn W. Linville <linville@tuxdriver.com>2011-03-04 14:06:49 -0500
commite74df4a7562da56a7e4dbf41ff167b2f44e84a50 (patch)
treea845c66206b7a7cb3425ae1b6c39608aaaeafabb
parent3736fe5808577f9d3a31a565ef4e78ceae250c98 (diff)
rt2x00: Don't treat ATIM queue as second beacon queue.
Current code for the atim queue is strange, as it is considered in the rt2x00_dev structure as a second beacon queue. Normalize this by letting the atim queue have its own struct data_queue pointer in the rt2x00_dev structure. Signed-off-by: Gertjan van Wingerde <gwingerde@gmail.com> Acked-by: Helmut Schaa <helmut.schaa@googlemail.com> Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/net/wireless/rt2x00/rt2400pci.c6
-rw-r--r--drivers/net/wireless/rt2x00/rt2500pci.c6
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00.h5
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00queue.c19
4 files changed, 16 insertions, 20 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2400pci.c b/drivers/net/wireless/rt2x00/rt2400pci.c
index 80f4988adf80..d78d39e4730a 100644
--- a/drivers/net/wireless/rt2x00/rt2400pci.c
+++ b/drivers/net/wireless/rt2x00/rt2400pci.c
@@ -779,7 +779,7 @@ static int rt2400pci_init_queues(struct rt2x00_dev *rt2x00dev)
779 rt2x00pci_register_read(rt2x00dev, TXCSR2, &reg); 779 rt2x00pci_register_read(rt2x00dev, TXCSR2, &reg);
780 rt2x00_set_field32(&reg, TXCSR2_TXD_SIZE, rt2x00dev->tx[0].desc_size); 780 rt2x00_set_field32(&reg, TXCSR2_TXD_SIZE, rt2x00dev->tx[0].desc_size);
781 rt2x00_set_field32(&reg, TXCSR2_NUM_TXD, rt2x00dev->tx[1].limit); 781 rt2x00_set_field32(&reg, TXCSR2_NUM_TXD, rt2x00dev->tx[1].limit);
782 rt2x00_set_field32(&reg, TXCSR2_NUM_ATIM, rt2x00dev->bcn[1].limit); 782 rt2x00_set_field32(&reg, TXCSR2_NUM_ATIM, rt2x00dev->atim->limit);
783 rt2x00_set_field32(&reg, TXCSR2_NUM_PRIO, rt2x00dev->tx[0].limit); 783 rt2x00_set_field32(&reg, TXCSR2_NUM_PRIO, rt2x00dev->tx[0].limit);
784 rt2x00pci_register_write(rt2x00dev, TXCSR2, reg); 784 rt2x00pci_register_write(rt2x00dev, TXCSR2, reg);
785 785
@@ -795,13 +795,13 @@ static int rt2400pci_init_queues(struct rt2x00_dev *rt2x00dev)
795 entry_priv->desc_dma); 795 entry_priv->desc_dma);
796 rt2x00pci_register_write(rt2x00dev, TXCSR5, reg); 796 rt2x00pci_register_write(rt2x00dev, TXCSR5, reg);
797 797
798 entry_priv = rt2x00dev->bcn[1].entries[0].priv_data; 798 entry_priv = rt2x00dev->atim->entries[0].priv_data;
799 rt2x00pci_register_read(rt2x00dev, TXCSR4, &reg); 799 rt2x00pci_register_read(rt2x00dev, TXCSR4, &reg);
800 rt2x00_set_field32(&reg, TXCSR4_ATIM_RING_REGISTER, 800 rt2x00_set_field32(&reg, TXCSR4_ATIM_RING_REGISTER,
801 entry_priv->desc_dma); 801 entry_priv->desc_dma);
802 rt2x00pci_register_write(rt2x00dev, TXCSR4, reg); 802 rt2x00pci_register_write(rt2x00dev, TXCSR4, reg);
803 803
804 entry_priv = rt2x00dev->bcn[0].entries[0].priv_data; 804 entry_priv = rt2x00dev->bcn->entries[0].priv_data;
805 rt2x00pci_register_read(rt2x00dev, TXCSR6, &reg); 805 rt2x00pci_register_read(rt2x00dev, TXCSR6, &reg);
806 rt2x00_set_field32(&reg, TXCSR6_BEACON_RING_REGISTER, 806 rt2x00_set_field32(&reg, TXCSR6_BEACON_RING_REGISTER,
807 entry_priv->desc_dma); 807 entry_priv->desc_dma);
diff --git a/drivers/net/wireless/rt2x00/rt2500pci.c b/drivers/net/wireless/rt2x00/rt2500pci.c
index 635f80466540..3fb09151c918 100644
--- a/drivers/net/wireless/rt2x00/rt2500pci.c
+++ b/drivers/net/wireless/rt2x00/rt2500pci.c
@@ -865,7 +865,7 @@ static int rt2500pci_init_queues(struct rt2x00_dev *rt2x00dev)
865 rt2x00pci_register_read(rt2x00dev, TXCSR2, &reg); 865 rt2x00pci_register_read(rt2x00dev, TXCSR2, &reg);
866 rt2x00_set_field32(&reg, TXCSR2_TXD_SIZE, rt2x00dev->tx[0].desc_size); 866 rt2x00_set_field32(&reg, TXCSR2_TXD_SIZE, rt2x00dev->tx[0].desc_size);
867 rt2x00_set_field32(&reg, TXCSR2_NUM_TXD, rt2x00dev->tx[1].limit); 867 rt2x00_set_field32(&reg, TXCSR2_NUM_TXD, rt2x00dev->tx[1].limit);
868 rt2x00_set_field32(&reg, TXCSR2_NUM_ATIM, rt2x00dev->bcn[1].limit); 868 rt2x00_set_field32(&reg, TXCSR2_NUM_ATIM, rt2x00dev->atim->limit);
869 rt2x00_set_field32(&reg, TXCSR2_NUM_PRIO, rt2x00dev->tx[0].limit); 869 rt2x00_set_field32(&reg, TXCSR2_NUM_PRIO, rt2x00dev->tx[0].limit);
870 rt2x00pci_register_write(rt2x00dev, TXCSR2, reg); 870 rt2x00pci_register_write(rt2x00dev, TXCSR2, reg);
871 871
@@ -881,13 +881,13 @@ static int rt2500pci_init_queues(struct rt2x00_dev *rt2x00dev)
881 entry_priv->desc_dma); 881 entry_priv->desc_dma);
882 rt2x00pci_register_write(rt2x00dev, TXCSR5, reg); 882 rt2x00pci_register_write(rt2x00dev, TXCSR5, reg);
883 883
884 entry_priv = rt2x00dev->bcn[1].entries[0].priv_data; 884 entry_priv = rt2x00dev->atim->entries[0].priv_data;
885 rt2x00pci_register_read(rt2x00dev, TXCSR4, &reg); 885 rt2x00pci_register_read(rt2x00dev, TXCSR4, &reg);
886 rt2x00_set_field32(&reg, TXCSR4_ATIM_RING_REGISTER, 886 rt2x00_set_field32(&reg, TXCSR4_ATIM_RING_REGISTER,
887 entry_priv->desc_dma); 887 entry_priv->desc_dma);
888 rt2x00pci_register_write(rt2x00dev, TXCSR4, reg); 888 rt2x00pci_register_write(rt2x00dev, TXCSR4, reg);
889 889
890 entry_priv = rt2x00dev->bcn[0].entries[0].priv_data; 890 entry_priv = rt2x00dev->bcn->entries[0].priv_data;
891 rt2x00pci_register_read(rt2x00dev, TXCSR6, &reg); 891 rt2x00pci_register_read(rt2x00dev, TXCSR6, &reg);
892 rt2x00_set_field32(&reg, TXCSR6_BEACON_RING_REGISTER, 892 rt2x00_set_field32(&reg, TXCSR6_BEACON_RING_REGISTER,
893 entry_priv->desc_dma); 893 entry_priv->desc_dma);
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h
index c28ee07fad9f..65636a7eba16 100644
--- a/drivers/net/wireless/rt2x00/rt2x00.h
+++ b/drivers/net/wireless/rt2x00/rt2x00.h
@@ -887,14 +887,13 @@ struct rt2x00_dev {
887 struct work_struct txdone_work; 887 struct work_struct txdone_work;
888 888
889 /* 889 /*
890 * Data queue arrays for RX, TX and Beacon. 890 * Data queue arrays for RX, TX, Beacon and ATIM.
891 * The Beacon array also contains the Atim queue
892 * if that is supported by the device.
893 */ 891 */
894 unsigned int data_queues; 892 unsigned int data_queues;
895 struct data_queue *rx; 893 struct data_queue *rx;
896 struct data_queue *tx; 894 struct data_queue *tx;
897 struct data_queue *bcn; 895 struct data_queue *bcn;
896 struct data_queue *atim;
898 897
899 /* 898 /*
900 * Firmware image. 899 * Firmware image.
diff --git a/drivers/net/wireless/rt2x00/rt2x00queue.c b/drivers/net/wireless/rt2x00/rt2x00queue.c
index f06b5c797492..fcaacc6dc0f1 100644
--- a/drivers/net/wireless/rt2x00/rt2x00queue.c
+++ b/drivers/net/wireless/rt2x00/rt2x00queue.c
@@ -708,21 +708,17 @@ EXPORT_SYMBOL_GPL(rt2x00queue_for_each_entry);
708struct data_queue *rt2x00queue_get_queue(struct rt2x00_dev *rt2x00dev, 708struct data_queue *rt2x00queue_get_queue(struct rt2x00_dev *rt2x00dev,
709 const enum data_queue_qid queue) 709 const enum data_queue_qid queue)
710{ 710{
711 int atim = test_bit(DRIVER_REQUIRE_ATIM_QUEUE, &rt2x00dev->flags);
712
713 if (queue == QID_RX) 711 if (queue == QID_RX)
714 return rt2x00dev->rx; 712 return rt2x00dev->rx;
715 713
716 if (queue < rt2x00dev->ops->tx_queues && rt2x00dev->tx) 714 if (queue < rt2x00dev->ops->tx_queues && rt2x00dev->tx)
717 return &rt2x00dev->tx[queue]; 715 return &rt2x00dev->tx[queue];
718 716
719 if (!rt2x00dev->bcn)
720 return NULL;
721
722 if (queue == QID_BEACON) 717 if (queue == QID_BEACON)
723 return &rt2x00dev->bcn[0]; 718 return rt2x00dev->bcn;
724 else if (queue == QID_ATIM && atim) 719
725 return &rt2x00dev->bcn[1]; 720 if (queue == QID_ATIM)
721 return rt2x00dev->atim;
726 722
727 return NULL; 723 return NULL;
728} 724}
@@ -1103,7 +1099,7 @@ int rt2x00queue_initialize(struct rt2x00_dev *rt2x00dev)
1103 goto exit; 1099 goto exit;
1104 1100
1105 if (test_bit(DRIVER_REQUIRE_ATIM_QUEUE, &rt2x00dev->flags)) { 1101 if (test_bit(DRIVER_REQUIRE_ATIM_QUEUE, &rt2x00dev->flags)) {
1106 status = rt2x00queue_alloc_entries(&rt2x00dev->bcn[1], 1102 status = rt2x00queue_alloc_entries(rt2x00dev->atim,
1107 rt2x00dev->ops->atim); 1103 rt2x00dev->ops->atim);
1108 if (status) 1104 if (status)
1109 goto exit; 1105 goto exit;
@@ -1177,6 +1173,7 @@ int rt2x00queue_allocate(struct rt2x00_dev *rt2x00dev)
1177 rt2x00dev->rx = queue; 1173 rt2x00dev->rx = queue;
1178 rt2x00dev->tx = &queue[1]; 1174 rt2x00dev->tx = &queue[1];
1179 rt2x00dev->bcn = &queue[1 + rt2x00dev->ops->tx_queues]; 1175 rt2x00dev->bcn = &queue[1 + rt2x00dev->ops->tx_queues];
1176 rt2x00dev->atim = req_atim ? &queue[2 + rt2x00dev->ops->tx_queues] : NULL;
1180 1177
1181 /* 1178 /*
1182 * Initialize queue parameters. 1179 * Initialize queue parameters.
@@ -1193,9 +1190,9 @@ int rt2x00queue_allocate(struct rt2x00_dev *rt2x00dev)
1193 tx_queue_for_each(rt2x00dev, queue) 1190 tx_queue_for_each(rt2x00dev, queue)
1194 rt2x00queue_init(rt2x00dev, queue, qid++); 1191 rt2x00queue_init(rt2x00dev, queue, qid++);
1195 1192
1196 rt2x00queue_init(rt2x00dev, &rt2x00dev->bcn[0], QID_BEACON); 1193 rt2x00queue_init(rt2x00dev, rt2x00dev->bcn, QID_BEACON);
1197 if (req_atim) 1194 if (req_atim)
1198 rt2x00queue_init(rt2x00dev, &rt2x00dev->bcn[1], QID_ATIM); 1195 rt2x00queue_init(rt2x00dev, rt2x00dev->atim, QID_ATIM);
1199 1196
1200 return 0; 1197 return 0;
1201} 1198}