rt2x00: Centralize setting of extra TX headroom requested by rt2x00.
authorGertjan van Wingerde <gwingerde@gmail.com>
Mon, 23 Nov 2009 21:44:52 +0000 (22:44 +0100)
committerJohn W. Linville <linville@tuxdriver.com>
Sat, 28 Nov 2009 20:04:38 +0000 (15:04 -0500)
Set the value of extra_tx_headroom in a central place, rather than in each
of the drivers. This is preparatory for taking alignment space into account
in the TX headroom requested by rt2x00.

Signed-off-by: Gertjan van Wingerde <gwingerde@gmail.com>
Acked-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/rt2500usb.c
drivers/net/wireless/rt2x00/rt2800lib.c
drivers/net/wireless/rt2x00/rt2800pci.c
drivers/net/wireless/rt2x00/rt2800usb.c
drivers/net/wireless/rt2x00/rt2x00.h
drivers/net/wireless/rt2x00/rt2x00dev.c
drivers/net/wireless/rt2x00/rt61pci.c
drivers/net/wireless/rt2x00/rt73usb.c

index 7f900be39e5ab76eeee9f4cfd2626a1cb029aeda..e7f46405a418d5ecdacd60f9d92eeb910c5731b4 100644 (file)
@@ -1432,7 +1432,6 @@ static int rt2400pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
                               IEEE80211_HW_SIGNAL_DBM |
                               IEEE80211_HW_SUPPORTS_PS |
                               IEEE80211_HW_PS_NULLFUNC_STACK;
