diff options
author | Ivo van Doorn <ivdoorn@gmail.com> | 2007-11-12 09:02:40 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 18:04:40 -0500 |
commit | 3957ccb56e17ca839265ccb292c4c6850dcf5d32 (patch) | |
tree | bf579438b2f8e0d81160059e16eae97aa1254b77 | |
parent | 797a54c68e0eb551c60e3dc843627f967919a951 (diff) |
rt2x00: Move duplicate code into rt2x00pci_txdone()
rt2400pci, rt2500pci and rt61 require different
txdone handling, but the code that pushes the frame
upstream and cleans up the entry is identical to
all of them.
This will create the function rt2x00pci_txdone()
to remove the duplicate code.
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.c | 20 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2500pci.c | 20 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00pci.c | 33 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00pci.h | 4 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt61pci.c | 19 |
5 files changed, 38 insertions, 58 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2400pci.c b/drivers/net/wireless/rt2x00/rt2400pci.c index d48b6ca9845a..bdf3edc6524f 100644 --- a/drivers/net/wireless/rt2x00/rt2400pci.c +++ b/drivers/net/wireless/rt2x00/rt2400pci.c | |||
@@ -1167,26 +1167,8 @@ static void rt2400pci_txdone(struct rt2x00_dev *rt2x00dev, const int queue) | |||
1167 | tx_status = rt2x00_get_field32(word, TXD_W0_RESULT); | 1167 | tx_status = rt2x00_get_field32(word, TXD_W0_RESULT); |
1168 | retry = rt2x00_get_field32(word, TXD_W0_RETRY_COUNT); | 1168 | retry = rt2x00_get_field32(word, TXD_W0_RETRY_COUNT); |
1169 | 1169 | ||
1170 | rt2x00lib_txdone(entry, tx_status, retry); | 1170 | rt2x00pci_txdone(rt2x00dev, entry, tx_status, retry); |
1171 | |||
1172 | /* | ||
1173 | * Make this entry available for reuse. | ||
1174 | */ | ||
1175 | entry->flags = 0; | ||
1176 | rt2x00_set_field32(&word, TXD_W0_VALID, 0); | ||
1177 | rt2x00_desc_write(txd, 0, word); | ||
1178 | rt2x00_ring_index_done_inc(ring); | ||
1179 | } | 1171 | } |
1180 | |||
1181 | /* | ||
1182 | * If the data ring was full before the txdone handler | ||
1183 | * we must make sure the packet queue in the mac80211 stack | ||
1184 | * is reenabled when the txdone handler has finished. | ||
1185 | */ | ||
1186 | entry = ring->entry; | ||
1187 | if (!rt2x00_ring_full(ring)) | ||
1188 | ieee80211_wake_queue(rt2x00dev->hw, | ||
1189 | entry->tx_status.control.queue); | ||
1190 | } | 1172 | } |
1191 | 1173 | ||
1192 | static irqreturn_t rt2400pci_interrupt(int irq, void *dev_instance) | 1174 | static irqreturn_t rt2400pci_interrupt(int irq, void *dev_instance) |
diff --git a/drivers/net/wireless/rt2x00/rt2500pci.c b/drivers/net/wireless/rt2x00/rt2500pci.c index e6a0c37d9195..b6bb9644e25f 100644 --- a/drivers/net/wireless/rt2x00/rt2500pci.c +++ b/drivers/net/wireless/rt2x00/rt2500pci.c | |||
@@ -1298,26 +1298,8 @@ static void rt2500pci_txdone(struct rt2x00_dev *rt2x00dev, const int queue) | |||
1298 | tx_status = rt2x00_get_field32(word, TXD_W0_RESULT); | 1298 | tx_status = rt2x00_get_field32(word, TXD_W0_RESULT); |
1299 | retry = rt2x00_get_field32(word, TXD_W0_RETRY_COUNT); | 1299 | retry = rt2x00_get_field32(word, TXD_W0_RETRY_COUNT); |
1300 | 1300 | ||
1301 | rt2x00lib_txdone(entry, tx_status, retry); | 1301 | rt2x00pci_txdone(rt2x00dev, entry, tx_status, retry); |
1302 | |||
1303 | /* | ||
1304 | * Make this entry available for reuse. | ||
1305 | */ | ||
1306 | entry->flags = 0; | ||
1307 | rt2x00_set_field32(&word, TXD_W0_VALID, 0); | ||
1308 | rt2x00_desc_write(txd, 0, word); | ||
1309 | rt2x00_ring_index_done_inc(ring); | ||
1310 | } | 1302 | } |
1311 | |||
1312 | /* | ||
1313 | * If the data ring was full before the txdone handler | ||
1314 | * we must make sure the packet queue in the mac80211 stack | ||
1315 | * is reenabled when the txdone handler has finished. | ||
1316 | */ | ||
1317 | entry = ring->entry; | ||
1318 | if (!rt2x00_ring_full(ring)) | ||
1319 | ieee80211_wake_queue(rt2x00dev->hw, | ||
1320 | entry->tx_status.control.queue); | ||
1321 | } | 1303 | } |
1322 | 1304 | ||
1323 | static irqreturn_t rt2500pci_interrupt(int irq, void *dev_instance) | 1305 | static irqreturn_t rt2500pci_interrupt(int irq, void *dev_instance) |
diff --git a/drivers/net/wireless/rt2x00/rt2x00pci.c b/drivers/net/wireless/rt2x00/rt2x00pci.c index fa85771cbf47..55d0614588b2 100644 --- a/drivers/net/wireless/rt2x00/rt2x00pci.c +++ b/drivers/net/wireless/rt2x00/rt2x00pci.c | |||
@@ -116,7 +116,7 @@ int rt2x00pci_write_tx_data(struct rt2x00_dev *rt2x00dev, | |||
116 | EXPORT_SYMBOL_GPL(rt2x00pci_write_tx_data); | 116 | EXPORT_SYMBOL_GPL(rt2x00pci_write_tx_data); |
117 | 117 | ||
118 | /* | 118 | /* |
119 | * RX data handlers. | 119 | * TX/RX data handlers. |
120 | */ | 120 | */ |
121 | void rt2x00pci_rxdone(struct rt2x00_dev *rt2x00dev) | 121 | void rt2x00pci_rxdone(struct rt2x00_dev *rt2x00dev) |
122 | { | 122 | { |
@@ -177,6 +177,37 @@ void rt2x00pci_rxdone(struct rt2x00_dev *rt2x00dev) | |||
177 | } | 177 | } |
178 | EXPORT_SYMBOL_GPL(rt2x00pci_rxdone); | 178 | EXPORT_SYMBOL_GPL(rt2x00pci_rxdone); |
179 | 179 | ||
180 | void rt2x00pci_txdone(struct rt2x00_dev *rt2x00dev, struct data_entry *entry, | ||
181 | const int tx_status, const int retry) | ||
182 | { | ||
183 | u32 word; | ||
184 | |||
185 | rt2x00lib_txdone(entry, tx_status, retry); | ||
186 | |||
187 | /* | ||
188 | * Make this entry available for reuse. | ||
189 | */ | ||
190 | entry->flags = 0; | ||
191 | |||
192 | rt2x00_desc_read(entry->priv, 0, &word); | ||
193 | rt2x00_set_field32(&word, TXD_ENTRY_OWNER_NIC, 0); | ||
194 | rt2x00_set_field32(&word, TXD_ENTRY_VALID, 0); | ||
195 | rt2x00_desc_write(entry->priv, 0, word); | ||
196 | |||
197 | rt2x00_ring_index_done_inc(entry->ring); | ||
198 | |||
199 | /* | ||
200 | * If the data ring was full before the txdone handler | ||
201 | * we must make sure the packet queue in the mac80211 stack | ||
202 | * is reenabled when the txdone handler has finished. | ||
203 | */ | ||
204 | if (!rt2x00_ring_full(entry->ring)) | ||
205 | ieee80211_wake_queue(rt2x00dev->hw, | ||
206 | entry->tx_status.control.queue); | ||
207 | |||
208 | } | ||
209 | EXPORT_SYMBOL_GPL(rt2x00pci_txdone); | ||
210 | |||
180 | /* | 211 | /* |
181 | * Device initialization handlers. | 212 | * Device initialization handlers. |
182 | */ | 213 | */ |
diff --git a/drivers/net/wireless/rt2x00/rt2x00pci.h b/drivers/net/wireless/rt2x00/rt2x00pci.h index 03572054509a..2d1eb8144da4 100644 --- a/drivers/net/wireless/rt2x00/rt2x00pci.h +++ b/drivers/net/wireless/rt2x00/rt2x00pci.h | |||
@@ -101,9 +101,11 @@ int rt2x00pci_write_tx_data(struct rt2x00_dev *rt2x00dev, | |||
101 | struct ieee80211_tx_control *control); | 101 | struct ieee80211_tx_control *control); |
102 | 102 | ||
103 | /* | 103 | /* |
104 | * RX data handlers. | 104 | * RX/TX data handlers. |
105 | */ | 105 | */ |
106 | void rt2x00pci_rxdone(struct rt2x00_dev *rt2x00dev); | 106 | void rt2x00pci_rxdone(struct rt2x00_dev *rt2x00dev); |
107 | void rt2x00pci_txdone(struct rt2x00_dev *rt2x00dev, struct data_entry *entry, | ||
108 | const int tx_status, const int retry); | ||
107 | 109 | ||
108 | /* | 110 | /* |
109 | * Device initialization handlers. | 111 | * Device initialization handlers. |
diff --git a/drivers/net/wireless/rt2x00/rt61pci.c b/drivers/net/wireless/rt2x00/rt61pci.c index 606cf1299fff..40e516b70fed 100644 --- a/drivers/net/wireless/rt2x00/rt61pci.c +++ b/drivers/net/wireless/rt2x00/rt61pci.c | |||
@@ -1779,24 +1779,7 @@ static void rt61pci_txdone(struct rt2x00_dev *rt2x00dev) | |||
1779 | tx_status = rt2x00_get_field32(reg, STA_CSR4_TX_RESULT); | 1779 | tx_status = rt2x00_get_field32(reg, STA_CSR4_TX_RESULT); |
1780 | retry = rt2x00_get_field32(reg, STA_CSR4_RETRY_COUNT); | 1780 | retry = rt2x00_get_field32(reg, STA_CSR4_RETRY_COUNT); |
1781 | 1781 | ||
1782 | rt2x00lib_txdone(entry, tx_status, retry); | 1782 | rt2x00pci_txdone(rt2x00dev, entry, tx_status, retry); |
1783 | |||
1784 | /* | ||
1785 | * Make this entry available for reuse. | ||
1786 | */ | ||
1787 | entry->flags = 0; | ||
1788 | rt2x00_set_field32(&word, TXD_W0_VALID, 0); | ||
1789 | rt2x00_desc_write(txd, 0, word); | ||
1790 | rt2x00_ring_index_done_inc(entry->ring); | ||
1791 | |||
1792 | /* | ||
1793 | * If the data ring was full before the txdone handler | ||
1794 | * we must make sure the packet queue in the mac80211 stack | ||
1795 | * is reenabled when the txdone handler has finished. | ||
1796 | */ | ||
1797 | if (!rt2x00_ring_full(ring)) | ||
1798 | ieee80211_wake_queue(rt2x00dev->hw, | ||
1799 | entry->tx_status.control.queue); | ||
1800 | } | 1783 | } |
1801 | } | 1784 | } |
1802 | 1785 | ||