aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rt2x00/rt2500pci.c
diff options
context:
space:
mode:
authorIvo van Doorn <ivdoorn@gmail.com>2008-07-09 09:12:44 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-07-14 14:52:56 -0400
commitbd88a7812f1afd50549f3789cacb707b983fef54 (patch)
tree53818d0fbfacabca3ac5f64bf524f5f71952fa27 /drivers/net/wireless/rt2x00/rt2500pci.c
parente360c4cb2bc2fb2a37981809685984efe8433c52 (diff)
rt2x00: Reorganize beacon handling
With the new beacon handling from mac80211 we can reorganize the beacon handling in rt2x00 as well. This patch will move the function to the TX handlers, and move all duplicate code into rt2x00queue.c. After this change the descriptor helper functions from rt2x00queue.c no longer need to be exported outside of rt2x00lib and can be declared static. Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2500pci.c')
-rw-r--r--drivers/net/wireless/rt2x00/rt2500pci.c90
1 files changed, 35 insertions, 55 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2500pci.c b/drivers/net/wireless/rt2x00/rt2500pci.c
index a64bb18322e9..50f9e8f6cd68 100644
--- a/drivers/net/wireless/rt2x00/rt2500pci.c
+++ b/drivers/net/wireless/rt2x00/rt2500pci.c
@@ -1216,6 +1216,40 @@ static void rt2500pci_write_tx_desc(struct rt2x00_dev *rt2x00dev,
1216/* 1216/*
1217 * TX data initialization 1217 * TX data initialization
1218 */ 1218 */
1219static void rt2500pci_write_beacon(struct queue_entry *entry)
1220{
1221 struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
1222 struct queue_entry_priv_pci *entry_priv = entry->priv_data;
1223 struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb);
1224 u32 word;
1225 u32 reg;
1226
1227 /*
1228 * Disable beaconing while we are reloading the beacon data,
1229 * otherwise we might be sending out invalid data.
1230 */
1231 rt2x00pci_register_read(rt2x00dev, CSR14, &reg);
1232 rt2x00_set_field32(&reg, CSR14_TSF_COUNT, 0);
1233 rt2x00_set_field32(&reg, CSR14_TBCN, 0);
1234 rt2x00_set_field32(&reg, CSR14_BEACON_GEN, 0);
1235 rt2x00pci_register_write(rt2x00dev, CSR14, reg);
1236
1237 /*
1238 * Replace rt2x00lib allocated descriptor with the
1239 * pointer to the _real_ hardware descriptor.
1240 * After that, map the beacon to DMA and update the
1241 * descriptor.
1242 */
1243 memcpy(entry_priv->desc, skbdesc->desc, skbdesc->desc_len);
1244 skbdesc->desc = entry_priv->desc;
1245
1246 rt2x00queue_map_txskb(rt2x00dev, entry->skb);
1247
1248 rt2x00_desc_read(entry_priv->desc, 1, &word);
1249 rt2x00_set_field32(&word, TXD_W1_BUFFER_ADDRESS, skbdesc->skb_dma);
1250 rt2x00_desc_write(entry_priv->desc, 1, word);
1251}
1252
1219static void rt2500pci_kick_tx_queue(struct rt2x00_dev *rt2x00dev, 1253static void rt2500pci_kick_tx_queue(struct rt2x00_dev *rt2x00dev,
1220 const enum data_queue_qid queue) 1254 const enum data_queue_qid queue)
1221{ 1255{
@@ -1797,60 +1831,6 @@ static u64 rt2500pci_get_tsf(struct ieee80211_hw *hw)
1797 return tsf; 1831 return tsf;
1798} 1832}
1799 1833
1800static int rt2500pci_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb)
1801{
1802 struct rt2x00_dev *rt2x00dev = hw->priv;
1803 struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
1804 struct rt2x00_intf *intf = vif_to_intf(tx_info->control.vif);
1805 struct queue_entry_priv_pci *entry_priv;
1806 struct skb_frame_desc *skbdesc;
1807 struct txentry_desc txdesc;
1808 u32 reg;
1809
1810 if (unlikely(!intf->beacon))
1811 return -ENOBUFS;
1812
1813 entry_priv = intf->beacon->priv_data;
1814
1815 /*
1816 * Copy all TX descriptor information into txdesc,
1817 * after that we are free to use the skb->cb array
1818 * for our information.
1819 */
1820 intf->beacon->skb = skb;
1821 rt2x00queue_create_tx_descriptor(intf->beacon, &txdesc);
1822
1823 /*
1824 * Fill in skb descriptor
1825 */
1826 skbdesc = get_skb_frame_desc(skb);
1827 memset(skbdesc, 0, sizeof(*skbdesc));
1828 skbdesc->desc = entry_priv->desc;
1829 skbdesc->desc_len = intf->beacon->queue->desc_size;
1830 skbdesc->entry = intf->beacon;
1831
1832 /*
1833 * Disable beaconing while we are reloading the beacon data,
1834 * otherwise we might be sending out invalid data.
1835 */
1836 rt2x00pci_register_read(rt2x00dev, CSR14, &reg);
1837 rt2x00_set_field32(&reg, CSR14_TSF_COUNT, 0);
1838 rt2x00_set_field32(&reg, CSR14_TBCN, 0);
1839 rt2x00_set_field32(&reg, CSR14_BEACON_GEN, 0);
1840 rt2x00pci_register_write(rt2x00dev, CSR14, reg);
1841
1842 /*
1843 * Enable beacon generation.
1844 * Write entire beacon with descriptor to register,
1845 * and kick the beacon generator.
1846 */
1847 rt2x00queue_map_txskb(rt2x00dev, intf->beacon->skb);
1848 rt2x00queue_write_tx_descriptor(intf->beacon, &txdesc);
1849 rt2x00dev->ops->lib->kick_tx_queue(rt2x00dev, QID_BEACON);
1850
1851 return 0;
1852}
1853
1854static int rt2500pci_tx_last_beacon(struct ieee80211_hw *hw) 1834static int rt2500pci_tx_last_beacon(struct ieee80211_hw *hw)
1855{ 1835{
1856 struct rt2x00_dev *rt2x00dev = hw->priv; 1836 struct rt2x00_dev *rt2x00dev = hw->priv;
@@ -1892,9 +1872,9 @@ static const struct rt2x00lib_ops rt2500pci_rt2x00_ops = {
1892 .link_tuner = rt2500pci_link_tuner, 1872 .link_tuner = rt2500pci_link_tuner,
1893 .write_tx_desc = rt2500pci_write_tx_desc, 1873 .write_tx_desc = rt2500pci_write_tx_desc,
1894 .write_tx_data = rt2x00pci_write_tx_data, 1874 .write_tx_data = rt2x00pci_write_tx_data,
1875 .write_beacon = rt2500pci_write_beacon,
1895 .kick_tx_queue = rt2500pci_kick_tx_queue, 1876 .kick_tx_queue = rt2500pci_kick_tx_queue,
1896 .fill_rxdone = rt2500pci_fill_rxdone, 1877 .fill_rxdone = rt2500pci_fill_rxdone,
1897 .beacon_update = rt2500pci_beacon_update,
1898 .config_filter = rt2500pci_config_filter, 1878 .config_filter = rt2500pci_config_filter,
1899 .config_intf = rt2500pci_config_intf, 1879 .config_intf = rt2500pci_config_intf,
1900 .config_erp = rt2500pci_config_erp, 1880 .config_erp = rt2500pci_config_erp,