cfg.c (fe57d9f5c0a2c1ef97ba8cdc42cfda5743f287b8) | cfg.c (55de908ab292c03f1eb280f51170ddb9c6b57e31) |
---|---|
1/* 2 * mac80211 configuration hooks for cfg80211 3 * 4 * Copyright 2006-2010 Johannes Berg <johannes@sipsolutions.net> 5 * 6 * This file is GPLv2 as found in COPYING. 7 */ 8 --- 358 unchanged lines hidden (view full) --- 367 368 ieee80211_set_default_mgmt_key(sdata, key_idx); 369 370 return 0; 371} 372 373static void rate_idx_to_bitrate(struct rate_info *rate, struct sta_info *sta, int idx) 374{ | 1/* 2 * mac80211 configuration hooks for cfg80211 3 * 4 * Copyright 2006-2010 Johannes Berg <johannes@sipsolutions.net> 5 * 6 * This file is GPLv2 as found in COPYING. 7 */ 8 --- 358 unchanged lines hidden (view full) --- 367 368 ieee80211_set_default_mgmt_key(sdata, key_idx); 369 370 return 0; 371} 372 373static void rate_idx_to_bitrate(struct rate_info *rate, struct sta_info *sta, int idx) 374{ |
375 enum ieee80211_band band = ieee80211_get_sdata_band(sta->sdata); 376 |
|
375 if (!(rate->flags & RATE_INFO_FLAGS_MCS)) { 376 struct ieee80211_supported_band *sband; | 377 if (!(rate->flags & RATE_INFO_FLAGS_MCS)) { 378 struct ieee80211_supported_band *sband; |
377 sband = sta->local->hw.wiphy->bands[ 378 sta->local->oper_channel->band]; | 379 sband = sta->local->hw.wiphy->bands[band]; |
379 rate->legacy = sband->bitrates[idx].bitrate; 380 } else 381 rate->mcs = idx; 382} 383 384void sta_set_rate_info_tx(struct sta_info *sta, 385 const struct ieee80211_tx_rate *rate, 386 struct rate_info *rinfo) --- 140 unchanged lines hidden (view full) --- 527} 528 529static void ieee80211_get_et_stats(struct wiphy *wiphy, 530 struct net_device *dev, 531 struct ethtool_stats *stats, 532 u64 *data) 533{ 534 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 380 rate->legacy = sband->bitrates[idx].bitrate; 381 } else 382 rate->mcs = idx; 383} 384 385void sta_set_rate_info_tx(struct sta_info *sta, 386 const struct ieee80211_tx_rate *rate, 387 struct rate_info *rinfo) --- 140 unchanged lines hidden (view full) --- 528} 529 530static void ieee80211_get_et_stats(struct wiphy *wiphy, 531 struct net_device *dev, 532 struct ethtool_stats *stats, 533 u64 *data) 534{ 535 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
536 struct ieee80211_chanctx_conf *chanctx_conf; 537 struct ieee80211_channel *channel; |
|
535 struct sta_info *sta; 536 struct ieee80211_local *local = sdata->local; 537 struct station_info sinfo; 538 struct survey_info survey; 539 int i, q; 540#define STA_STATS_SURVEY_LEN 7 541 542 memset(data, 0, sizeof(u64) * STA_STATS_LEN); --- 59 unchanged lines hidden (view full) --- 602 i = 0; 603 ADD_STA_STATS(sta); 604 } 605 } 606 607do_survey: 608 i = STA_STATS_LEN - STA_STATS_SURVEY_LEN; 609 /* Get survey stats for current channel */ | 538 struct sta_info *sta; 539 struct ieee80211_local *local = sdata->local; 540 struct station_info sinfo; 541 struct survey_info survey; 542 int i, q; 543#define STA_STATS_SURVEY_LEN 7 544 545 memset(data, 0, sizeof(u64) * STA_STATS_LEN); --- 59 unchanged lines hidden (view full) --- 605 i = 0; 606 ADD_STA_STATS(sta); 607 } 608 } 609 610do_survey: 611 i = STA_STATS_LEN - STA_STATS_SURVEY_LEN; 612 /* Get survey stats for current channel */ |
610 q = 0; 611 while (true) { 612 survey.filled = 0; 613 if (drv_get_survey(local, q, &survey) != 0) { 614 survey.filled = 0; 615 break; 616 } | 613 survey.filled = 0; |
617 | 614 |
618 if (survey.channel && 619 (local->oper_channel->center_freq == 620 survey.channel->center_freq)) 621 break; 622 q++; | 615 rcu_read_lock(); 616 chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf); 617 if (chanctx_conf) 618 channel = chanctx_conf->channel; 619 else 620 channel = NULL; 621 rcu_read_unlock(); 622 623 if (channel) { 624 q = 0; 625 do { 626 survey.filled = 0; 627 if (drv_get_survey(local, q, &survey) != 0) { 628 survey.filled = 0; 629 break; 630 } 631 q++; 632 } while (channel != survey.channel); |
623 } 624 625 if (survey.filled) 626 data[i++] = survey.channel->center_freq; 627 else 628 data[i++] = 0; 629 if (survey.filled & SURVEY_INFO_NOISE_DBM) 630 data[i++] = (u8)survey.noise; --- 88 unchanged lines hidden (view full) --- 719 sta_set_sinfo(sta, sinfo); 720 } 721 722 mutex_unlock(&local->sta_mtx); 723 724 return ret; 725} 726 | 633 } 634 635 if (survey.filled) 636 data[i++] = survey.channel->center_freq; 637 else 638 data[i++] = 0; 639 if (survey.filled & SURVEY_INFO_NOISE_DBM) 640 data[i++] = (u8)survey.noise; --- 88 unchanged lines hidden (view full) --- 729 sta_set_sinfo(sta, sinfo); 730 } 731 732 mutex_unlock(&local->sta_mtx); 733 734 return ret; 735} 736 |
727static int ieee80211_set_channel(struct wiphy *wiphy, 728 struct net_device *netdev, 729 struct ieee80211_channel *chan, 730 enum nl80211_channel_type channel_type) | 737static int ieee80211_set_monitor_channel(struct wiphy *wiphy, 738 struct ieee80211_channel *chan, 739 enum nl80211_channel_type channel_type) |
731{ 732 struct ieee80211_local *local = wiphy_priv(wiphy); | 740{ 741 struct ieee80211_local *local = wiphy_priv(wiphy); |
733 struct ieee80211_sub_if_data *sdata = NULL; | 742 struct ieee80211_sub_if_data *sdata; 743 int ret = 0; |
734 | 744 |
735 if (netdev) 736 sdata = IEEE80211_DEV_TO_SUB_IF(netdev); | 745 if (local->monitor_channel == chan && 746 local->monitor_channel_type == channel_type) 747 return 0; |
737 | 748 |
738 switch (ieee80211_get_channel_mode(local, NULL)) { 739 case CHAN_MODE_HOPPING: 740 return -EBUSY; 741 case CHAN_MODE_FIXED: 742 if (local->oper_channel != chan || 743 (!sdata && local->_oper_channel_type != channel_type)) 744 return -EBUSY; 745 if (!sdata && local->_oper_channel_type == channel_type) 746 return 0; 747 break; 748 case CHAN_MODE_UNDEFINED: 749 break; | 749 mutex_lock(&local->iflist_mtx); 750 if (local->use_chanctx) { 751 sdata = rcu_dereference_protected( 752 local->monitor_sdata, 753 lockdep_is_held(&local->iflist_mtx)); 754 if (sdata) { 755 ieee80211_vif_release_channel(sdata); 756 ret = ieee80211_vif_use_channel( 757 sdata, chan, channel_type, 758 IEEE80211_CHANCTX_EXCLUSIVE); 759 } 760 } else if (local->open_count == local->monitors) { 761 local->_oper_channel = chan; 762 local->_oper_channel_type = channel_type; 763 ieee80211_hw_config(local, 0); |
750 } 751 | 764 } 765 |
752 if (!ieee80211_set_channel_type(local, sdata, channel_type)) 753 return -EBUSY; | 766 if (ret == 0) { 767 local->monitor_channel = chan; 768 local->monitor_channel_type = channel_type; 769 } 770 mutex_unlock(&local->iflist_mtx); |
754 | 771 |
755 local->oper_channel = chan; 756 757 /* auto-detects changes */ 758 ieee80211_hw_config(local, 0); 759 760 return 0; | 772 return ret; |
761} 762 | 773} 774 |
763static int ieee80211_set_monitor_channel(struct wiphy *wiphy, 764 struct ieee80211_channel *chan, 765 enum nl80211_channel_type channel_type) 766{ 767 return ieee80211_set_channel(wiphy, NULL, chan, channel_type); 768} 769 | |
770static int ieee80211_set_probe_resp(struct ieee80211_sub_if_data *sdata, 771 const u8 *resp, size_t resp_len) 772{ 773 struct probe_resp *new, *old; 774 775 if (!resp || !resp_len) 776 return 1; 777 --- 96 unchanged lines hidden (view full) --- 874 BSS_CHANGED_BEACON | 875 BSS_CHANGED_SSID; 876 int err; 877 878 old = rtnl_dereference(sdata->u.ap.beacon); 879 if (old) 880 return -EALREADY; 881 | 775static int ieee80211_set_probe_resp(struct ieee80211_sub_if_data *sdata, 776 const u8 *resp, size_t resp_len) 777{ 778 struct probe_resp *new, *old; 779 780 if (!resp || !resp_len) 781 return 1; 782 --- 96 unchanged lines hidden (view full) --- 879 BSS_CHANGED_BEACON | 880 BSS_CHANGED_SSID; 881 int err; 882 883 old = rtnl_dereference(sdata->u.ap.beacon); 884 if (old) 885 return -EALREADY; 886 |
882 err = ieee80211_set_channel(wiphy, dev, params->channel, 883 params->channel_type); | 887 err = ieee80211_vif_use_channel(sdata, params->channel, 888 params->channel_type, 889 IEEE80211_CHANCTX_SHARED); |
884 if (err) 885 return err; 886 887 /* 888 * Apply control port protocol, this allows us to 889 * not encrypt dynamic WEP control frames. 890 */ 891 sdata->control_port_protocol = params->crypto.control_port_ethertype; --- 66 unchanged lines hidden (view full) --- 958 959 RCU_INIT_POINTER(sdata->u.ap.beacon, NULL); 960 961 kfree_rcu(old, rcu_head); 962 963 sta_info_flush(sdata->local, sdata); 964 ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_BEACON_ENABLED); 965 | 890 if (err) 891 return err; 892 893 /* 894 * Apply control port protocol, this allows us to 895 * not encrypt dynamic WEP control frames. 896 */ 897 sdata->control_port_protocol = params->crypto.control_port_ethertype; --- 66 unchanged lines hidden (view full) --- 964 965 RCU_INIT_POINTER(sdata->u.ap.beacon, NULL); 966 967 kfree_rcu(old, rcu_head); 968 969 sta_info_flush(sdata->local, sdata); 970 ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_BEACON_ENABLED); 971 |
972 ieee80211_vif_release_channel(sdata); 973 |
|
966 return 0; 967} 968 969/* Layer 2 Update frame (802.2 Type 1 LLC XID Update response) */ 970struct iapp_layer2_update { 971 u8 da[ETH_ALEN]; /* broadcast */ 972 u8 sa[ETH_ALEN]; /* STA addr */ 973 __be16 len; /* 6 */ --- 40 unchanged lines hidden (view full) --- 1014 struct sta_info *sta, 1015 struct station_parameters *params) 1016{ 1017 int ret = 0; 1018 u32 rates; 1019 int i, j; 1020 struct ieee80211_supported_band *sband; 1021 struct ieee80211_sub_if_data *sdata = sta->sdata; | 974 return 0; 975} 976 977/* Layer 2 Update frame (802.2 Type 1 LLC XID Update response) */ 978struct iapp_layer2_update { 979 u8 da[ETH_ALEN]; /* broadcast */ 980 u8 sa[ETH_ALEN]; /* STA addr */ 981 __be16 len; /* 6 */ --- 40 unchanged lines hidden (view full) --- 1022 struct sta_info *sta, 1023 struct station_parameters *params) 1024{ 1025 int ret = 0; 1026 u32 rates; 1027 int i, j; 1028 struct ieee80211_supported_band *sband; 1029 struct ieee80211_sub_if_data *sdata = sta->sdata; |
1030 enum ieee80211_band band = ieee80211_get_sdata_band(sdata); |
|
1022 u32 mask, set; 1023 | 1031 u32 mask, set; 1032 |
1024 sband = local->hw.wiphy->bands[local->oper_channel->band]; | 1033 sband = local->hw.wiphy->bands[band]; |
1025 1026 mask = params->sta_flags_mask; 1027 set = params->sta_flags_set; 1028 1029 /* 1030 * In mesh mode, we can clear AUTHENTICATED flag but must 1031 * also make ASSOCIATED follow appropriately for the driver 1032 * API. See also below, after AUTHORIZED changes. --- 98 unchanged lines hidden (view full) --- 1131 1132 for (i = 0; i < params->supported_rates_len; i++) { 1133 int rate = (params->supported_rates[i] & 0x7f) * 5; 1134 for (j = 0; j < sband->n_bitrates; j++) { 1135 if (sband->bitrates[j].bitrate == rate) 1136 rates |= BIT(j); 1137 } 1138 } | 1034 1035 mask = params->sta_flags_mask; 1036 set = params->sta_flags_set; 1037 1038 /* 1039 * In mesh mode, we can clear AUTHENTICATED flag but must 1040 * also make ASSOCIATED follow appropriately for the driver 1041 * API. See also below, after AUTHORIZED changes. --- 98 unchanged lines hidden (view full) --- 1140 1141 for (i = 0; i < params->supported_rates_len; i++) { 1142 int rate = (params->supported_rates[i] & 0x7f) * 5; 1143 for (j = 0; j < sband->n_bitrates; j++) { 1144 if (sband->bitrates[j].bitrate == rate) 1145 rates |= BIT(j); 1146 } 1147 } |
1139 sta->sta.supp_rates[local->oper_channel->band] = rates; | 1148 sta->sta.supp_rates[band] = rates; |
1140 } 1141 1142 if (params->ht_capa) 1143 ieee80211_ht_cap_ie_to_sta_ht_cap(sdata, sband, 1144 params->ht_capa, 1145 &sta->sta.ht_cap); 1146 1147 if (ieee80211_vif_is_mesh(&sdata->vif)) { --- 511 unchanged lines hidden (view full) --- 1659 struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; 1660 int err; 1661 1662 memcpy(&ifmsh->mshcfg, conf, sizeof(struct mesh_config)); 1663 err = copy_mesh_setup(ifmsh, setup); 1664 if (err) 1665 return err; 1666 | 1149 } 1150 1151 if (params->ht_capa) 1152 ieee80211_ht_cap_ie_to_sta_ht_cap(sdata, sband, 1153 params->ht_capa, 1154 &sta->sta.ht_cap); 1155 1156 if (ieee80211_vif_is_mesh(&sdata->vif)) { --- 511 unchanged lines hidden (view full) --- 1668 struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; 1669 int err; 1670 1671 memcpy(&ifmsh->mshcfg, conf, sizeof(struct mesh_config)); 1672 err = copy_mesh_setup(ifmsh, setup); 1673 if (err) 1674 return err; 1675 |
1667 err = ieee80211_set_channel(wiphy, dev, setup->channel, 1668 setup->channel_type); | 1676 err = ieee80211_vif_use_channel(sdata, setup->channel, 1677 setup->channel_type, 1678 IEEE80211_CHANCTX_SHARED); |
1669 if (err) 1670 return err; 1671 1672 ieee80211_start_mesh(sdata); 1673 1674 return 0; 1675} 1676 1677static int ieee80211_leave_mesh(struct wiphy *wiphy, struct net_device *dev) 1678{ 1679 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 1680 1681 ieee80211_stop_mesh(sdata); | 1679 if (err) 1680 return err; 1681 1682 ieee80211_start_mesh(sdata); 1683 1684 return 0; 1685} 1686 1687static int ieee80211_leave_mesh(struct wiphy *wiphy, struct net_device *dev) 1688{ 1689 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 1690 1691 ieee80211_stop_mesh(sdata); |
1692 ieee80211_vif_release_channel(sdata); |
|
1682 1683 return 0; 1684} 1685#endif 1686 1687static int ieee80211_change_bss(struct wiphy *wiphy, 1688 struct net_device *dev, 1689 struct bss_parameters *params) 1690{ | 1693 1694 return 0; 1695} 1696#endif 1697 1698static int ieee80211_change_bss(struct wiphy *wiphy, 1699 struct net_device *dev, 1700 struct bss_parameters *params) 1701{ |
1691 struct ieee80211_sub_if_data *sdata; | 1702 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 1703 enum ieee80211_band band; |
1692 u32 changed = 0; 1693 | 1704 u32 changed = 0; 1705 |
1694 sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 1706 if (!rtnl_dereference(sdata->u.ap.beacon)) 1707 return -ENOENT; |
1695 | 1708 |
1709 band = ieee80211_get_sdata_band(sdata); 1710 |
|
1696 if (params->use_cts_prot >= 0) { 1697 sdata->vif.bss_conf.use_cts_prot = params->use_cts_prot; 1698 changed |= BSS_CHANGED_ERP_CTS_PROT; 1699 } 1700 if (params->use_short_preamble >= 0) { 1701 sdata->vif.bss_conf.use_short_preamble = 1702 params->use_short_preamble; 1703 changed |= BSS_CHANGED_ERP_PREAMBLE; 1704 } 1705 1706 if (!sdata->vif.bss_conf.use_short_slot && | 1711 if (params->use_cts_prot >= 0) { 1712 sdata->vif.bss_conf.use_cts_prot = params->use_cts_prot; 1713 changed |= BSS_CHANGED_ERP_CTS_PROT; 1714 } 1715 if (params->use_short_preamble >= 0) { 1716 sdata->vif.bss_conf.use_short_preamble = 1717 params->use_short_preamble; 1718 changed |= BSS_CHANGED_ERP_PREAMBLE; 1719 } 1720 1721 if (!sdata->vif.bss_conf.use_short_slot && |
1707 sdata->local->oper_channel->band == IEEE80211_BAND_5GHZ) { | 1722 band == IEEE80211_BAND_5GHZ) { |
1708 sdata->vif.bss_conf.use_short_slot = true; 1709 changed |= BSS_CHANGED_ERP_SLOT; 1710 } 1711 1712 if (params->use_short_slot_time >= 0) { 1713 sdata->vif.bss_conf.use_short_slot = 1714 params->use_short_slot_time; 1715 changed |= BSS_CHANGED_ERP_SLOT; 1716 } 1717 1718 if (params->basic_rates) { 1719 int i, j; 1720 u32 rates = 0; | 1723 sdata->vif.bss_conf.use_short_slot = true; 1724 changed |= BSS_CHANGED_ERP_SLOT; 1725 } 1726 1727 if (params->use_short_slot_time >= 0) { 1728 sdata->vif.bss_conf.use_short_slot = 1729 params->use_short_slot_time; 1730 changed |= BSS_CHANGED_ERP_SLOT; 1731 } 1732 1733 if (params->basic_rates) { 1734 int i, j; 1735 u32 rates = 0; |
1721 struct ieee80211_local *local = wiphy_priv(wiphy); 1722 struct ieee80211_supported_band *sband = 1723 wiphy->bands[local->oper_channel->band]; | 1736 struct ieee80211_supported_band *sband = wiphy->bands[band]; |
1724 1725 for (i = 0; i < params->basic_rates_len; i++) { 1726 int rate = (params->basic_rates[i] & 0x7f) * 5; 1727 for (j = 0; j < sband->n_bitrates; j++) { 1728 if (sband->bitrates[j].bitrate == rate) 1729 rates |= BIT(j); 1730 } 1731 } --- 135 unchanged lines hidden (view full) --- 1867 struct cfg80211_auth_request *req) 1868{ 1869 return ieee80211_mgd_auth(IEEE80211_DEV_TO_SUB_IF(dev), req); 1870} 1871 1872static int ieee80211_assoc(struct wiphy *wiphy, struct net_device *dev, 1873 struct cfg80211_assoc_request *req) 1874{ | 1737 1738 for (i = 0; i < params->basic_rates_len; i++) { 1739 int rate = (params->basic_rates[i] & 0x7f) * 5; 1740 for (j = 0; j < sband->n_bitrates; j++) { 1741 if (sband->bitrates[j].bitrate == rate) 1742 rates |= BIT(j); 1743 } 1744 } --- 135 unchanged lines hidden (view full) --- 1880 struct cfg80211_auth_request *req) 1881{ 1882 return ieee80211_mgd_auth(IEEE80211_DEV_TO_SUB_IF(dev), req); 1883} 1884 1885static int ieee80211_assoc(struct wiphy *wiphy, struct net_device *dev, 1886 struct cfg80211_assoc_request *req) 1887{ |
1875 struct ieee80211_local *local = wiphy_priv(wiphy); 1876 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 1877 1878 switch (ieee80211_get_channel_mode(local, sdata)) { 1879 case CHAN_MODE_HOPPING: 1880 return -EBUSY; 1881 case CHAN_MODE_FIXED: 1882 if (local->oper_channel == req->bss->channel) 1883 break; 1884 return -EBUSY; 1885 case CHAN_MODE_UNDEFINED: 1886 break; 1887 } 1888 | |
1889 return ieee80211_mgd_assoc(IEEE80211_DEV_TO_SUB_IF(dev), req); 1890} 1891 1892static int ieee80211_deauth(struct wiphy *wiphy, struct net_device *dev, 1893 struct cfg80211_deauth_request *req) 1894{ 1895 return ieee80211_mgd_deauth(IEEE80211_DEV_TO_SUB_IF(dev), req); 1896} 1897 1898static int ieee80211_disassoc(struct wiphy *wiphy, struct net_device *dev, 1899 struct cfg80211_disassoc_request *req) 1900{ 1901 return ieee80211_mgd_disassoc(IEEE80211_DEV_TO_SUB_IF(dev), req); 1902} 1903 1904static int ieee80211_join_ibss(struct wiphy *wiphy, struct net_device *dev, 1905 struct cfg80211_ibss_params *params) 1906{ | 1888 return ieee80211_mgd_assoc(IEEE80211_DEV_TO_SUB_IF(dev), req); 1889} 1890 1891static int ieee80211_deauth(struct wiphy *wiphy, struct net_device *dev, 1892 struct cfg80211_deauth_request *req) 1893{ 1894 return ieee80211_mgd_deauth(IEEE80211_DEV_TO_SUB_IF(dev), req); 1895} 1896 1897static int ieee80211_disassoc(struct wiphy *wiphy, struct net_device *dev, 1898 struct cfg80211_disassoc_request *req) 1899{ 1900 return ieee80211_mgd_disassoc(IEEE80211_DEV_TO_SUB_IF(dev), req); 1901} 1902 1903static int ieee80211_join_ibss(struct wiphy *wiphy, struct net_device *dev, 1904 struct cfg80211_ibss_params *params) 1905{ |
1907 struct ieee80211_local *local = wiphy_priv(wiphy); 1908 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 1909 1910 switch (ieee80211_get_channel_mode(local, sdata)) { 1911 case CHAN_MODE_HOPPING: 1912 return -EBUSY; 1913 case CHAN_MODE_FIXED: 1914 if (!params->channel_fixed) 1915 return -EBUSY; 1916 if (local->oper_channel == params->channel) 1917 break; 1918 return -EBUSY; 1919 case CHAN_MODE_UNDEFINED: 1920 break; 1921 } 1922 1923 return ieee80211_ibss_join(sdata, params); | 1906 return ieee80211_ibss_join(IEEE80211_DEV_TO_SUB_IF(dev), params); |
1924} 1925 1926static int ieee80211_leave_ibss(struct wiphy *wiphy, struct net_device *dev) 1927{ | 1907} 1908 1909static int ieee80211_leave_ibss(struct wiphy *wiphy, struct net_device *dev) 1910{ |
1928 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 1929 1930 return ieee80211_ibss_leave(sdata); | 1911 return ieee80211_ibss_leave(IEEE80211_DEV_TO_SUB_IF(dev)); |
1931} 1932 1933static int ieee80211_set_wiphy_params(struct wiphy *wiphy, u32 changed) 1934{ 1935 struct ieee80211_local *local = wiphy_priv(wiphy); 1936 int err; 1937 1938 if (changed & WIPHY_PARAM_FRAG_THRESHOLD) { --- 27 unchanged lines hidden (view full) --- 1966 1967 return 0; 1968} 1969 1970static int ieee80211_set_tx_power(struct wiphy *wiphy, 1971 enum nl80211_tx_power_setting type, int mbm) 1972{ 1973 struct ieee80211_local *local = wiphy_priv(wiphy); | 1912} 1913 1914static int ieee80211_set_wiphy_params(struct wiphy *wiphy, u32 changed) 1915{ 1916 struct ieee80211_local *local = wiphy_priv(wiphy); 1917 int err; 1918 1919 if (changed & WIPHY_PARAM_FRAG_THRESHOLD) { --- 27 unchanged lines hidden (view full) --- 1947 1948 return 0; 1949} 1950 1951static int ieee80211_set_tx_power(struct wiphy *wiphy, 1952 enum nl80211_tx_power_setting type, int mbm) 1953{ 1954 struct ieee80211_local *local = wiphy_priv(wiphy); |
1974 struct ieee80211_channel *chan = local->oper_channel; | 1955 struct ieee80211_channel *chan = local->_oper_channel; |
1975 u32 changes = 0; 1976 | 1956 u32 changes = 0; 1957 |
1958 /* FIXME */ 1959 if (local->use_chanctx) 1960 return -EOPNOTSUPP; 1961 |
|
1977 switch (type) { 1978 case NL80211_TX_POWER_AUTOMATIC: 1979 local->user_power_level = -1; 1980 break; 1981 case NL80211_TX_POWER_LIMITED: 1982 if (mbm < 0 || (mbm % 100)) 1983 return -EOPNOTSUPP; 1984 local->user_power_level = MBM_TO_DBM(mbm); --- 528 unchanged lines hidden (view full) --- 2513 default: 2514 return -EOPNOTSUPP; 2515 } 2516 2517 mutex_lock(&local->mtx); 2518 2519 /* Check if the operating channel is the requested channel */ 2520 if (!need_offchan) { | 1962 switch (type) { 1963 case NL80211_TX_POWER_AUTOMATIC: 1964 local->user_power_level = -1; 1965 break; 1966 case NL80211_TX_POWER_LIMITED: 1967 if (mbm < 0 || (mbm % 100)) 1968 return -EOPNOTSUPP; 1969 local->user_power_level = MBM_TO_DBM(mbm); --- 528 unchanged lines hidden (view full) --- 2498 default: 2499 return -EOPNOTSUPP; 2500 } 2501 2502 mutex_lock(&local->mtx); 2503 2504 /* Check if the operating channel is the requested channel */ 2505 if (!need_offchan) { |
2521 need_offchan = chan != local->oper_channel; 2522 if (channel_type_valid && 2523 channel_type != local->_oper_channel_type) | 2506 struct ieee80211_chanctx_conf *chanctx_conf; 2507 2508 rcu_read_lock(); 2509 chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf); 2510 2511 if (chanctx_conf) { 2512 need_offchan = chan != chanctx_conf->channel; 2513 if (channel_type_valid && 2514 channel_type != chanctx_conf->channel_type) 2515 need_offchan = true; 2516 } else { |
2524 need_offchan = true; | 2517 need_offchan = true; |
2518 } 2519 rcu_read_unlock(); |
|
2525 } 2526 2527 if (need_offchan && !offchan) { 2528 ret = -EBUSY; 2529 goto out_unlock; 2530 } 2531 2532 skb = dev_alloc_skb(local->hw.extra_tx_headroom + len); --- 132 unchanged lines hidden (view full) --- 2665} 2666 2667static u16 ieee80211_get_tdls_sta_capab(struct ieee80211_sub_if_data *sdata) 2668{ 2669 struct ieee80211_local *local = sdata->local; 2670 u16 capab; 2671 2672 capab = 0; | 2520 } 2521 2522 if (need_offchan && !offchan) { 2523 ret = -EBUSY; 2524 goto out_unlock; 2525 } 2526 2527 skb = dev_alloc_skb(local->hw.extra_tx_headroom + len); --- 132 unchanged lines hidden (view full) --- 2660} 2661 2662static u16 ieee80211_get_tdls_sta_capab(struct ieee80211_sub_if_data *sdata) 2663{ 2664 struct ieee80211_local *local = sdata->local; 2665 u16 capab; 2666 2667 capab = 0; |
2673 if (local->oper_channel->band != IEEE80211_BAND_2GHZ) | 2668 if (ieee80211_get_sdata_band(sdata) != IEEE80211_BAND_2GHZ) |
2674 return capab; 2675 2676 if (!(local->hw.flags & IEEE80211_HW_2GHZ_SHORT_SLOT_INCAPABLE)) 2677 capab |= WLAN_CAPABILITY_SHORT_SLOT_TIME; 2678 if (!(local->hw.flags & IEEE80211_HW_2GHZ_SHORT_PREAMBLE_INCAPABLE)) 2679 capab |= WLAN_CAPABILITY_SHORT_PREAMBLE; 2680 2681 return capab; --- 15 unchanged lines hidden (view full) --- 2697} 2698 2699static int 2700ieee80211_prep_tdls_encap_data(struct wiphy *wiphy, struct net_device *dev, 2701 u8 *peer, u8 action_code, u8 dialog_token, 2702 u16 status_code, struct sk_buff *skb) 2703{ 2704 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 2669 return capab; 2670 2671 if (!(local->hw.flags & IEEE80211_HW_2GHZ_SHORT_SLOT_INCAPABLE)) 2672 capab |= WLAN_CAPABILITY_SHORT_SLOT_TIME; 2673 if (!(local->hw.flags & IEEE80211_HW_2GHZ_SHORT_PREAMBLE_INCAPABLE)) 2674 capab |= WLAN_CAPABILITY_SHORT_PREAMBLE; 2675 2676 return capab; --- 15 unchanged lines hidden (view full) --- 2692} 2693 2694static int 2695ieee80211_prep_tdls_encap_data(struct wiphy *wiphy, struct net_device *dev, 2696 u8 *peer, u8 action_code, u8 dialog_token, 2697 u16 status_code, struct sk_buff *skb) 2698{ 2699 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
2705 struct ieee80211_local *local = sdata->local; | 2700 enum ieee80211_band band = ieee80211_get_sdata_band(sdata); |
2706 struct ieee80211_tdls_data *tf; 2707 2708 tf = (void *)skb_put(skb, offsetof(struct ieee80211_tdls_data, u)); 2709 2710 memcpy(tf->da, peer, ETH_ALEN); 2711 memcpy(tf->sa, sdata->vif.addr, ETH_ALEN); 2712 tf->ether_type = cpu_to_be16(ETH_P_TDLS); 2713 tf->payload_type = WLAN_TDLS_SNAP_RFTYPE; 2714 2715 switch (action_code) { 2716 case WLAN_TDLS_SETUP_REQUEST: 2717 tf->category = WLAN_CATEGORY_TDLS; 2718 tf->action_code = WLAN_TDLS_SETUP_REQUEST; 2719 2720 skb_put(skb, sizeof(tf->u.setup_req)); 2721 tf->u.setup_req.dialog_token = dialog_token; 2722 tf->u.setup_req.capability = 2723 cpu_to_le16(ieee80211_get_tdls_sta_capab(sdata)); 2724 | 2701 struct ieee80211_tdls_data *tf; 2702 2703 tf = (void *)skb_put(skb, offsetof(struct ieee80211_tdls_data, u)); 2704 2705 memcpy(tf->da, peer, ETH_ALEN); 2706 memcpy(tf->sa, sdata->vif.addr, ETH_ALEN); 2707 tf->ether_type = cpu_to_be16(ETH_P_TDLS); 2708 tf->payload_type = WLAN_TDLS_SNAP_RFTYPE; 2709 2710 switch (action_code) { 2711 case WLAN_TDLS_SETUP_REQUEST: 2712 tf->category = WLAN_CATEGORY_TDLS; 2713 tf->action_code = WLAN_TDLS_SETUP_REQUEST; 2714 2715 skb_put(skb, sizeof(tf->u.setup_req)); 2716 tf->u.setup_req.dialog_token = dialog_token; 2717 tf->u.setup_req.capability = 2718 cpu_to_le16(ieee80211_get_tdls_sta_capab(sdata)); 2719 |
2725 ieee80211_add_srates_ie(sdata, skb, false, 2726 local->oper_channel->band); 2727 ieee80211_add_ext_srates_ie(sdata, skb, false, 2728 local->oper_channel->band); | 2720 ieee80211_add_srates_ie(sdata, skb, false, band); 2721 ieee80211_add_ext_srates_ie(sdata, skb, false, band); |
2729 ieee80211_tdls_add_ext_capab(skb); 2730 break; 2731 case WLAN_TDLS_SETUP_RESPONSE: 2732 tf->category = WLAN_CATEGORY_TDLS; 2733 tf->action_code = WLAN_TDLS_SETUP_RESPONSE; 2734 2735 skb_put(skb, sizeof(tf->u.setup_resp)); 2736 tf->u.setup_resp.status_code = cpu_to_le16(status_code); 2737 tf->u.setup_resp.dialog_token = dialog_token; 2738 tf->u.setup_resp.capability = 2739 cpu_to_le16(ieee80211_get_tdls_sta_capab(sdata)); 2740 | 2722 ieee80211_tdls_add_ext_capab(skb); 2723 break; 2724 case WLAN_TDLS_SETUP_RESPONSE: 2725 tf->category = WLAN_CATEGORY_TDLS; 2726 tf->action_code = WLAN_TDLS_SETUP_RESPONSE; 2727 2728 skb_put(skb, sizeof(tf->u.setup_resp)); 2729 tf->u.setup_resp.status_code = cpu_to_le16(status_code); 2730 tf->u.setup_resp.dialog_token = dialog_token; 2731 tf->u.setup_resp.capability = 2732 cpu_to_le16(ieee80211_get_tdls_sta_capab(sdata)); 2733 |
2741 ieee80211_add_srates_ie(sdata, skb, false, 2742 local->oper_channel->band); 2743 ieee80211_add_ext_srates_ie(sdata, skb, false, 2744 local->oper_channel->band); | 2734 ieee80211_add_srates_ie(sdata, skb, false, band); 2735 ieee80211_add_ext_srates_ie(sdata, skb, false, band); |
2745 ieee80211_tdls_add_ext_capab(skb); 2746 break; 2747 case WLAN_TDLS_SETUP_CONFIRM: 2748 tf->category = WLAN_CATEGORY_TDLS; 2749 tf->action_code = WLAN_TDLS_SETUP_CONFIRM; 2750 2751 skb_put(skb, sizeof(tf->u.setup_cfm)); 2752 tf->u.setup_cfm.status_code = cpu_to_le16(status_code); --- 21 unchanged lines hidden (view full) --- 2774} 2775 2776static int 2777ieee80211_prep_tdls_direct(struct wiphy *wiphy, struct net_device *dev, 2778 u8 *peer, u8 action_code, u8 dialog_token, 2779 u16 status_code, struct sk_buff *skb) 2780{ 2781 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 2736 ieee80211_tdls_add_ext_capab(skb); 2737 break; 2738 case WLAN_TDLS_SETUP_CONFIRM: 2739 tf->category = WLAN_CATEGORY_TDLS; 2740 tf->action_code = WLAN_TDLS_SETUP_CONFIRM; 2741 2742 skb_put(skb, sizeof(tf->u.setup_cfm)); 2743 tf->u.setup_cfm.status_code = cpu_to_le16(status_code); --- 21 unchanged lines hidden (view full) --- 2765} 2766 2767static int 2768ieee80211_prep_tdls_direct(struct wiphy *wiphy, struct net_device *dev, 2769 u8 *peer, u8 action_code, u8 dialog_token, 2770 u16 status_code, struct sk_buff *skb) 2771{ 2772 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
2782 struct ieee80211_local *local = sdata->local; | 2773 enum ieee80211_band band = ieee80211_get_sdata_band(sdata); |
2783 struct ieee80211_mgmt *mgmt; 2784 2785 mgmt = (void *)skb_put(skb, 24); 2786 memset(mgmt, 0, 24); 2787 memcpy(mgmt->da, peer, ETH_ALEN); 2788 memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN); 2789 memcpy(mgmt->bssid, sdata->u.mgd.bssid, ETH_ALEN); 2790 --- 6 unchanged lines hidden (view full) --- 2797 mgmt->u.action.category = WLAN_CATEGORY_PUBLIC; 2798 mgmt->u.action.u.tdls_discover_resp.action_code = 2799 WLAN_PUB_ACTION_TDLS_DISCOVER_RES; 2800 mgmt->u.action.u.tdls_discover_resp.dialog_token = 2801 dialog_token; 2802 mgmt->u.action.u.tdls_discover_resp.capability = 2803 cpu_to_le16(ieee80211_get_tdls_sta_capab(sdata)); 2804 | 2774 struct ieee80211_mgmt *mgmt; 2775 2776 mgmt = (void *)skb_put(skb, 24); 2777 memset(mgmt, 0, 24); 2778 memcpy(mgmt->da, peer, ETH_ALEN); 2779 memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN); 2780 memcpy(mgmt->bssid, sdata->u.mgd.bssid, ETH_ALEN); 2781 --- 6 unchanged lines hidden (view full) --- 2788 mgmt->u.action.category = WLAN_CATEGORY_PUBLIC; 2789 mgmt->u.action.u.tdls_discover_resp.action_code = 2790 WLAN_PUB_ACTION_TDLS_DISCOVER_RES; 2791 mgmt->u.action.u.tdls_discover_resp.dialog_token = 2792 dialog_token; 2793 mgmt->u.action.u.tdls_discover_resp.capability = 2794 cpu_to_le16(ieee80211_get_tdls_sta_capab(sdata)); 2795 |
2805 ieee80211_add_srates_ie(sdata, skb, false, 2806 local->oper_channel->band); 2807 ieee80211_add_ext_srates_ie(sdata, skb, false, 2808 local->oper_channel->band); | 2796 ieee80211_add_srates_ie(sdata, skb, false, band); 2797 ieee80211_add_ext_srates_ie(sdata, skb, false, band); |
2809 ieee80211_tdls_add_ext_capab(skb); 2810 break; 2811 default: 2812 return -EINVAL; 2813 } 2814 2815 return 0; 2816} --- 163 unchanged lines hidden (view full) --- 2980 struct ieee80211_local *local = sdata->local; 2981 struct ieee80211_qos_hdr *nullfunc; 2982 struct sk_buff *skb; 2983 int size = sizeof(*nullfunc); 2984 __le16 fc; 2985 bool qos; 2986 struct ieee80211_tx_info *info; 2987 struct sta_info *sta; | 2798 ieee80211_tdls_add_ext_capab(skb); 2799 break; 2800 default: 2801 return -EINVAL; 2802 } 2803 2804 return 0; 2805} --- 163 unchanged lines hidden (view full) --- 2969 struct ieee80211_local *local = sdata->local; 2970 struct ieee80211_qos_hdr *nullfunc; 2971 struct sk_buff *skb; 2972 int size = sizeof(*nullfunc); 2973 __le16 fc; 2974 bool qos; 2975 struct ieee80211_tx_info *info; 2976 struct sta_info *sta; |
2977 struct ieee80211_chanctx_conf *chanctx_conf; 2978 enum ieee80211_band band; |
|
2988 2989 rcu_read_lock(); | 2979 2980 rcu_read_lock(); |
2981 chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf); 2982 if (WARN_ON(!chanctx_conf)) { 2983 rcu_read_unlock(); 2984 return -EINVAL; 2985 } 2986 band = chanctx_conf->channel->band; |
|
2990 sta = sta_info_get(sdata, peer); 2991 if (sta) { 2992 qos = test_sta_flag(sta, WLAN_STA_WME); | 2987 sta = sta_info_get(sdata, peer); 2988 if (sta) { 2989 qos = test_sta_flag(sta, WLAN_STA_WME); |
2993 rcu_read_unlock(); | |
2994 } else { 2995 rcu_read_unlock(); 2996 return -ENOLINK; 2997 } 2998 2999 if (qos) { 3000 fc = cpu_to_le16(IEEE80211_FTYPE_DATA | 3001 IEEE80211_STYPE_QOS_NULLFUNC | 3002 IEEE80211_FCTL_FROMDS); 3003 } else { 3004 size -= 2; 3005 fc = cpu_to_le16(IEEE80211_FTYPE_DATA | 3006 IEEE80211_STYPE_NULLFUNC | 3007 IEEE80211_FCTL_FROMDS); 3008 } 3009 3010 skb = dev_alloc_skb(local->hw.extra_tx_headroom + size); | 2990 } else { 2991 rcu_read_unlock(); 2992 return -ENOLINK; 2993 } 2994 2995 if (qos) { 2996 fc = cpu_to_le16(IEEE80211_FTYPE_DATA | 2997 IEEE80211_STYPE_QOS_NULLFUNC | 2998 IEEE80211_FCTL_FROMDS); 2999 } else { 3000 size -= 2; 3001 fc = cpu_to_le16(IEEE80211_FTYPE_DATA | 3002 IEEE80211_STYPE_NULLFUNC | 3003 IEEE80211_FCTL_FROMDS); 3004 } 3005 3006 skb = dev_alloc_skb(local->hw.extra_tx_headroom + size); |
3011 if (!skb) | 3007 if (!skb) { 3008 rcu_read_unlock(); |
3012 return -ENOMEM; | 3009 return -ENOMEM; |
3010 } |
|
3013 3014 skb->dev = dev; 3015 3016 skb_reserve(skb, local->hw.extra_tx_headroom); 3017 3018 nullfunc = (void *) skb_put(skb, size); 3019 nullfunc->frame_control = fc; 3020 nullfunc->duration_id = 0; --- 8 unchanged lines hidden (view full) --- 3029 IEEE80211_TX_INTFL_NL80211_FRAME_TX; 3030 3031 skb_set_queue_mapping(skb, IEEE80211_AC_VO); 3032 skb->priority = 7; 3033 if (qos) 3034 nullfunc->qos_ctrl = cpu_to_le16(7); 3035 3036 local_bh_disable(); | 3011 3012 skb->dev = dev; 3013 3014 skb_reserve(skb, local->hw.extra_tx_headroom); 3015 3016 nullfunc = (void *) skb_put(skb, size); 3017 nullfunc->frame_control = fc; 3018 nullfunc->duration_id = 0; --- 8 unchanged lines hidden (view full) --- 3027 IEEE80211_TX_INTFL_NL80211_FRAME_TX; 3028 3029 skb_set_queue_mapping(skb, IEEE80211_AC_VO); 3030 skb->priority = 7; 3031 if (qos) 3032 nullfunc->qos_ctrl = cpu_to_le16(7); 3033 3034 local_bh_disable(); |
3037 ieee80211_xmit(sdata, skb); | 3035 ieee80211_xmit(sdata, skb, band); |
3038 local_bh_enable(); | 3036 local_bh_enable(); |
3037 rcu_read_unlock(); |
|
3039 3040 *cookie = (unsigned long) skb; 3041 return 0; 3042} 3043 3044static struct ieee80211_channel * 3045ieee80211_cfg_get_channel(struct wiphy *wiphy, struct wireless_dev *wdev, 3046 enum nl80211_channel_type *type) 3047{ | 3038 3039 *cookie = (unsigned long) skb; 3040 return 0; 3041} 3042 3043static struct ieee80211_channel * 3044ieee80211_cfg_get_channel(struct wiphy *wiphy, struct wireless_dev *wdev, 3045 enum nl80211_channel_type *type) 3046{ |
3048 struct ieee80211_local *local = wiphy_priv(wiphy); | 3047 struct ieee80211_sub_if_data *sdata = IEEE80211_WDEV_TO_SUB_IF(wdev); 3048 struct ieee80211_chanctx_conf *chanctx_conf; 3049 struct ieee80211_channel *chan = NULL; |
3049 | 3050 |
3050 *type = local->_oper_channel_type; 3051 return local->oper_channel; | 3051 rcu_read_lock(); 3052 chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf); 3053 if (chanctx_conf) { 3054 *type = chanctx_conf->channel_type; 3055 chan = chanctx_conf->channel; 3056 } 3057 rcu_read_unlock(); 3058 3059 return chan; |
3052} 3053 3054#ifdef CONFIG_PM 3055static void ieee80211_set_wakeup(struct wiphy *wiphy, bool enabled) 3056{ 3057 drv_set_wakeup(wiphy_priv(wiphy), enabled); 3058} 3059#endif --- 78 unchanged lines hidden --- | 3060} 3061 3062#ifdef CONFIG_PM 3063static void ieee80211_set_wakeup(struct wiphy *wiphy, bool enabled) 3064{ 3065 drv_set_wakeup(wiphy_priv(wiphy), enabled); 3066} 3067#endif --- 78 unchanged lines hidden --- |