diff options
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt73usb.c')
-rw-r--r-- | drivers/net/wireless/rt2x00/rt73usb.c | 115 |
1 files changed, 44 insertions, 71 deletions
diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c index 25d8b660051f..34c6ff27afc4 100644 --- a/drivers/net/wireless/rt2x00/rt73usb.c +++ b/drivers/net/wireless/rt2x00/rt73usb.c | |||
@@ -1343,6 +1343,49 @@ static void rt73usb_write_tx_desc(struct rt2x00_dev *rt2x00dev, | |||
1343 | rt2x00_desc_write(txd, 0, word); | 1343 | rt2x00_desc_write(txd, 0, word); |
1344 | } | 1344 | } |
1345 | 1345 | ||
1346 | /* | ||
1347 | * TX data initialization | ||
1348 | */ | ||
1349 | static void rt73usb_write_beacon(struct queue_entry *entry) | ||
1350 | { | ||
1351 | struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev; | ||
1352 | struct skb_frame_desc *skbdesc = get_skb_frame_desc(entry->skb); | ||
1353 | unsigned int beacon_base; | ||
1354 | u32 reg; | ||
1355 | |||
1356 | /* | ||
1357 | * Add the descriptor in front of the skb. | ||
1358 | */ | ||
1359 | skb_push(entry->skb, entry->queue->desc_size); | ||
1360 | memcpy(entry->skb->data, skbdesc->desc, skbdesc->desc_len); | ||
1361 | skbdesc->desc = entry->skb->data; | ||
1362 | |||
1363 | /* | ||
1364 | * Disable beaconing while we are reloading the beacon data, | ||
1365 | * otherwise we might be sending out invalid data. | ||
1366 | */ | ||
1367 | rt73usb_register_read(rt2x00dev, TXRX_CSR9, ®); | ||
1368 | rt2x00_set_field32(®, TXRX_CSR9_TSF_TICKING, 0); | ||
1369 | rt2x00_set_field32(®, TXRX_CSR9_TBTT_ENABLE, 0); | ||
1370 | rt2x00_set_field32(®, TXRX_CSR9_BEACON_GEN, 0); | ||
1371 | rt73usb_register_write(rt2x00dev, TXRX_CSR9, reg); | ||
1372 | |||
1373 | /* | ||
1374 | * Write entire beacon with descriptor to register. | ||
1375 | */ | ||
1376 | beacon_base = HW_BEACON_OFFSET(entry->entry_idx); | ||
1377 | rt2x00usb_vendor_request(rt2x00dev, USB_MULTI_WRITE, | ||
1378 | USB_VENDOR_REQUEST_OUT, beacon_base, 0, | ||
1379 | entry->skb->data, entry->skb->len, | ||
1380 | REGISTER_TIMEOUT32(entry->skb->len)); | ||
1381 | |||
1382 | /* | ||
1383 | * Clean up the beacon skb. | ||
1384 | */ | ||
1385 | dev_kfree_skb(entry->skb); | ||
1386 | entry->skb = NULL; | ||
1387 | } | ||
1388 | |||
1346 | static int rt73usb_get_tx_data_len(struct rt2x00_dev *rt2x00dev, | 1389 | static int rt73usb_get_tx_data_len(struct rt2x00_dev *rt2x00dev, |
1347 | struct sk_buff *skb) | 1390 | struct sk_buff *skb) |
1348 | { | 1391 | { |
@@ -1358,9 +1401,6 @@ static int rt73usb_get_tx_data_len(struct rt2x00_dev *rt2x00dev, | |||
1358 | return length; | 1401 | return length; |
1359 | } | 1402 | } |
1360 | 1403 | ||
1361 | /* | ||
1362 | * TX data initialization | ||
1363 | */ | ||
1364 | static void rt73usb_kick_tx_queue(struct rt2x00_dev *rt2x00dev, | 1404 | static void rt73usb_kick_tx_queue(struct rt2x00_dev *rt2x00dev, |
1365 | const enum data_queue_qid queue) | 1405 | const enum data_queue_qid queue) |
1366 | { | 1406 | { |
@@ -1958,73 +1998,6 @@ static u64 rt73usb_get_tsf(struct ieee80211_hw *hw) | |||
1958 | #define rt73usb_get_tsf NULL | 1998 | #define rt73usb_get_tsf NULL |
1959 | #endif | 1999 | #endif |
1960 | 2000 | ||
1961 | static int rt73usb_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb) | ||
1962 | { | ||
1963 | struct rt2x00_dev *rt2x00dev = hw->priv; | ||
1964 | struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); | ||
1965 | struct rt2x00_intf *intf = vif_to_intf(tx_info->control.vif); | ||
1966 | struct skb_frame_desc *skbdesc; | ||
1967 | struct txentry_desc txdesc; | ||
1968 | unsigned int beacon_base; | ||
1969 | u32 reg; | ||
1970 | |||
1971 | if (unlikely(!intf->beacon)) | ||
1972 | return -ENOBUFS; | ||
1973 | |||
1974 | /* | ||
1975 | * Copy all TX descriptor information into txdesc, | ||
1976 | * after that we are free to use the skb->cb array | ||
1977 | * for our information. | ||
1978 | */ | ||
1979 | intf->beacon->skb = skb; | ||
1980 | rt2x00queue_create_tx_descriptor(intf->beacon, &txdesc); | ||
1981 | |||
1982 | /* | ||
1983 | * Add the descriptor in front of the skb. | ||
1984 | */ | ||
1985 | skb_push(skb, intf->beacon->queue->desc_size); | ||
1986 | memset(skb->data, 0, intf->beacon->queue->desc_size); | ||
1987 | |||
1988 | /* | ||
1989 | * Fill in skb descriptor | ||
1990 | */ | ||
1991 | skbdesc = get_skb_frame_desc(skb); | ||
1992 | memset(skbdesc, 0, sizeof(*skbdesc)); | ||
1993 | skbdesc->desc = skb->data; | ||
1994 | skbdesc->desc_len = intf->beacon->queue->desc_size; | ||
1995 | skbdesc->entry = intf->beacon; | ||
1996 | |||
1997 | /* | ||
1998 | * Disable beaconing while we are reloading the beacon data, | ||
1999 | * otherwise we might be sending out invalid data. | ||
2000 | */ | ||
2001 | rt73usb_register_read(rt2x00dev, TXRX_CSR9, ®); | ||
2002 | rt2x00_set_field32(®, TXRX_CSR9_TSF_TICKING, 0); | ||
2003 | rt2x00_set_field32(®, TXRX_CSR9_TBTT_ENABLE, 0); | ||
2004 | rt2x00_set_field32(®, TXRX_CSR9_BEACON_GEN, 0); | ||
2005 | rt73usb_register_write(rt2x00dev, TXRX_CSR9, reg); | ||
2006 | |||
2007 | /* | ||
2008 | * Write entire beacon with descriptor to register, | ||
2009 | * and kick the beacon generator. | ||
2010 | */ | ||
2011 | rt2x00queue_write_tx_descriptor(intf->beacon, &txdesc); | ||
2012 | beacon_base = HW_BEACON_OFFSET(intf->beacon->entry_idx); | ||
2013 | rt2x00usb_vendor_request(rt2x00dev, USB_MULTI_WRITE, | ||
2014 | USB_VENDOR_REQUEST_OUT, beacon_base, 0, | ||
2015 | skb->data, skb->len, | ||
2016 | REGISTER_TIMEOUT32(skb->len)); | ||
2017 | rt73usb_kick_tx_queue(rt2x00dev, QID_BEACON); | ||
2018 | |||
2019 | /* | ||
2020 | * Clean up the beacon skb. | ||
2021 | */ | ||
2022 | dev_kfree_skb(skb); | ||
2023 | intf->beacon->skb = NULL; | ||
2024 | |||
2025 | return 0; | ||
2026 | } | ||
2027 | |||
2028 | static const struct ieee80211_ops rt73usb_mac80211_ops = { | 2001 | static const struct ieee80211_ops rt73usb_mac80211_ops = { |
2029 | .tx = rt2x00mac_tx, | 2002 | .tx = rt2x00mac_tx, |
2030 | .start = rt2x00mac_start, | 2003 | .start = rt2x00mac_start, |
@@ -2040,7 +2013,6 @@ static const struct ieee80211_ops rt73usb_mac80211_ops = { | |||
2040 | .conf_tx = rt2x00mac_conf_tx, | 2013 | .conf_tx = rt2x00mac_conf_tx, |
2041 | .get_tx_stats = rt2x00mac_get_tx_stats, | 2014 | .get_tx_stats = rt2x00mac_get_tx_stats, |
2042 | .get_tsf = rt73usb_get_tsf, | 2015 | .get_tsf = rt73usb_get_tsf, |
2043 | .beacon_update = rt73usb_beacon_update, | ||
2044 | }; | 2016 | }; |
2045 | 2017 | ||
2046 | static const struct rt2x00lib_ops rt73usb_rt2x00_ops = { | 2018 | static const struct rt2x00lib_ops rt73usb_rt2x00_ops = { |
@@ -2058,6 +2030,7 @@ static const struct rt2x00lib_ops rt73usb_rt2x00_ops = { | |||
2058 | .link_tuner = rt73usb_link_tuner, | 2030 | .link_tuner = rt73usb_link_tuner, |
2059 | .write_tx_desc = rt73usb_write_tx_desc, | 2031 | .write_tx_desc = rt73usb_write_tx_desc, |
2060 | .write_tx_data = rt2x00usb_write_tx_data, | 2032 | .write_tx_data = rt2x00usb_write_tx_data, |
2033 | .write_beacon = rt73usb_write_beacon, | ||
2061 | .get_tx_data_len = rt73usb_get_tx_data_len, | 2034 | .get_tx_data_len = rt73usb_get_tx_data_len, |
2062 | .kick_tx_queue = rt73usb_kick_tx_queue, | 2035 | .kick_tx_queue = rt73usb_kick_tx_queue, |
2063 | .fill_rxdone = rt73usb_fill_rxdone, | 2036 | .fill_rxdone = rt73usb_fill_rxdone, |