]> err.no Git - linux-2.6/blobdiff - drivers/net/wireless/rt2x00/rt2x00pci.c
rt2x00: Replace DRV_NAME with KBUILD_MODNAME
[linux-2.6] / drivers / net / wireless / rt2x00 / rt2x00pci.c
index 6d5d9aba0b73449c3bee16c1e90f16d86c09e2b6..cf0bb5d9d847cc18e2aac9e431f7fc925ec3c939 100644 (file)
        Abstract: rt2x00 generic pci device routines.
  */
 
-/*
- * Set enviroment defines for rt2x00.h
- */
-#define DRV_NAME "rt2x00pci"
-
 #include <linux/dma-mapping.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
@@ -80,7 +75,7 @@ int rt2x00pci_write_tx_data(struct rt2x00_dev *rt2x00dev,
 {
        struct ieee80211_hdr *ieee80211hdr = (struct ieee80211_hdr *)skb->data;
        struct data_entry *entry = rt2x00_get_data_entry(ring);
-       struct data_desc *txd = entry->priv;
+       __le32 *txd = entry->priv;
        u32 word;
 
        if (rt2x00_ring_full(ring)) {
@@ -116,17 +111,17 @@ 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)
 {
        struct data_ring *ring = rt2x00dev->rx;
        struct data_entry *entry;
-       struct data_desc *rxd;
        struct sk_buff *skb;
        struct ieee80211_hdr *hdr;
        struct rxdata_entry_desc desc;
        int header_size;
+       __le32 *rxd;
        int align;
        u32 word;
 
@@ -149,7 +144,7 @@ void rt2x00pci_rxdone(struct rt2x00_dev *rt2x00dev)
                 * The data behind the ieee80211 header must be
                 * aligned on a 4 byte boundary.
                 */
-               align = NET_IP_ALIGN + (2 * (header_size % 4 == 0));
+               align = header_size % 4;
 
                /*
                 * Allocate the sk_buffer, initialize it and copy
@@ -177,6 +172,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.
  */