aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rt2x00/rt73usb.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/rt73usb.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/rt73usb.c')
-rw-r--r--drivers/net/wireless/rt2x00/rt73usb.c115
1 files changed, 44 insertions, 71 deletions
diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c
index 65720097242..6f89b4c75e1 100644
--- a/drivers/net/wireless/rt2x00/rt73usb.c
+++ b/drivers/net/wireless/rt2x00/rt73usb.c
@@ -1334,6 +1334,49 @@ static void rt73usb_write_tx_desc(struct rt2x00_dev *rt2x00dev,
1334 rt2x00_desc_write(txd, 0, word); 1334 rt2x00_desc_write(txd, 0, word);
1335} 1335}
1336 1336
1337/*
1338 * TX data initialization
1339 */
1340static void rt73usb_write_beacon(struct queue_entry *entry)
1341{
1342 struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
1343 struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb);
1344 unsigned int beacon_base;
1345 u32 reg;
1346
1347 /*
1348 * Add the descriptor in front of the skb.
1349 */
1350 skb_push(entry->skb, entry->queue->desc_size);
1351 memcpy(entry->skb->data, skbdesc->desc, skbdesc->desc_len);
1352 skbdesc->desc = entry->skb->data;
1353
1354 /*
1355 * Disable beaconing while we are reloading the beacon data,
1356 * otherwise we might be sending out invalid data.
1357 */
1358 rt73usb_register_read(rt2x00dev, TXRX_CSR9, &reg);
1359 rt2x00_set_field32(&reg, TXRX_CSR9_TSF_TICKING, 0);
1360 rt2x00_set_field32(&reg, TXRX_CSR9_TBTT_ENABLE, 0);
1361 rt2x00_set_field32(&reg, TXRX_CSR9_BEACON_GEN, 0);
1362 rt73usb_register_write(rt2x00dev, TXRX_CSR9, reg);
1363
1364 /*
1365 * Write entire beacon with descriptor to register.
1366 */
1367 beacon_base = HW_BEACON_OFFSET(entry->entry_idx);
1368 rt2x00usb_vendor_request(rt2x00dev, USB_MULTI_WRITE,
1369 USB_VENDOR_REQUEST_OUT, beacon_base, 0,
1370 entry->skb->data, entry->skb->len,
1371 REGISTER_TIMEOUT32(entry->skb->len));
1372
1373 /*
1374 * Clean up the beacon skb.
1375 */
1376 dev_kfree_skb(entry->skb);
1377 entry->skb = NULL;
1378}
1379
1337static int rt73usb_get_tx_data_len(struct rt2x00_dev *rt2x00dev, 1380static int rt73usb_get_tx_data_len(struct rt2x00_dev *rt2x00dev,
1338 struct sk_buff *skb) 1381 struct sk_buff *skb)
1339{ 1382{
@@ -1349,9 +1392,6 @@ static int rt73usb_get_tx_data_len(struct rt2x00_dev *rt2x00dev,
1349 return length; 1392 return length;
1350} 1393}
1351 1394
1352/*
1353 * TX data initialization
1354 */
1355static void rt73usb_kick_tx_queue(struct rt2x00_dev *rt2x00dev, 1395static void rt73usb_kick_tx_queue(struct rt2x00_dev *rt2x00dev,
1356 const enum data_queue_qid queue) 1396 const enum data_queue_qid queue)
1357{ 1397{
@@ -1949,73 +1989,6 @@ static u64 rt73usb_get_tsf(struct ieee80211_hw *hw)
1949#define rt73usb_get_tsf NULL 1989#define rt73usb_get_tsf NULL
1950#endif 1990#endif
1951 1991
1952static int rt73usb_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb)
1953{
1954 struct rt2x00_dev *rt2x00dev = hw->priv;
1955 struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
1956 struct rt2x00_intf *intf = vif_to_intf(tx_info->control.vif);
1957 struct skb_frame_desc *skbdesc;
1958 struct txentry_desc txdesc;
1959 unsigned int beacon_base;
1960 u32 reg;
1961
1962 if (unlikely(!intf->beacon))
1963 return -ENOBUFS;
1964
1965 /*
1966 * Copy all TX descriptor information into txdesc,
1967 * after that we are free to use the skb->cb array
1968 * for our information.
1969 */
1970 intf->beacon->skb = skb;
1971 rt2x00queue_create_tx_descriptor(intf->beacon, &txdesc);
1972
1973 /*
1974 * Add the descriptor in front of the skb.
1975 */
1976 skb_push(skb, intf->beacon->queue->desc_size);
1977 memset(skb->data, 0, intf->beacon->queue->desc_size);
1978
1979 /*
1980 * Fill in skb descriptor
1981 */
1982 skbdesc = get_skb_frame_desc(skb);
1983 memset(skbdesc, 0, sizeof(*skbdesc));
1984 skbdesc->desc = skb->data;
1985 skbdesc->desc_len = intf->beacon->queue->desc_size;
1986 skbdesc->entry = intf->beacon;
1987
1988 /*
1989 * Disable beaconing while we are reloading the beacon data,
1990 * otherwise we might be sending out invalid data.
1991 */
1992 rt73usb_register_read(rt2x00dev, TXRX_CSR9, &reg);
1993 rt2x00_set_field32(&reg, TXRX_CSR9_TSF_TICKING, 0);
1994 rt2x00_set_field32(&reg, TXRX_CSR9_TBTT_ENABLE, 0);
1995 rt2x00_set_field32(&reg, TXRX_CSR9_BEACON_GEN, 0);
1996 rt73usb_register_write(rt2x00dev, TXRX_CSR9, reg);
1997
1998 /*
1999 * Write entire beacon with descriptor to register,
2000 * and kick the beacon generator.
2001 */
2002 rt2x00queue_write_tx_descriptor(intf->beacon, &txdesc);
2003 beacon_base = HW_BEACON_OFFSET(intf->beacon->entry_idx);
2004 rt2x00usb_vendor_request(rt2x00dev, USB_MULTI_WRITE,
2005 USB_VENDOR_REQUEST_OUT, beacon_base, 0,
2006 skb->data, skb->len,
2007 REGISTER_TIMEOUT32(skb->len));
2008 rt73usb_kick_tx_queue(rt2x00dev, QID_BEACON);
2009
2010 /*
2011 * Clean up the beacon skb.
2012 */
2013 dev_kfree_skb(skb);
2014 intf->beacon->skb = NULL;
2015
2016 return 0;
2017}
2018
2019static const struct ieee80211_ops rt73usb_mac80211_ops = { 1992static const struct ieee80211_ops rt73usb_mac80211_ops = {
2020 .tx = rt2x00mac_tx, 1993 .tx = rt2x00mac_tx,
2021 .start = rt2x00mac_start, 1994 .start = rt2x00mac_start,
@@ -2048,10 +2021,10 @@ static const struct rt2x00lib_ops rt73usb_rt2x00_ops = {
2048 .link_tuner = rt73usb_link_tuner, 2021 .link_tuner = rt73usb_link_tuner,
2049 .write_tx_desc = rt73usb_write_tx_desc, 2022 .write_tx_desc = rt73usb_write_tx_desc,
2050 .write_tx_data = rt2x00usb_write_tx_data, 2023 .write_tx_data = rt2x00usb_write_tx_data,
2024 .write_beacon = rt73usb_write_beacon,
2051 .get_tx_data_len = rt73usb_get_tx_data_len, 2025 .get_tx_data_len = rt73usb_get_tx_data_len,
2052 .kick_tx_queue = rt73usb_kick_tx_queue, 2026 .kick_tx_queue = rt73usb_kick_tx_queue,
2053 .fill_rxdone = rt73usb_fill_rxdone, 2027 .fill_rxdone = rt73usb_fill_rxdone,
2054 .beacon_update = rt73usb_beacon_update,
2055 .config_filter = rt73usb_config_filter, 2028 .config_filter = rt73usb_config_filter,
2056 .config_intf = rt73usb_config_intf, 2029 .config_intf = rt73usb_config_intf,
2057 .config_erp = rt73usb_config_erp, 2030 .config_erp = rt73usb_config_erp,