aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorIvo van Doorn <ivdoorn@gmail.com>2008-01-06 17:39:25 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 18:09:24 -0500
commit042671040db95a896c5ca960b9b656692a787892 (patch)
treeb96a4e931b65c912f2800b02480b14008125c01b /drivers/net
parent3867705bb773818b39e0ca8d02ccb71fb4d2ffb8 (diff)
rt2x00: Store queue idx and entry idx in data_ring and data_entry
Store the queue idx inside structure data_ring Store the entry idx inside structure data_entry This saves us a few calls to ARRAY_INDEX() which is now unused. Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00.h6
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00debug.c8
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00dev.c4
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00ring.h12
-rw-r--r--drivers/net/wireless/rt2x00/rt61pci.c6
5 files changed, 22 insertions, 14 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h
index 85cfdab801ba..5e4cb3ee2eae 100644
--- a/drivers/net/wireless/rt2x00/rt2x00.h
+++ b/drivers/net/wireless/rt2x00/rt2x00.h
@@ -796,12 +796,6 @@ struct rt2x00_dev {
796 ring_loop(__entry, (__dev)->tx, ring_end(__dev)) 796 ring_loop(__entry, (__dev)->tx, ring_end(__dev))
797 797
798/* 798/*
799 * Compute an array index from a pointer to an element and the base pointer.
800 */
801#define ARRAY_INDEX(__elem, __base) \
802 ( ((char *)(__elem) - (char *)(__base)) / sizeof(*(__elem)) )
803
804/*
805 * Generic RF access. 799 * Generic RF access.
806 * The RF is being accessed by word index. 800 * The RF is being accessed by word index.
807 */ 801 */
diff --git a/drivers/net/wireless/rt2x00/rt2x00debug.c b/drivers/net/wireless/rt2x00/rt2x00debug.c
index c55bf0eea274..b44a9f4b9b7f 100644
--- a/drivers/net/wireless/rt2x00/rt2x00debug.c
+++ b/drivers/net/wireless/rt2x00/rt2x00debug.c
@@ -120,12 +120,8 @@ void rt2x00debug_dump_frame(struct rt2x00_dev *rt2x00dev,
120 struct sk_buff *skbcopy; 120 struct sk_buff *skbcopy;
121 struct rt2x00dump_hdr *dump_hdr; 121 struct rt2x00dump_hdr *dump_hdr;
122 struct timeval timestamp; 122 struct timeval timestamp;
123 unsigned int ring_index;
124 unsigned int entry_index;
125 123
126 do_gettimeofday(&timestamp); 124 do_gettimeofday(&timestamp);
127 ring_index = ARRAY_INDEX(desc->ring, rt2x00dev->rx);
128 entry_index = ARRAY_INDEX(desc->entry, desc->ring->entry);
129 125
130 if (!test_bit(FRAME_DUMP_FILE_OPEN, &intf->frame_dump_flags)) 126 if (!test_bit(FRAME_DUMP_FILE_OPEN, &intf->frame_dump_flags))
131 return; 127 return;
@@ -151,8 +147,8 @@ void rt2x00debug_dump_frame(struct rt2x00_dev *rt2x00dev,
151 dump_hdr->chip_rf = cpu_to_le16(rt2x00dev->chip.rf); 147 dump_hdr->chip_rf = cpu_to_le16(rt2x00dev->chip.rf);
152 dump_hdr->chip_rev = cpu_to_le32(rt2x00dev->chip.rev); 148 dump_hdr->chip_rev = cpu_to_le32(rt2x00dev->chip.rev);
153 dump_hdr->type = cpu_to_le16(desc->frame_type); 149 dump_hdr->type = cpu_to_le16(desc->frame_type);
154 dump_hdr->ring_index = ring_index; 150 dump_hdr->ring_index = desc->ring->queue_idx;
155 dump_hdr->entry_index = entry_index; 151 dump_hdr->entry_index = desc->entry->entry_idx;
156 dump_hdr->timestamp_sec = cpu_to_le32(timestamp.tv_sec); 152 dump_hdr->timestamp_sec = cpu_to_le32(timestamp.tv_sec);
157 dump_hdr->timestamp_usec = cpu_to_le32(timestamp.tv_usec); 153 dump_hdr->timestamp_usec = cpu_to_le32(timestamp.tv_usec);
158 154
diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c
index a771a092434b..9b2bd9176467 100644
--- a/drivers/net/wireless/rt2x00/rt2x00dev.c
+++ b/drivers/net/wireless/rt2x00/rt2x00dev.c
@@ -988,6 +988,7 @@ static int rt2x00lib_alloc_entries(struct data_ring *ring,
988 entry[i].flags = 0; 988 entry[i].flags = 0;
989 entry[i].ring = ring; 989 entry[i].ring = ring;
990 entry[i].skb = NULL; 990 entry[i].skb = NULL;
991 entry[i].entry_idx = i;
991 } 992 }
992 993
993 ring->entry = entry; 994 ring->entry = entry;
@@ -1115,6 +1116,7 @@ exit:
1115static int rt2x00lib_alloc_rings(struct rt2x00_dev *rt2x00dev) 1116static int rt2x00lib_alloc_rings(struct rt2x00_dev *rt2x00dev)
1116{ 1117{
1117 struct data_ring *ring; 1118 struct data_ring *ring;
1119 unsigned int index;
1118 1120
1119 /* 1121 /*
1120 * We need the following rings: 1122 * We need the following rings:
@@ -1145,8 +1147,10 @@ static int rt2x00lib_alloc_rings(struct rt2x00_dev *rt2x00dev)
1145 * cw_min: 2^5 = 32. 1147 * cw_min: 2^5 = 32.
1146 * cw_max: 2^10 = 1024. 1148 * cw_max: 2^10 = 1024.
1147 */ 1149 */
1150 index = 0;
1148 ring_for_each(rt2x00dev, ring) { 1151 ring_for_each(rt2x00dev, ring) {
1149 ring->rt2x00dev = rt2x00dev; 1152 ring->rt2x00dev = rt2x00dev;
1153 ring->queue_idx = index++;
1150 ring->tx_params.aifs = 2; 1154 ring->tx_params.aifs = 2;
1151 ring->tx_params.cw_min = 5; 1155 ring->tx_params.cw_min = 5;
1152 ring->tx_params.cw_max = 10; 1156 ring->tx_params.cw_max = 10;
diff --git a/drivers/net/wireless/rt2x00/rt2x00ring.h b/drivers/net/wireless/rt2x00/rt2x00ring.h
index 5b32f3ef2a73..e9a564863127 100644
--- a/drivers/net/wireless/rt2x00/rt2x00ring.h
+++ b/drivers/net/wireless/rt2x00/rt2x00ring.h
@@ -143,6 +143,11 @@ struct data_entry {
143 */ 143 */
144 void *data_addr; 144 void *data_addr;
145 dma_addr_t data_dma; 145 dma_addr_t data_dma;
146
147 /*
148 * Entry identification number (index).
149 */
150 unsigned int entry_idx;
146}; 151};
147 152
148/* 153/*
@@ -181,6 +186,13 @@ struct data_ring {
181 void *data_addr; 186 void *data_addr;
182 187
183 /* 188 /*
189 * Queue identification number:
190 * RX: 0
191 * TX: IEEE80211_TX_*
192 */
193 unsigned int queue_idx;
194
195 /*
184 * Index variables. 196 * Index variables.
185 */ 197 */
186 u16 index; 198 u16 index;
diff --git a/drivers/net/wireless/rt2x00/rt61pci.c b/drivers/net/wireless/rt2x00/rt61pci.c
index 1bbeed66c524..fc36320a5f13 100644
--- a/drivers/net/wireless/rt2x00/rt61pci.c
+++ b/drivers/net/wireless/rt2x00/rt61pci.c
@@ -1031,8 +1031,10 @@ static void rt61pci_init_txring(struct rt2x00_dev *rt2x00dev, const int queue)
1031 rt2x00_desc_write(txd, 1, word); 1031 rt2x00_desc_write(txd, 1, word);
1032 1032
1033 rt2x00_desc_read(txd, 5, &word); 1033 rt2x00_desc_read(txd, 5, &word);
1034 rt2x00_set_field32(&word, TXD_W5_PID_TYPE, queue); 1034 rt2x00_set_field32(&word, TXD_W5_PID_TYPE,
1035 rt2x00_set_field32(&word, TXD_W5_PID_SUBTYPE, i); 1035 ring->queue_idx);
1036 rt2x00_set_field32(&word, TXD_W5_PID_SUBTYPE,
1037 ring->entry[i].entry_idx);
1036 rt2x00_desc_write(txd, 5, word); 1038 rt2x00_desc_write(txd, 5, word);
1037 1039
1038 rt2x00_desc_read(txd, 6, &word); 1040 rt2x00_desc_read(txd, 6, &word);