]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commitdiff
rt2x00: Move duplicate code into rt2x00pci_txdone()
authorIvo van Doorn <ivdoorn@gmail.com>
Mon, 12 Nov 2007 14:02:40 +0000 (15:02 +0100)
committerDavid S. Miller <davem@davemloft.net>
Mon, 28 Jan 2008 23:04:40 +0000 (15:04 -0800)
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>
drivers/net/wireless/rt2x00/rt2400pci.c
drivers/net/wireless/rt2x00/rt2500pci.c
drivers/net/wireless/rt2x00/rt2x00pci.c
drivers/net/wireless/rt2x00/rt2x00pci.h
drivers/net/wireless/rt2x00/rt61pci.c

index d48b6ca9845a6e2aa8c723aac623524db528e4db..bdf3edc6524fcfe21563d5515cac71132101d73f 100644 (file)
@@ -1167,26 +1167,8 @@ static void rt2400pci_txdone(struct rt2x00_dev *rt2x00dev, const int queue)
                tx_status = rt2x00_get_field32(word, TXD_W0_RESULT);
                retry = rt2x00_get_field32(word, TXD_W0_RETRY_COUNT);
 
-               rt2x00lib_txdone(entry, tx_status, retry);
-
-               /*
-                * Make this entry available for reuse.
-                */
-               entry->flags = 0;
-               rt2x00_set_field32(&word, TXD_W0_VALID, 0);
-               rt2x00_desc_write(txd, 0, word);
-               rt2x00_ring_index_done_inc(ring);
+               rt2x00pci_txdone(rt2x00dev, entry, tx_status, retry);
        }
-
-       /*
-        * If the data ring was full before the txdone handler
-        * we must make sure the packet queue in the mac80211 stack
-        * is reenabled when the txdone handler has finished.
-        */
-       entry = ring->entry;
-       if (!rt2x00_ring_full(ring))
-               ieee80211_wake_queue(rt2x00dev->hw,
-                                    entry->tx_status.control.queue);
 }
 
 static irqreturn_t rt2400pci_interrupt(int irq, void *dev_instance)
index e6a0c37d919539b6a6263c8c9d876d1c9ca7061d..b6bb9644e25f2bc0b59cfcad5426d27cf907bb35 100644 (file)
@@ -1298,26 +1298,8 @@ static void rt2500pci_txdone(struct rt2x00_dev *rt2x00dev, const int queue)
                tx_status = rt2x00_get_field32(word, TXD_W0_RESULT);
                retry = rt2x00_get_field32(word, TXD_W0_RETRY_COUNT);
 
-               rt2x00lib_txdone(entry, tx_status, retry);
-
-               /*
-                * Make this entry available for reuse.
-                */
-               entry->flags = 0;
-               rt2x00_set_field32(&word, TXD_W0_VALID, 0);
-               rt2x00_desc_write(txd, 0, word);
-               rt2x00_ring_index_done_inc(ring);
+               rt2x00pci_txdone(rt2x00dev, entry, tx_status, retry);
        }
-
-       /*
-        * If the data ring was full before the txdone handler
-        * we must make sure the packet queue in the mac80211 stack
-        * is reenabled when the txdone handler has finished.
-        */
-       entry = ring->entry;
-       if (!rt2x00_ring_full(ring))
-               ieee80211_wake_queue(rt2x00dev->hw,
-                                    entry->tx_status.control.queue);
 }
 
 static irqreturn_t rt2500pci_interrupt(int irq, void *dev_instance)
index fa85771cbf4738f6eda6299e8960475bb3f6f300..55d0614588b267bdec9193eb7b19ceefb3acb53a 100644 (file)
@@ -116,7 +116,7 @@ int rt2x00pci_write_tx_data(struct rt2x00_dev *rt2x00dev,
 EXPORT_SYMBOL_GPL(rt2x00pci_write_tx_data);
 
 /*
- * RX data handlers.
+ * TX/RX data handlers.
  */
 void rt2x00pci_rxdone(struct rt2x00_dev *rt2x00dev)
 {
@@ -177,6 +177,37 @@ void rt2x00pci_rxdone(struct rt2x00_dev *rt2x00dev)
 }
 EXPORT_SYMBOL_GPL(rt2x00pci_rxdone);
 
+void rt2x00pci_txdone(struct rt2x00_dev *rt2x00dev, struct data_entry *entry,
+                     const int tx_status, const int retry)
+{
+       u32 word;
+
+       rt2x00lib_txdone(entry, tx_status, retry);
+
+       /*
+        * Make this entry available for reuse.
+        */
+       entry->flags = 0;
+
+       rt2x00_desc_read(entry->priv, 0, &word);
+       rt2x00_set_field32(&word, TXD_ENTRY_OWNER_NIC, 0);
+       rt2x00_set_field32(&word, TXD_ENTRY_VALID, 0);
+       rt2x00_desc_write(entry->priv, 0, word);
+
+       rt2x00_ring_index_done_inc(entry->ring);
+
+       /*
+        * If the data ring was full before the txdone handler
+        * we must make sure the packet queue in the mac80211 stack
+        * is reenabled when the txdone handler has finished.
+        */
+       if (!rt2x00_ring_full(entry->ring))
+               ieee80211_wake_queue(rt2x00dev->hw,
+                                    entry->tx_status.control.queue);
+
+}
+EXPORT_SYMBOL_GPL(rt2x00pci_txdone);
+
 /*
  * Device initialization handlers.
  */
index 03572054509a8c78f98f5e91e7f29bd945b16c34..2d1eb8144da46654524f01183c77d9a847ee75d2 100644 (file)
@@ -101,9 +101,11 @@ int rt2x00pci_write_tx_data(struct rt2x00_dev *rt2x00dev,
                            struct ieee80211_tx_control *control);
 
 /*
- * RX data handlers.
+ * RX/TX data handlers.
  */
 void rt2x00pci_rxdone(struct rt2x00_dev *rt2x00dev);
+void rt2x00pci_txdone(struct rt2x00_dev *rt2x00dev, struct data_entry *entry,
+                     const int tx_status, const int retry);
 
 /*
  * Device initialization handlers.
index 606cf1299fff47bc19d91023526b14e117ac9f34..40e516b70fed4cf1cc087a52a09c8cf7dd100742 100644 (file)
@@ -1779,24 +1779,7 @@ static void rt61pci_txdone(struct rt2x00_dev *rt2x00dev)
                tx_status = rt2x00_get_field32(reg, STA_CSR4_TX_RESULT);
                retry = rt2x00_get_field32(reg, STA_CSR4_RETRY_COUNT);
 
-               rt2x00lib_txdone(entry, tx_status, retry);
-
-               /*
-                * Make this entry available for reuse.
-                */
-               entry->flags = 0;
-               rt2x00_set_field32(&word, TXD_W0_VALID, 0);
-               rt2x00_desc_write(txd, 0, word);
-               rt2x00_ring_index_done_inc(entry->ring);
-
-               /*
-                * If the data ring was full before the txdone handler
-                * we must make sure the packet queue in the mac80211 stack
-                * is reenabled when the txdone handler has finished.
-                */
-               if (!rt2x00_ring_full(ring))
-                       ieee80211_wake_queue(rt2x00dev->hw,
-                                            entry->tx_status.control.queue);
+               rt2x00pci_txdone(rt2x00dev, entry, tx_status, retry);
        }
 }