aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath9k/main.c
diff options
context:
space:
mode:
authorSujith <Sujith.Manoharan@atheros.com>2008-10-29 00:43:31 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-11-10 15:14:55 -0500
commitb5aa9bf9460f9e97f2c10940b029d75c6557ad7c (patch)
tree60bc06b72761339e048139fdb076de14f2f4273e /drivers/net/wireless/ath9k/main.c
parent17683c65c8a5f3f29f5408334992986b996d8205 (diff)
ath9k: Node cleanup
Start removing the internal node list in ath9k, in preparation for using mac80211's STA list. Remove lists, locks, routines, flags, functions managing nodes in ath9k. Signed-off-by: Sujith <Sujith.Manoharan@atheros.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath9k/main.c')
-rw-r--r--drivers/net/wireless/ath9k/main.c94
1 files changed, 9 insertions, 85 deletions
diff --git a/drivers/net/wireless/ath9k/main.c b/drivers/net/wireless/ath9k/main.c
index b25c8f9670d1..b1b1e7f3b0b8 100644
--- a/drivers/net/wireless/ath9k/main.c
+++ b/drivers/net/wireless/ath9k/main.c
@@ -21,8 +21,6 @@
21 21
22#define ATH_PCI_VERSION "0.1" 22#define ATH_PCI_VERSION "0.1"
23 23
24#define IEEE80211_HTCAP_MAXRXAMPDU_FACTOR 13
25
26static char *dev_info = "ath9k"; 24static char *dev_info = "ath9k";
27 25
28MODULE_AUTHOR("Atheros Communications"); 26MODULE_AUTHOR("Atheros Communications");
@@ -297,41 +295,6 @@ static void ath9k_rx_prepare(struct ath_softc *sc,
297 rx_status->flag |= RX_FLAG_TSFT; 295 rx_status->flag |= RX_FLAG_TSFT;
298} 296}
299 297
300static u8 parse_mpdudensity(u8 mpdudensity)
301{
302 /*
303 * 802.11n D2.0 defined values for "Minimum MPDU Start Spacing":
304 * 0 for no restriction
305 * 1 for 1/4 us
306 * 2 for 1/2 us
307 * 3 for 1 us
308 * 4 for 2 us
309 * 5 for 4 us
310 * 6 for 8 us
311 * 7 for 16 us
312 */
313 switch (mpdudensity) {
314 case 0:
315 return 0;
316 case 1:
317 case 2:
318 case 3:
319 /* Our lower layer calculations limit our precision to
320 1 microsecond */
321 return 1;
322 case 4:
323 return 2;
324 case 5:
325 return 4;
326 case 6:
327 return 8;
328 case 7:
329 return 16;
330 default:
331 return 0;
332 }
333}
334
335static void ath9k_ht_conf(struct ath_softc *sc, 298static void ath9k_ht_conf(struct ath_softc *sc,
336 struct ieee80211_bss_conf *bss_conf) 299 struct ieee80211_bss_conf *bss_conf)
337{ 300{
@@ -479,8 +442,6 @@ void ath_tx_complete(struct ath_softc *sc, struct sk_buff *skb,
479 tx_info->status.rates[0].count = tx_status->retries + 1; 442 tx_info->status.rates[0].count = tx_status->retries + 1;
480 443
481 ieee80211_tx_status(hw, skb); 444 ieee80211_tx_status(hw, skb);
482 if (an)
483 ath_node_put(sc, an, ATH9K_BH_STATUS_CHANGE);
484} 445}
485 446
486int _ath_rx_indicate(struct ath_softc *sc, 447int _ath_rx_indicate(struct ath_softc *sc,
@@ -518,10 +479,6 @@ int _ath_rx_indicate(struct ath_softc *sc,
518 rx_status.flag |= RX_FLAG_DECRYPTED; 479 rx_status.flag |= RX_FLAG_DECRYPTED;
519 } 480 }
520 481
521 spin_lock_bh(&sc->node_lock);
522 an = ath_node_find(sc, hdr->addr2);
523 spin_unlock_bh(&sc->node_lock);
524
525 if (an) { 482 if (an) {
526 ath_rx_input(sc, an, 483 ath_rx_input(sc, an,
527 skb, status, &st); 484 skb, status, &st);
@@ -913,11 +870,6 @@ static int ath_attach(u16 devid,
913 if (error != 0) 870 if (error != 0)
914 return error; 871 return error;
915 872
916 /* Init nodes */
917
918 INIT_LIST_HEAD(&sc->node_list);
919 spin_lock_init(&sc->node_lock);
920
921 /* get mac address from hardware and set in mac80211 */ 873 /* get mac address from hardware and set in mac80211 */
922 874
923 SET_IEEE80211_PERM_ADDR(hw, sc->sc_myaddr); 875 SET_IEEE80211_PERM_ADDR(hw, sc->sc_myaddr);
@@ -1404,50 +1356,22 @@ static void ath9k_configure_filter(struct ieee80211_hw *hw,
1404 __func__, sc->rx_filter); 1356 __func__, sc->rx_filter);
1405} 1357}
1406 1358
1359/* Only a single interface is currently supported,
1360 so pass 0 as the interface id to ath_node_attach */
1361
1407static void ath9k_sta_notify(struct ieee80211_hw *hw, 1362static void ath9k_sta_notify(struct ieee80211_hw *hw,
1408 struct ieee80211_vif *vif, 1363 struct ieee80211_vif *vif,
1409 enum sta_notify_cmd cmd, 1364 enum sta_notify_cmd cmd,
1410 struct ieee80211_sta *sta) 1365 struct ieee80211_sta *sta)
1411{ 1366{
1412 struct ath_softc *sc = hw->priv; 1367 struct ath_softc *sc = hw->priv;
1413 struct ath_node *an;
1414 unsigned long flags;
1415
1416 spin_lock_irqsave(&sc->node_lock, flags);
1417 an = ath_node_find(sc, sta->addr);
1418 spin_unlock_irqrestore(&sc->node_lock, flags);
1419 1368
1420 switch (cmd) { 1369 switch (cmd) {
1421 case STA_NOTIFY_ADD: 1370 case STA_NOTIFY_ADD:
1422 spin_lock_irqsave(&sc->node_lock, flags); 1371 ath_node_attach(sc, sta, 0);
1423 if (!an) {
1424 ath_node_attach(sc, sta->addr, 0);
1425 DPRINTF(sc, ATH_DBG_CONFIG, "%s: Attach a node: %pM\n",
1426 __func__, sta->addr);
1427 } else {
1428 ath_node_get(sc, sta->addr);
1429 }
1430
1431 /* XXX: Is this right? Can the capabilities change? */
1432 an = ath_node_find(sc, sta->addr);
1433 an->maxampdu = 1 << (IEEE80211_HTCAP_MAXRXAMPDU_FACTOR +
1434 sta->ht_cap.ampdu_factor);
1435 an->mpdudensity =
1436 parse_mpdudensity(sta->ht_cap.ampdu_density);
1437
1438 spin_unlock_irqrestore(&sc->node_lock, flags);
1439 break; 1372 break;
1440 case STA_NOTIFY_REMOVE: 1373 case STA_NOTIFY_REMOVE:
1441 if (!an) 1374 ath_node_detach(sc, sta);
1442 DPRINTF(sc, ATH_DBG_FATAL,
1443 "%s: Removal of a non-existent node\n",
1444 __func__);
1445 else {
1446 ath_node_put(sc, an, ATH9K_BH_STATUS_INTACT);
1447 DPRINTF(sc, ATH_DBG_CONFIG, "%s: Put a node: %pM\n",
1448 __func__,
1449 sta->addr);
1450 }
1451 break; 1375 break;
1452 default: 1376 default:
1453 break; 1377 break;
@@ -1595,21 +1519,21 @@ static int ath9k_ampdu_action(struct ieee80211_hw *hw,
1595 1519
1596 switch (action) { 1520 switch (action) {
1597 case IEEE80211_AMPDU_RX_START: 1521 case IEEE80211_AMPDU_RX_START:
1598 ret = ath_rx_aggr_start(sc, sta->addr, tid, ssn); 1522 ret = ath_rx_aggr_start(sc, sta, tid, ssn);
1599 if (ret < 0) 1523 if (ret < 0)
1600 DPRINTF(sc, ATH_DBG_FATAL, 1524 DPRINTF(sc, ATH_DBG_FATAL,
1601 "%s: Unable to start RX aggregation\n", 1525 "%s: Unable to start RX aggregation\n",
1602 __func__); 1526 __func__);
1603 break; 1527 break;
1604 case IEEE80211_AMPDU_RX_STOP: 1528 case IEEE80211_AMPDU_RX_STOP:
1605 ret = ath_rx_aggr_stop(sc, sta->addr, tid); 1529 ret = ath_rx_aggr_stop(sc, sta, tid);
1606 if (ret < 0) 1530 if (ret < 0)
1607 DPRINTF(sc, ATH_DBG_FATAL, 1531 DPRINTF(sc, ATH_DBG_FATAL,
1608 "%s: Unable to stop RX aggregation\n", 1532 "%s: Unable to stop RX aggregation\n",
1609 __func__); 1533 __func__);
1610 break; 1534 break;
1611 case IEEE80211_AMPDU_TX_START: 1535 case IEEE80211_AMPDU_TX_START:
1612 ret = ath_tx_aggr_start(sc, sta->addr, tid, ssn); 1536 ret = ath_tx_aggr_start(sc, sta, tid, ssn);
1613 if (ret < 0) 1537 if (ret < 0)
1614 DPRINTF(sc, ATH_DBG_FATAL, 1538 DPRINTF(sc, ATH_DBG_FATAL,
1615 "%s: Unable to start TX aggregation\n", 1539 "%s: Unable to start TX aggregation\n",
@@ -1618,7 +1542,7 @@ static int ath9k_ampdu_action(struct ieee80211_hw *hw,
1618 ieee80211_start_tx_ba_cb_irqsafe(hw, sta->addr, tid); 1542 ieee80211_start_tx_ba_cb_irqsafe(hw, sta->addr, tid);
1619 break; 1543 break;
1620 case IEEE80211_AMPDU_TX_STOP: 1544 case IEEE80211_AMPDU_TX_STOP:
1621 ret = ath_tx_aggr_stop(sc, sta->addr, tid); 1545 ret = ath_tx_aggr_stop(sc, sta, tid);
1622 if (ret < 0) 1546 if (ret < 0)
1623 DPRINTF(sc, ATH_DBG_FATAL, 1547 DPRINTF(sc, ATH_DBG_FATAL,
1624 "%s: Unable to stop TX aggregation\n", 1548 "%s: Unable to stop TX aggregation\n",