diff options
Diffstat (limited to 'drivers/net/wireless/mwifiex/cfg80211.c')
-rw-r--r-- | drivers/net/wireless/mwifiex/cfg80211.c | 81 |
1 files changed, 69 insertions, 12 deletions
diff --git a/drivers/net/wireless/mwifiex/cfg80211.c b/drivers/net/wireless/mwifiex/cfg80211.c index 65050384c42..c7e89188c35 100644 --- a/drivers/net/wireless/mwifiex/cfg80211.c +++ b/drivers/net/wireless/mwifiex/cfg80211.c | |||
@@ -516,25 +516,23 @@ static int | |||
516 | mwifiex_dump_station_info(struct mwifiex_private *priv, | 516 | mwifiex_dump_station_info(struct mwifiex_private *priv, |
517 | struct station_info *sinfo) | 517 | struct station_info *sinfo) |
518 | { | 518 | { |
519 | struct mwifiex_ds_get_signal signal; | ||
520 | struct mwifiex_rate_cfg rate; | 519 | struct mwifiex_rate_cfg rate; |
521 | int ret = 0; | ||
522 | 520 | ||
523 | sinfo->filled = STATION_INFO_RX_BYTES | STATION_INFO_TX_BYTES | | 521 | sinfo->filled = STATION_INFO_RX_BYTES | STATION_INFO_TX_BYTES | |
524 | STATION_INFO_RX_PACKETS | | 522 | STATION_INFO_RX_PACKETS | STATION_INFO_TX_PACKETS | |
525 | STATION_INFO_TX_PACKETS | 523 | STATION_INFO_TX_BITRATE | |
526 | | STATION_INFO_SIGNAL | STATION_INFO_TX_BITRATE; | 524 | STATION_INFO_SIGNAL | STATION_INFO_SIGNAL_AVG; |
527 | 525 | ||
528 | /* Get signal information from the firmware */ | 526 | /* Get signal information from the firmware */ |
529 | memset(&signal, 0, sizeof(struct mwifiex_ds_get_signal)); | 527 | if (mwifiex_send_cmd_sync(priv, HostCmd_CMD_RSSI_INFO, |
530 | if (mwifiex_get_signal_info(priv, &signal)) { | 528 | HostCmd_ACT_GEN_GET, 0, NULL)) { |
531 | dev_err(priv->adapter->dev, "getting signal information\n"); | 529 | dev_err(priv->adapter->dev, "failed to get signal information\n"); |
532 | ret = -EFAULT; | 530 | return -EFAULT; |
533 | } | 531 | } |
534 | 532 | ||
535 | if (mwifiex_drv_get_data_rate(priv, &rate)) { | 533 | if (mwifiex_drv_get_data_rate(priv, &rate)) { |
536 | dev_err(priv->adapter->dev, "getting data rate\n"); | 534 | dev_err(priv->adapter->dev, "getting data rate\n"); |
537 | ret = -EFAULT; | 535 | return -EFAULT; |
538 | } | 536 | } |
539 | 537 | ||
540 | /* Get DTIM period information from firmware */ | 538 | /* Get DTIM period information from firmware */ |
@@ -557,11 +555,12 @@ mwifiex_dump_station_info(struct mwifiex_private *priv, | |||
557 | sinfo->txrate.flags |= RATE_INFO_FLAGS_SHORT_GI; | 555 | sinfo->txrate.flags |= RATE_INFO_FLAGS_SHORT_GI; |
558 | } | 556 | } |
559 | 557 | ||
558 | sinfo->signal_avg = priv->bcn_rssi_avg; | ||
560 | sinfo->rx_bytes = priv->stats.rx_bytes; | 559 | sinfo->rx_bytes = priv->stats.rx_bytes; |
561 | sinfo->tx_bytes = priv->stats.tx_bytes; | 560 | sinfo->tx_bytes = priv->stats.tx_bytes; |
562 | sinfo->rx_packets = priv->stats.rx_packets; | 561 | sinfo->rx_packets = priv->stats.rx_packets; |
563 | sinfo->tx_packets = priv->stats.tx_packets; | 562 | sinfo->tx_packets = priv->stats.tx_packets; |
564 | sinfo->signal = priv->qual_level; | 563 | sinfo->signal = priv->bcn_rssi_avg; |
565 | /* bit rate is in 500 kb/s units. Convert it to 100kb/s units */ | 564 | /* bit rate is in 500 kb/s units. Convert it to 100kb/s units */ |
566 | sinfo->txrate.legacy = rate.rate * 5; | 565 | sinfo->txrate.legacy = rate.rate * 5; |
567 | 566 | ||
@@ -581,7 +580,7 @@ mwifiex_dump_station_info(struct mwifiex_private *priv, | |||
581 | priv->curr_bss_params.bss_descriptor.beacon_period; | 580 | priv->curr_bss_params.bss_descriptor.beacon_period; |
582 | } | 581 | } |
583 | 582 | ||
584 | return ret; | 583 | return 0; |
585 | } | 584 | } |
586 | 585 | ||
587 | /* | 586 | /* |
@@ -604,6 +603,23 @@ mwifiex_cfg80211_get_station(struct wiphy *wiphy, struct net_device *dev, | |||
604 | return mwifiex_dump_station_info(priv, sinfo); | 603 | return mwifiex_dump_station_info(priv, sinfo); |
605 | } | 604 | } |
606 | 605 | ||
606 | /* | ||
607 | * CFG802.11 operation handler to dump station information. | ||
608 | */ | ||
609 | static int | ||
610 | mwifiex_cfg80211_dump_station(struct wiphy *wiphy, struct net_device *dev, | ||
611 | int idx, u8 *mac, struct station_info *sinfo) | ||
612 | { | ||
613 | struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); | ||
614 | |||
615 | if (!priv->media_connected || idx) | ||
616 | return -ENOENT; | ||
617 | |||
618 | memcpy(mac, priv->cfg_bssid, ETH_ALEN); | ||
619 | |||
620 | return mwifiex_dump_station_info(priv, sinfo); | ||
621 | } | ||
622 | |||
607 | /* Supported rates to be advertised to the cfg80211 */ | 623 | /* Supported rates to be advertised to the cfg80211 */ |
608 | 624 | ||
609 | static struct ieee80211_rate mwifiex_rates[] = { | 625 | static struct ieee80211_rate mwifiex_rates[] = { |
@@ -750,6 +766,45 @@ static int mwifiex_cfg80211_set_bitrate_mask(struct wiphy *wiphy, | |||
750 | } | 766 | } |
751 | 767 | ||
752 | /* | 768 | /* |
769 | * CFG802.11 operation handler for connection quality monitoring. | ||
770 | * | ||
771 | * This function subscribes/unsubscribes HIGH_RSSI and LOW_RSSI | ||
772 | * events to FW. | ||
773 | */ | ||
774 | static int mwifiex_cfg80211_set_cqm_rssi_config(struct wiphy *wiphy, | ||
775 | struct net_device *dev, | ||
776 | s32 rssi_thold, u32 rssi_hyst) | ||
777 | { | ||
778 | struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); | ||
779 | struct mwifiex_ds_misc_subsc_evt subsc_evt; | ||
780 | |||
781 | priv->cqm_rssi_thold = rssi_thold; | ||
782 | priv->cqm_rssi_hyst = rssi_hyst; | ||
783 | |||
784 | memset(&subsc_evt, 0x00, sizeof(struct mwifiex_ds_misc_subsc_evt)); | ||
785 | subsc_evt.events = BITMASK_BCN_RSSI_LOW | BITMASK_BCN_RSSI_HIGH; | ||
786 | |||
787 | /* Subscribe/unsubscribe low and high rssi events */ | ||
788 | if (rssi_thold && rssi_hyst) { | ||
789 | subsc_evt.action = HostCmd_ACT_BITWISE_SET; | ||
790 | subsc_evt.bcn_l_rssi_cfg.abs_value = abs(rssi_thold); | ||
791 | subsc_evt.bcn_h_rssi_cfg.abs_value = abs(rssi_thold); | ||
792 | subsc_evt.bcn_l_rssi_cfg.evt_freq = 1; | ||
793 | subsc_evt.bcn_h_rssi_cfg.evt_freq = 1; | ||
794 | return mwifiex_send_cmd_sync(priv, | ||
795 | HostCmd_CMD_802_11_SUBSCRIBE_EVENT, | ||
796 | 0, 0, &subsc_evt); | ||
797 | } else { | ||
798 | subsc_evt.action = HostCmd_ACT_BITWISE_CLR; | ||
799 | return mwifiex_send_cmd_sync(priv, | ||
800 | HostCmd_CMD_802_11_SUBSCRIBE_EVENT, | ||
801 | 0, 0, &subsc_evt); | ||
802 | } | ||
803 | |||
804 | return 0; | ||
805 | } | ||
806 | |||
807 | /* | ||
753 | * CFG802.11 operation handler for disconnection request. | 808 | * CFG802.11 operation handler for disconnection request. |
754 | * | 809 | * |
755 | * This function does not work when there is already a disconnection | 810 | * This function does not work when there is already a disconnection |
@@ -1340,6 +1395,7 @@ static struct cfg80211_ops mwifiex_cfg80211_ops = { | |||
1340 | .connect = mwifiex_cfg80211_connect, | 1395 | .connect = mwifiex_cfg80211_connect, |
1341 | .disconnect = mwifiex_cfg80211_disconnect, | 1396 | .disconnect = mwifiex_cfg80211_disconnect, |
1342 | .get_station = mwifiex_cfg80211_get_station, | 1397 | .get_station = mwifiex_cfg80211_get_station, |
1398 | .dump_station = mwifiex_cfg80211_dump_station, | ||
1343 | .set_wiphy_params = mwifiex_cfg80211_set_wiphy_params, | 1399 | .set_wiphy_params = mwifiex_cfg80211_set_wiphy_params, |
1344 | .set_channel = mwifiex_cfg80211_set_channel, | 1400 | .set_channel = mwifiex_cfg80211_set_channel, |
1345 | .join_ibss = mwifiex_cfg80211_join_ibss, | 1401 | .join_ibss = mwifiex_cfg80211_join_ibss, |
@@ -1350,6 +1406,7 @@ static struct cfg80211_ops mwifiex_cfg80211_ops = { | |||
1350 | .set_power_mgmt = mwifiex_cfg80211_set_power_mgmt, | 1406 | .set_power_mgmt = mwifiex_cfg80211_set_power_mgmt, |
1351 | .set_tx_power = mwifiex_cfg80211_set_tx_power, | 1407 | .set_tx_power = mwifiex_cfg80211_set_tx_power, |
1352 | .set_bitrate_mask = mwifiex_cfg80211_set_bitrate_mask, | 1408 | .set_bitrate_mask = mwifiex_cfg80211_set_bitrate_mask, |
1409 | .set_cqm_rssi_config = mwifiex_cfg80211_set_cqm_rssi_config, | ||
1353 | }; | 1410 | }; |
1354 | 1411 | ||
1355 | /* | 1412 | /* |