-       rt2x00dev->hw->extra_tx_headroom = 0;
 
        SET_IEEE80211_DEV(rt2x00dev->hw, rt2x00dev->dev);
        SET_IEEE80211_PERM_ADDR(rt2x00dev->hw,
@@ -1629,6 +1628,7 @@ static const struct rt2x00_ops rt2400pci_ops = {
        .eeprom_size            = EEPROM_SIZE,
        .rf_size                = RF_SIZE,
        .tx_queues              = NUM_TX_QUEUES,
+       .extra_tx_headroom      = 0,
        .rx                     = &rt2400pci_queue_rx,
        .tx                     = &rt2400pci_queue_tx,
        .bcn                    = &rt2400pci_queue_bcn,
index 30960fd8a449546708d30cd4e988738ff7b3ce78..408fcfc120f503a459f7e2fda05c514ff18bf71e 100644 (file)
@@ -1733,8 +1733,6 @@ static int rt2500pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
                               IEEE80211_HW_SUPPORTS_PS |
                               IEEE80211_HW_PS_NULLFUNC_STACK;
 
-       rt2x00dev->hw->extra_tx_headroom = 0;
-
        SET_IEEE80211_DEV(rt2x00dev->hw, rt2x00dev->dev);
        SET_IEEE80211_PERM_ADDR(rt2x00dev->hw,
                                rt2x00_eeprom_addr(rt2x00dev,
@@ -1928,6 +1926,7 @@ static const struct rt2x00_ops rt2500pci_ops = {
        .eeprom_size            = EEPROM_SIZE,
        .rf_size                = RF_SIZE,
        .tx_queues              = NUM_TX_QUEUES,
+       .extra_tx_headroom      = 0,
        .rx                     = &rt2500pci_queue_rx,
        .tx                     = &rt2500pci_queue_tx,
        .bcn                    = &rt2500pci_queue_bcn,
index 02290f68113ed4a0944c995df95795527b85607c..83f2592c59def385091a81e5e070d184d7a0260e 100644 (file)
@@ -1656,8 +1656,6 @@ static int rt2500usb_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
            IEEE80211_HW_SUPPORTS_PS |
            IEEE80211_HW_PS_NULLFUNC_STACK;
 
-       rt2x00dev->hw->extra_tx_headroom = TXD_DESC_SIZE;
-
        SET_IEEE80211_DEV(rt2x00dev->hw, rt2x00dev->dev);
        SET_IEEE80211_PERM_ADDR(rt2x00dev->hw,
                                rt2x00_eeprom_addr(rt2x00dev,
@@ -1829,6 +1827,7 @@ static const struct rt2x00_ops rt2500usb_ops = {
        .eeprom_size            = EEPROM_SIZE,
        .rf_size                = RF_SIZE,
        .tx_queues              = NUM_TX_QUEUES,
+       .extra_tx_headroom      = TXD_DESC_SIZE,
        .rx                     = &rt2500usb_queue_rx,
        .tx                     = &rt2500usb_queue_tx,
        .bcn                    = &rt2500usb_queue_bcn,
index 02ffcf54bf09034a6273284371d902774844a867..eb1e1d00bec31455c95a85068c9d959e7abbf45d 100644 (file)
@@ -2030,12 +2030,6 @@ int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
            IEEE80211_HW_SUPPORTS_PS |
            IEEE80211_HW_PS_NULLFUNC_STACK;
 
-       if (rt2x00_intf_is_usb(rt2x00dev))
-               rt2x00dev->hw->extra_tx_headroom =
-                       TXINFO_DESC_SIZE + TXWI_DESC_SIZE;
-       else if (rt2x00_intf_is_pci(rt2x00dev))
-               rt2x00dev->hw->extra_tx_headroom = TXWI_DESC_SIZE;
-
        SET_IEEE80211_DEV(rt2x00dev->hw, rt2x00dev->dev);
        SET_IEEE80211_PERM_ADDR(rt2x00dev->hw,
                                rt2x00_eeprom_addr(rt2x00dev,
index 029a45f0cb99d4cbb9b6e5fca94857b179a1b5ae..dfc886fcb44de55e0265b92d91cc846f58836f5a 100644 (file)
@@ -652,7 +652,7 @@ static void rt2800pci_write_tx_desc(struct rt2x00_dev *rt2x00dev,
 {
        struct skb_frame_desc *skbdesc = get_skb_frame_desc(skb);
        __le32 *txd = skbdesc->desc;
-       __le32 *txwi = (__le32 *)(skb->data - rt2x00dev->hw->extra_tx_headroom);
+       __le32 *txwi = (__le32 *)(skb->data - rt2x00dev->ops->extra_tx_headroom);
        u32 word;
 
        /*
@@ -725,14 +725,14 @@ static void rt2800pci_write_tx_desc(struct rt2x00_dev *rt2x00dev,
        rt2x00_set_field32(&word, TXD_W1_BURST,
                           test_bit(ENTRY_TXD_BURST, &txdesc->flags));
        rt2x00_set_field32(&word, TXD_W1_SD_LEN0,
-                          rt2x00dev->hw->extra_tx_headroom);
+                          rt2x00dev->ops->extra_tx_headroom);
        rt2x00_set_field32(&word, TXD_W1_LAST_SEC0, 0);
        rt2x00_set_field32(&word, TXD_W1_DMA_DONE, 0);
        rt2x00_desc_write(txd, 1, word);
 
        rt2x00_desc_read(txd, 2, &word);
        rt2x00_set_field32(&word, TXD_W2_SD_PTR1,
-                          skbdesc->skb_dma + rt2x00dev->hw->extra_tx_headroom);
+                          skbdesc->skb_dma + rt2x00dev->ops->extra_tx_headroom);
        rt2x00_desc_write(txd, 2, word);
 
        rt2x00_desc_read(txd, 3, &word);
@@ -1207,6 +1207,7 @@ static const struct rt2x00_ops rt2800pci_ops = {
        .eeprom_size            = EEPROM_SIZE,
        .rf_size                = RF_SIZE,
        .tx_queues              = NUM_TX_QUEUES,
+       .extra_tx_headroom      = TXWI_DESC_SIZE,
        .rx                     = &rt2800pci_queue_rx,
        .tx                     = &rt2800pci_queue_tx,
        .bcn                    = &rt2800pci_queue_bcn,
index 208316af6d990ed51aa43c1ca0c20a622313d546..af85d18cdbe7d96170b686413c4b732f00ab99b1 100644 (file)
@@ -796,6 +796,7 @@ static const struct rt2x00_ops rt2800usb_ops = {
        .eeprom_size            = EEPROM_SIZE,
        .rf_size                = RF_SIZE,
        .tx_queues              = NUM_TX_QUEUES,
+       .extra_tx_headroom      = TXINFO_DESC_SIZE + TXWI_DESC_SIZE,
        .rx                     = &rt2800usb_queue_rx,
        .tx                     = &rt2800usb_queue_tx,
        .bcn                    = &rt2800usb_queue_bcn,
index 1cbb7ac2f32f13230372764ed10a2d6d0552d236..4d841c07c9705e611c4c84c6168d6a283034ec7b 100644 (file)
@@ -588,6 +588,7 @@ struct rt2x00_ops {
        const unsigned int eeprom_size;
        const unsigned int rf_size;
        const unsigned int tx_queues;
+       const unsigned int extra_tx_headroom;
        const struct data_queue_desc *rx;
        const struct data_queue_desc *tx;
        const struct data_queue_desc *bcn;
index 4a4b7e42fe6e8610a8c2f79a06d3ac44c0a8446e..06c43ca39bf8549470331707fb432e807679c0e6 100644 (file)
@@ -683,6 +683,11 @@ static int rt2x00lib_probe_hw(struct rt2x00_dev *rt2x00dev)
         */
        rt2x00dev->hw->queues = rt2x00dev->ops->tx_queues;
 
+       /*
+        * Initialize extra TX headroom required.
+        */
+       rt2x00dev->hw->extra_tx_headroom = rt2x00dev->ops->extra_tx_headroom;
+
        /*
         * Register HW.
         */
index 4cb9afeed9d735dab931afbb96c1dab7c6409834..687e17dc2e9f2d7d06a30c6ebfe7b58925764ab8 100644 (file)
@@ -2546,7 +2546,6 @@ static int rt61pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
            IEEE80211_HW_SIGNAL_DBM |
            IEEE80211_HW_SUPPORTS_PS |
            IEEE80211_HW_PS_NULLFUNC_STACK;
-       rt2x00dev->hw->extra_tx_headroom = 0;
 
        SET_IEEE80211_DEV(rt2x00dev->hw, rt2x00dev->dev);
        SET_IEEE80211_PERM_ADDR(rt2x00dev->hw,
@@ -2794,6 +2793,7 @@ static const struct rt2x00_ops rt61pci_ops = {
        .eeprom_size            = EEPROM_SIZE,
        .rf_size                = RF_SIZE,
        .tx_queues              = NUM_TX_QUEUES,
+       .extra_tx_headroom      = 0,
        .rx                     = &rt61pci_queue_rx,
        .tx                     = &rt61pci_queue_tx,
        .bcn                    = &rt61pci_queue_bcn,
index d13a051b39afad3f643d4381df0209e7f01e1a28..ced3b6ab5e16f89ba4c794d2e131ef55929f362c 100644 (file)
@@ -2069,7 +2069,6 @@ static int rt73usb_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
            IEEE80211_HW_SIGNAL_DBM |
            IEEE80211_HW_SUPPORTS_PS |
            IEEE80211_HW_PS_NULLFUNC_STACK;
-       rt2x00dev->hw->extra_tx_headroom = TXD_DESC_SIZE;
 
        SET_IEEE80211_DEV(rt2x00dev->hw, rt2x00dev->dev);
        SET_IEEE80211_PERM_ADDR(rt2x00dev->hw,
@@ -2312,6 +2311,7 @@ static const struct rt2x00_ops rt73usb_ops = {
        .eeprom_size            = EEPROM_SIZE,
        .rf_size                = RF_SIZE,
        .tx_queues              = NUM_TX_QUEUES,
+       .extra_tx_headroom      = TXD_DESC_SIZE,
        .rx                     = &rt73usb_queue_rx,
        .tx                     = &rt73usb_queue_tx,
        .bcn                    = &rt73usb_queue_bcn,