rt2x00: Push beacon TX descriptor writing to drivers.
authorGertjan van Wingerde <gwingerde@gmail.com>
Thu, 3 Jun 2010 08:51:41 +0000 (10:51 +0200)
committerIvo van Doorn <IvDoorn@gmail.com>
Thu, 3 Jun 2010 08:51:41 +0000 (10:51 +0200)
Not all the devices require a TX descriptor to be written (i.e. rt2800
device don't require them). Push down the creation of the TX descriptor
to the device drivers so that they can decide for themselves whether
a TX descriptor is to be created.

Signed-off-by: Gertjan van Wingerde <gwingerde@gmail.com>
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
drivers/net/wireless/rt2x00/rt2400pci.c
drivers/net/wireless/rt2x00/rt2500pci.c
drivers/net/wireless/rt2x00/rt2500usb.c
drivers/net/wireless/rt2x00/rt2800pci.c
drivers/net/wireless/rt2x00/rt2800usb.c
drivers/net/wireless/rt2x00/rt2x00queue.c
drivers/net/wireless/rt2x00/rt61pci.c
drivers/net/wireless/rt2x00/rt73usb.c

index ad2c98af7e9d62090dd54837206d07bcd23675a6..1e543ac2f86fd060389cb1d13144154e063fd961 100644 (file)
@@ -1076,9 +1076,6 @@ static void rt2400pci_write_beacon(struct queue_entry *entry,
                                   struct txentry_desc *txdesc)
 {
        struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
-       struct queue_entry_priv_pci *entry_priv = entry->priv_data;
-       struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb);
-       u32 word;
        u32 reg;
 
        /*
@@ -1091,9 +1088,15 @@ static void rt2400pci_write_beacon(struct queue_entry *entry,
 
        rt2x00queue_map_txskb(rt2x00dev, entry->skb);
 
-       rt2x00_desc_read(entry_priv->desc, 1, &word);
-       rt2x00_set_field32(&word, TXD_W1_BUFFER_ADDRESS, skbdesc->skb_dma);
-       rt2x00_desc_write(entry_priv->desc, 1, word);
+       /*
+        * Write the TX descriptor for the beacon.
+        */
+       rt2400pci_write_tx_desc(rt2x00dev, entry->skb, txdesc);
+
+       /*
+        * Dump beacon to userspace through debugfs.
+        */
+       rt2x00debug_dump_frame(rt2x00dev, DUMP_FRAME_BEACON, entry->skb);
 
        /*
         * Enable beaconing again.
index 41da3d218c65e343b5ded898ad5cee89257e4201..1582cabd3a1ea6d6c9159e621de7baebcc9ee168 100644 (file)
@@ -1233,9 +1233,6 @@ static void rt2500pci_write_beacon(struct queue_entry *entry,
                                   struct txentry_desc *txdesc)
 {
        struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
-       struct queue_entry_priv_pci *entry_priv = entry->priv_data;
-       struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb);
-       u32 word;
        u32 reg;
 
        /*
@@ -1248,9 +1245,15 @@ static void rt2500pci_write_beacon(struct queue_entry *entry,
 
        rt2x00queue_map_txskb(rt2x00dev, entry->skb);
 
-       rt2x00_desc_read(entry_priv->desc, 1, &word);
-       rt2x00_set_field32(&word, TXD_W1_BUFFER_ADDRESS, skbdesc->skb_dma);
-       rt2x00_desc_write(entry_priv->desc, 1, word);
+       /*
+        * Write the TX descriptor for the beacon.
+        */
+       rt2500pci_write_tx_desc(rt2x00dev, entry->skb, txdesc);
+
+       /*
+        * Dump beacon to userspace through debugfs.
+        */
+       rt2x00debug_dump_frame(rt2x00dev, DUMP_FRAME_BEACON, entry->skb);
 
        /*
         * Enable beaconing again.
index 9ae96a626e6d0fafc6b8a633af03c75a135c5b3d..d19f29a53523bd5abbf62a6a59ded5076d1b5684 100644 (file)
@@ -1107,6 +1107,16 @@ static void rt2500usb_write_beacon(struct queue_entry *entry,
        rt2x00_set_field16(&reg, TXRX_CSR19_BEACON_GEN, 0);
        rt2500usb_register_write(rt2x00dev, TXRX_CSR19, reg);
 
+       /*
+        * Write the TX descriptor for the beacon.
+        */
+       rt2500usb_write_tx_desc(rt2x00dev, entry->skb, txdesc);
+
+       /*
+        * Dump beacon to userspace through debugfs.
+        */
+       rt2x00debug_dump_frame(rt2x00dev, DUMP_FRAME_BEACON, entry->skb);
+
        /*
         * Take the descriptor in front of the skb into account.
         */
index b2f23272c3aae3efa74524f10b894bc88d521637..88dba7f76aeff521a9b23a81078e9684ed918888 100644 (file)
@@ -688,6 +688,7 @@ static void rt2800pci_write_beacon(struct queue_entry *entry,
                                   struct txentry_desc *txdesc)
 {
        struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
+       struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb);
        unsigned int beacon_base;
        u32 reg;
 
@@ -699,10 +700,25 @@ static void rt2800pci_write_beacon(struct queue_entry *entry,
        rt2x00_set_field32(&reg, BCN_TIME_CFG_BEACON_GEN, 0);
        rt2800_register_write(rt2x00dev, BCN_TIME_CFG, reg);
 
+       /*
+        * Register descriptor details in skb frame descriptor.
+        */
+       skbdesc->desc = entry->skb->data - TXWI_DESC_SIZE;
+       skbdesc->desc_len = TXWI_DESC_SIZE;
+
        /*
         * Add the TXWI for the beacon to the skb.
         */
        rt2800_write_txwi(entry->skb, txdesc);
+
+       /*
+        * Dump beacon to userspace through debugfs.
+        */
+       rt2x00debug_dump_frame(rt2x00dev, DUMP_FRAME_BEACON, entry->skb);
+
+       /*
+        * Adjust skb to take TXWI into account.
+        */
        skb_push(entry->skb, TXWI_DESC_SIZE);
 
        /*
index 0f8b84b7224cace0167ebe5b0065da28af08986c..d0d8060040baece5709f36a47ed742a580ce33e6 100644 (file)
@@ -437,6 +437,7 @@ static void rt2800usb_write_beacon(struct queue_entry *entry,
                                   struct txentry_desc *txdesc)
 {
        struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
+       struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb);
        unsigned int beacon_base;
        u32 reg;
 
@@ -448,10 +449,25 @@ static void rt2800usb_write_beacon(struct queue_entry *entry,
        rt2x00_set_field32(&reg, BCN_TIME_CFG_BEACON_GEN, 0);
        rt2800_register_write(rt2x00dev, BCN_TIME_CFG, reg);
 
+       /*
+        * Register descriptor details in skb frame descriptor.
+        */
+       skbdesc->desc = entry->skb->data - TXWI_DESC_SIZE;
+       skbdesc->desc_len = TXWI_DESC_SIZE;
+
        /*
         * Add the TXWI for the beacon to the skb.
         */
        rt2800_write_txwi(entry->skb, txdesc);
+
+       /*
+        * Dump beacon to userspace through debugfs.
+        */
+       rt2x00debug_dump_frame(rt2x00dev, DUMP_FRAME_BEACON, entry->skb);
+
+       /*
+        * Adjust skb to take TXWI into account.
+        */
        skb_push(entry->skb, TXWI_DESC_SIZE);
 
        /*
index 20dbdd6fb9047e63ed98a64d084072f1642084e8..cf7bfe774e004c23bbce9e31e119ec61457c0946 100644 (file)
@@ -421,7 +421,6 @@ static void rt2x00queue_write_tx_descriptor(struct queue_entry *entry,
 {
        struct data_queue *queue = entry->queue;
        struct rt2x00_dev *rt2x00dev = queue->rt2x00dev;
-       enum rt2x00_dump_type dump_type;
 
        rt2x00dev->ops->lib->write_tx_desc(rt2x00dev, entry->skb, txdesc);
 
@@ -429,9 +428,7 @@ static void rt2x00queue_write_tx_descriptor(struct queue_entry *entry,
         * All processing on the frame has been completed, this means
         * it is now ready to be dumped to userspace through debugfs.
         */
-       dump_type = (txdesc->queue == QID_BEACON) ?
-                                       DUMP_FRAME_BEACON : DUMP_FRAME_TX;
-       rt2x00debug_dump_frame(rt2x00dev, dump_type, entry->skb);
+       rt2x00debug_dump_frame(rt2x00dev, DUMP_FRAME_TX, entry->skb);
 }
 
 static void rt2x00queue_kick_tx_queue(struct queue_entry *entry,
@@ -594,11 +591,6 @@ int rt2x00queue_update_beacon(struct rt2x00_dev *rt2x00dev,
        memset(skbdesc, 0, sizeof(*skbdesc));
        skbdesc->entry = intf->beacon;
 
-       /*
-        * Write TX descriptor into reserved room in front of the beacon.
-        */
-       rt2x00queue_write_tx_descriptor(intf->beacon, &txdesc);
-
        /*
         * Send beacon to hardware and enable beacon genaration..
         */
index 6a74baf4e934b97e4ac3978341736790f18fb6e3..a7205c1711de2e012aa7b0576807e66820541543 100644 (file)
@@ -1873,6 +1873,16 @@ static void rt61pci_write_beacon(struct queue_entry *entry,
        rt2x00_set_field32(&reg, TXRX_CSR9_BEACON_GEN, 0);
        rt2x00pci_register_write(rt2x00dev, TXRX_CSR9, reg);
 
+       /*
+        * Write the TX descriptor for the beacon.
+        */
+       rt61pci_write_tx_desc(rt2x00dev, entry->skb, txdesc);
+
+       /*
+        * Dump beacon to userspace through debugfs.
+        */
+       rt2x00debug_dump_frame(rt2x00dev, DUMP_FRAME_BEACON, entry->skb);
+
        /*
         * Write entire beacon with descriptor to register.
         */
index 6e0d82efe9241802d8fdea54eacfe9f686437f0d..bd9a53e5fd9fc4f2808a0e60663804d8bd1d3be2 100644 (file)
@@ -1527,6 +1527,16 @@ static void rt73usb_write_beacon(struct queue_entry *entry,
        rt2x00_set_field32(&reg, TXRX_CSR9_BEACON_GEN, 0);
        rt2x00usb_register_write(rt2x00dev, TXRX_CSR9, reg);
 
+       /*
+        * Write the TX descriptor for the beacon.
+        */
+       rt73usb_write_tx_desc(rt2x00dev, entry->skb, txdesc);
+
+       /*
+        * Dump beacon to userspace through debugfs.
+        */
+       rt2x00debug_dump_frame(rt2x00dev, DUMP_FRAME_BEACON, entry->skb);
+
        /*
         * Take the descriptor in front of the skb into account.
         */