diff options
author | Gabor Juhos <juhosg@openwrt.org> | 2013-06-06 03:36:19 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2013-06-12 15:02:15 -0400 |
commit | 5616a6efb2a255330319f9f09f3bcf0fc4680b5f (patch) | |
tree | 6e9488684cd50f45ad3e69f17953c2fed9984375 | |
parent | d619c62f161a43db1f40e5039ff1285dd29b8658 (diff) |
rt2x00: move extra_tx_headroom field from rt2x00_ops to rt2x00_dev
The extra_tx_headroom field of struct rt2x00_ops
indicates the extra TX headroom size required for
a given device. This data is redundant, the value
can be computed from the desc_size and winfo_size
fields of the TX queues.
Move the extra_tx_headroom field to struct rt2x00_dev,
compute its value in the probe routine and use the
cached value in the rest of the code.
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Acked-by: Stanislaw Gruszka <sgruszka@redhat.com>
Acked-by: Gertjan van Wingerde <gwingerde@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2400pci.c | 1 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2500pci.c | 1 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2500usb.c | 1 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2800pci.c | 1 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2800usb.c | 2 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00.h | 4 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00dev.c | 18 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00queue.c | 6 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt61pci.c | 1 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt73usb.c | 1 |
10 files changed, 22 insertions, 14 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2400pci.c b/drivers/net/wireless/rt2x00/rt2400pci.c index e1ec9a4517d1..3d53a09da5a1 100644 --- a/drivers/net/wireless/rt2x00/rt2400pci.c +++ b/drivers/net/wireless/rt2x00/rt2400pci.c | |||
@@ -1813,7 +1813,6 @@ static const struct rt2x00_ops rt2400pci_ops = { | |||
1813 | .eeprom_size = EEPROM_SIZE, | 1813 | .eeprom_size = EEPROM_SIZE, |
1814 | .rf_size = RF_SIZE, | 1814 | .rf_size = RF_SIZE, |
1815 | .tx_queues = NUM_TX_QUEUES, | 1815 | .tx_queues = NUM_TX_QUEUES, |
1816 | .extra_tx_headroom = 0, | ||
1817 | .queue_init = rt2400pci_queue_init, | 1816 | .queue_init = rt2400pci_queue_init, |
1818 | .lib = &rt2400pci_rt2x00_ops, | 1817 | .lib = &rt2400pci_rt2x00_ops, |
1819 | .hw = &rt2400pci_mac80211_ops, | 1818 | .hw = &rt2400pci_mac80211_ops, |
diff --git a/drivers/net/wireless/rt2x00/rt2500pci.c b/drivers/net/wireless/rt2x00/rt2500pci.c index a1670e8967ed..0ac5c589ddce 100644 --- a/drivers/net/wireless/rt2x00/rt2500pci.c +++ b/drivers/net/wireless/rt2x00/rt2500pci.c | |||
@@ -2102,7 +2102,6 @@ static const struct rt2x00_ops rt2500pci_ops = { | |||
2102 | .eeprom_size = EEPROM_SIZE, | 2102 | .eeprom_size = EEPROM_SIZE, |
2103 | .rf_size = RF_SIZE, | 2103 | .rf_size = RF_SIZE, |
2104 | .tx_queues = NUM_TX_QUEUES, | 2104 | .tx_queues = NUM_TX_QUEUES, |
2105 | .extra_tx_headroom = 0, | ||
2106 | .queue_init = rt2500pci_queue_init, | 2105 | .queue_init = rt2500pci_queue_init, |
2107 | .lib = &rt2500pci_rt2x00_ops, | 2106 | .lib = &rt2500pci_rt2x00_ops, |
2108 | .hw = &rt2500pci_mac80211_ops, | 2107 | .hw = &rt2500pci_mac80211_ops, |
diff --git a/drivers/net/wireless/rt2x00/rt2500usb.c b/drivers/net/wireless/rt2x00/rt2500usb.c index e5e5479bcf93..85acc79f68b8 100644 --- a/drivers/net/wireless/rt2x00/rt2500usb.c +++ b/drivers/net/wireless/rt2x00/rt2500usb.c | |||
@@ -1913,7 +1913,6 @@ static const struct rt2x00_ops rt2500usb_ops = { | |||
1913 | .eeprom_size = EEPROM_SIZE, | 1913 | .eeprom_size = EEPROM_SIZE, |
1914 | .rf_size = RF_SIZE, | 1914 | .rf_size = RF_SIZE, |
1915 | .tx_queues = NUM_TX_QUEUES, | 1915 | .tx_queues = NUM_TX_QUEUES, |
1916 | .extra_tx_headroom = TXD_DESC_SIZE, | ||
1917 | .queue_init = rt2500usb_queue_init, | 1916 | .queue_init = rt2500usb_queue_init, |
1918 | .lib = &rt2500usb_rt2x00_ops, | 1917 | .lib = &rt2500usb_rt2x00_ops, |
1919 | .hw = &rt2500usb_mac80211_ops, | 1918 | .hw = &rt2500usb_mac80211_ops, |
diff --git a/drivers/net/wireless/rt2x00/rt2800pci.c b/drivers/net/wireless/rt2x00/rt2800pci.c index 260c8b4d7399..7c7478219bbc 100644 --- a/drivers/net/wireless/rt2x00/rt2800pci.c +++ b/drivers/net/wireless/rt2x00/rt2800pci.c | |||
@@ -1231,7 +1231,6 @@ static const struct rt2x00_ops rt2800pci_ops = { | |||
1231 | .eeprom_size = EEPROM_SIZE, | 1231 | .eeprom_size = EEPROM_SIZE, |
1232 | .rf_size = RF_SIZE, | 1232 | .rf_size = RF_SIZE, |
1233 | .tx_queues = NUM_TX_QUEUES, | 1233 | .tx_queues = NUM_TX_QUEUES, |
1234 | .extra_tx_headroom = TXWI_DESC_SIZE, | ||
1235 | .queue_init = rt2800pci_queue_init, | 1234 | .queue_init = rt2800pci_queue_init, |
1236 | .lib = &rt2800pci_rt2x00_ops, | 1235 | .lib = &rt2800pci_rt2x00_ops, |
1237 | .drv = &rt2800pci_rt2800_ops, | 1236 | .drv = &rt2800pci_rt2800_ops, |
diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c index b81d5098816a..68ea00e169d2 100644 --- a/drivers/net/wireless/rt2x00/rt2800usb.c +++ b/drivers/net/wireless/rt2x00/rt2800usb.c | |||
@@ -905,7 +905,6 @@ static const struct rt2x00_ops rt2800usb_ops = { | |||
905 | .eeprom_size = EEPROM_SIZE, | 905 | .eeprom_size = EEPROM_SIZE, |
906 | .rf_size = RF_SIZE, | 906 | .rf_size = RF_SIZE, |
907 | .tx_queues = NUM_TX_QUEUES, | 907 | .tx_queues = NUM_TX_QUEUES, |
908 | .extra_tx_headroom = TXINFO_DESC_SIZE + TXWI_DESC_SIZE, | ||
909 | .queue_init = rt2800usb_queue_init, | 908 | .queue_init = rt2800usb_queue_init, |
910 | .lib = &rt2800usb_rt2x00_ops, | 909 | .lib = &rt2800usb_rt2x00_ops, |
911 | .drv = &rt2800usb_rt2800_ops, | 910 | .drv = &rt2800usb_rt2800_ops, |
@@ -922,7 +921,6 @@ static const struct rt2x00_ops rt2800usb_ops_5592 = { | |||
922 | .eeprom_size = EEPROM_SIZE, | 921 | .eeprom_size = EEPROM_SIZE, |
923 | .rf_size = RF_SIZE, | 922 | .rf_size = RF_SIZE, |
924 | .tx_queues = NUM_TX_QUEUES, | 923 | .tx_queues = NUM_TX_QUEUES, |
925 | .extra_tx_headroom = TXINFO_DESC_SIZE + TXWI_DESC_SIZE_5592, | ||
926 | .queue_init = rt2800usb_queue_init, | 924 | .queue_init = rt2800usb_queue_init, |
927 | .lib = &rt2800usb_rt2x00_ops, | 925 | .lib = &rt2800usb_rt2x00_ops, |
928 | .drv = &rt2800usb_rt2800_ops, | 926 | .drv = &rt2800usb_rt2800_ops, |
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h index 2a17f7e4ed5e..ee3fc570b11d 100644 --- a/drivers/net/wireless/rt2x00/rt2x00.h +++ b/drivers/net/wireless/rt2x00/rt2x00.h | |||
@@ -648,7 +648,6 @@ struct rt2x00_ops { | |||
648 | const unsigned int eeprom_size; | 648 | const unsigned int eeprom_size; |
649 | const unsigned int rf_size; | 649 | const unsigned int rf_size; |
650 | const unsigned int tx_queues; | 650 | const unsigned int tx_queues; |
651 | const unsigned int extra_tx_headroom; | ||
652 | void (*queue_init)(struct data_queue *queue); | 651 | void (*queue_init)(struct data_queue *queue); |
653 | const struct rt2x00lib_ops *lib; | 652 | const struct rt2x00lib_ops *lib; |
654 | const void *drv; | 653 | const void *drv; |
@@ -1007,6 +1006,9 @@ struct rt2x00_dev { | |||
1007 | */ | 1006 | */ |
1008 | struct list_head bar_list; | 1007 | struct list_head bar_list; |
1009 | spinlock_t bar_list_lock; | 1008 | spinlock_t bar_list_lock; |
1009 | |||
1010 | /* Extra TX headroom required for alignment purposes. */ | ||
1011 | unsigned int extra_tx_headroom; | ||
1010 | }; | 1012 | }; |
1011 | 1013 | ||
1012 | struct rt2x00_bar_list_entry { | 1014 | struct rt2x00_bar_list_entry { |
diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c index dff5012f0548..f03e3bba51c3 100644 --- a/drivers/net/wireless/rt2x00/rt2x00dev.c +++ b/drivers/net/wireless/rt2x00/rt2x00dev.c | |||
@@ -334,7 +334,7 @@ void rt2x00lib_txdone(struct queue_entry *entry, | |||
334 | /* | 334 | /* |
335 | * Remove the extra tx headroom from the skb. | 335 | * Remove the extra tx headroom from the skb. |
336 | */ | 336 | */ |
337 | skb_pull(entry->skb, rt2x00dev->ops->extra_tx_headroom); | 337 | skb_pull(entry->skb, rt2x00dev->extra_tx_headroom); |
338 | 338 | ||
339 | /* | 339 | /* |
340 | * Signal that the TX descriptor is no longer in the skb. | 340 | * Signal that the TX descriptor is no longer in the skb. |
@@ -1049,7 +1049,7 @@ static int rt2x00lib_probe_hw(struct rt2x00_dev *rt2x00dev) | |||
1049 | */ | 1049 | */ |
1050 | rt2x00dev->hw->extra_tx_headroom = | 1050 | rt2x00dev->hw->extra_tx_headroom = |
1051 | max_t(unsigned int, IEEE80211_TX_STATUS_HEADROOM, | 1051 | max_t(unsigned int, IEEE80211_TX_STATUS_HEADROOM, |
1052 | rt2x00dev->ops->extra_tx_headroom); | 1052 | rt2x00dev->extra_tx_headroom); |
1053 | 1053 | ||
1054 | /* | 1054 | /* |
1055 | * Take TX headroom required for alignment into account. | 1055 | * Take TX headroom required for alignment into account. |
@@ -1256,6 +1256,17 @@ static inline void rt2x00lib_set_if_combinations(struct rt2x00_dev *rt2x00dev) | |||
1256 | rt2x00dev->hw->wiphy->n_iface_combinations = 1; | 1256 | rt2x00dev->hw->wiphy->n_iface_combinations = 1; |
1257 | } | 1257 | } |
1258 | 1258 | ||
1259 | static unsigned int rt2x00dev_extra_tx_headroom(struct rt2x00_dev *rt2x00dev) | ||
1260 | { | ||
1261 | if (WARN_ON(!rt2x00dev->tx)) | ||
1262 | return 0; | ||
1263 | |||
1264 | if (rt2x00_is_usb(rt2x00dev)) | ||
1265 | return rt2x00dev->tx[0].winfo_size + rt2x00dev->tx[0].desc_size; | ||
1266 | |||
1267 | return rt2x00dev->tx[0].winfo_size; | ||
1268 | } | ||
1269 | |||
1259 | /* | 1270 | /* |
1260 | * driver allocation handlers. | 1271 | * driver allocation handlers. |
1261 | */ | 1272 | */ |
@@ -1330,6 +1341,9 @@ int rt2x00lib_probe_dev(struct rt2x00_dev *rt2x00dev) | |||
1330 | if (retval) | 1341 | if (retval) |
1331 | goto exit; | 1342 | goto exit; |
1332 | 1343 | ||
1344 | /* Cache TX headroom value */ | ||
1345 | rt2x00dev->extra_tx_headroom = rt2x00dev_extra_tx_headroom(rt2x00dev); | ||
1346 | |||
1333 | /* | 1347 | /* |
1334 | * Determine which operating modes are supported, all modes | 1348 | * Determine which operating modes are supported, all modes |
1335 | * which require beaconing, depend on the availability of | 1349 | * which require beaconing, depend on the availability of |
diff --git a/drivers/net/wireless/rt2x00/rt2x00queue.c b/drivers/net/wireless/rt2x00/rt2x00queue.c index c4f1e2b8dc8e..6c0a91ff963c 100644 --- a/drivers/net/wireless/rt2x00/rt2x00queue.c +++ b/drivers/net/wireless/rt2x00/rt2x00queue.c | |||
@@ -542,8 +542,8 @@ static int rt2x00queue_write_tx_data(struct queue_entry *entry, | |||
542 | /* | 542 | /* |
543 | * Add the requested extra tx headroom in front of the skb. | 543 | * Add the requested extra tx headroom in front of the skb. |
544 | */ | 544 | */ |
545 | skb_push(entry->skb, rt2x00dev->ops->extra_tx_headroom); | 545 | skb_push(entry->skb, rt2x00dev->extra_tx_headroom); |
546 | memset(entry->skb->data, 0, rt2x00dev->ops->extra_tx_headroom); | 546 | memset(entry->skb->data, 0, rt2x00dev->extra_tx_headroom); |
547 | 547 | ||
548 | /* | 548 | /* |
549 | * Call the driver's write_tx_data function, if it exists. | 549 | * Call the driver's write_tx_data function, if it exists. |
@@ -596,7 +596,7 @@ static void rt2x00queue_bar_check(struct queue_entry *entry) | |||
596 | { | 596 | { |
597 | struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; | 597 | struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; |
598 | struct ieee80211_bar *bar = (void *) (entry->skb->data + | 598 | struct ieee80211_bar *bar = (void *) (entry->skb->data + |
599 | rt2x00dev->ops->extra_tx_headroom); | 599 | rt2x00dev->extra_tx_headroom); |
600 | struct rt2x00_bar_list_entry *bar_entry; | 600 | struct rt2x00_bar_list_entry *bar_entry; |
601 | 601 | ||
602 | if (likely(!ieee80211_is_back_req(bar->frame_control))) | 602 | if (likely(!ieee80211_is_back_req(bar->frame_control))) |
diff --git a/drivers/net/wireless/rt2x00/rt61pci.c b/drivers/net/wireless/rt2x00/rt61pci.c index 17507d12d5ee..53754bc66d05 100644 --- a/drivers/net/wireless/rt2x00/rt61pci.c +++ b/drivers/net/wireless/rt2x00/rt61pci.c | |||
@@ -3066,7 +3066,6 @@ static const struct rt2x00_ops rt61pci_ops = { | |||
3066 | .eeprom_size = EEPROM_SIZE, | 3066 | .eeprom_size = EEPROM_SIZE, |
3067 | .rf_size = RF_SIZE, | 3067 | .rf_size = RF_SIZE, |
3068 | .tx_queues = NUM_TX_QUEUES, | 3068 | .tx_queues = NUM_TX_QUEUES, |
3069 | .extra_tx_headroom = 0, | ||
3070 | .queue_init = rt61pci_queue_init, | 3069 | .queue_init = rt61pci_queue_init, |
3071 | .lib = &rt61pci_rt2x00_ops, | 3070 | .lib = &rt61pci_rt2x00_ops, |
3072 | .hw = &rt61pci_mac80211_ops, | 3071 | .hw = &rt61pci_mac80211_ops, |
diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c index b2e346a482cc..1616ed484ceb 100644 --- a/drivers/net/wireless/rt2x00/rt73usb.c +++ b/drivers/net/wireless/rt2x00/rt73usb.c | |||
@@ -2400,7 +2400,6 @@ static const struct rt2x00_ops rt73usb_ops = { | |||
2400 | .eeprom_size = EEPROM_SIZE, | 2400 | .eeprom_size = EEPROM_SIZE, |
2401 | .rf_size = RF_SIZE, | 2401 | .rf_size = RF_SIZE, |
2402 | .tx_queues = NUM_TX_QUEUES, | 2402 | .tx_queues = NUM_TX_QUEUES, |
2403 | .extra_tx_headroom = TXD_DESC_SIZE, | ||
2404 | .queue_init = rt73usb_queue_init, | 2403 | .queue_init = rt73usb_queue_init, |
2405 | .lib = &rt73usb_rt2x00_ops, | 2404 | .lib = &rt73usb_rt2x00_ops, |
2406 | .hw = &rt73usb_mac80211_ops, | 2405 | .hw = &rt73usb_mac80211_ops, |