aboutsummaryrefslogtreecommitdiffstats
path: root/net/wireless/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/wireless/util.c')
-rw-r--r--net/wireless/util.c121
1 files changed, 0 insertions, 121 deletions
diff --git a/net/wireless/util.c b/net/wireless/util.c
index baf7218cec15..92770427b211 100644
--- a/net/wireless/util.c
+++ b/net/wireless/util.c
@@ -1325,13 +1325,6 @@ size_t ieee80211_ie_split_ric(const u8 *ies, size_t ielen,
1325} 1325}
1326EXPORT_SYMBOL(ieee80211_ie_split_ric); 1326EXPORT_SYMBOL(ieee80211_ie_split_ric);
1327 1327
1328size_t ieee80211_ie_split(const u8 *ies, size_t ielen,
1329 const u8 *ids, int n_ids, size_t offset)
1330{
1331 return ieee80211_ie_split_ric(ies, ielen, ids, n_ids, NULL, 0, offset);
1332}
1333EXPORT_SYMBOL(ieee80211_ie_split);
1334
1335bool ieee80211_operating_class_to_band(u8 operating_class, 1328bool ieee80211_operating_class_to_band(u8 operating_class,
1336 enum ieee80211_band *band) 1329 enum ieee80211_band *band)
1337{ 1330{
@@ -1620,120 +1613,6 @@ int cfg80211_check_combinations(struct wiphy *wiphy,
1620} 1613}
1621EXPORT_SYMBOL(cfg80211_check_combinations); 1614EXPORT_SYMBOL(cfg80211_check_combinations);
1622 1615
1623int cfg80211_can_use_iftype_chan(struct cfg80211_registered_device *rdev,
1624 struct wireless_dev *wdev,
1625 enum nl80211_iftype iftype,
1626 struct ieee80211_channel *chan,
1627 enum cfg80211_chan_mode chanmode,
1628 u8 radar_detect)
1629{
1630 struct wireless_dev *wdev_iter;
1631 int num[NUM_NL80211_IFTYPES];
1632 struct ieee80211_channel
1633 *used_channels[CFG80211_MAX_NUM_DIFFERENT_CHANNELS];
1634 struct ieee80211_channel *ch;
1635 enum cfg80211_chan_mode chmode;
1636 int num_different_channels = 0;
1637 int total = 1;
1638 int i;
1639
1640 ASSERT_RTNL();
1641
1642 if (WARN_ON(hweight32(radar_detect) > 1))
1643 return -EINVAL;
1644
1645 if (WARN_ON(iftype >= NUM_NL80211_IFTYPES))
1646 return -EINVAL;
1647
1648 /* Always allow software iftypes */
1649 if (rdev->wiphy.software_iftypes & BIT(iftype)) {
1650 if (radar_detect)
1651 return -EINVAL;
1652 return 0;
1653 }
1654
1655 memset(num, 0, sizeof(num));
1656 memset(used_channels, 0, sizeof(used_channels));
1657
1658 num[iftype] = 1;
1659
1660 /* TODO: We'll probably not need this anymore, since this
1661 * should only be called with CHAN_MODE_UNDEFINED. There are
1662 * still a couple of pending calls where other chanmodes are
1663 * used, but we should get rid of them.
1664 */
1665 switch (chanmode) {
1666 case CHAN_MODE_UNDEFINED:
1667 break;
1668 case CHAN_MODE_SHARED:
1669 WARN_ON(!chan);
1670 used_channels[0] = chan;
1671 num_different_channels++;
1672 break;
1673 case CHAN_MODE_EXCLUSIVE:
1674 num_different_channels++;
1675 break;
1676 }
1677
1678 list_for_each_entry(wdev_iter, &rdev->wdev_list, list) {
1679 if (wdev_iter == wdev)
1680 continue;
1681 if (wdev_iter->iftype == NL80211_IFTYPE_P2P_DEVICE) {
1682 if (!wdev_iter->p2p_started)
1683 continue;
1684 } else if (wdev_iter->netdev) {
1685 if (!netif_running(wdev_iter->netdev))
1686 continue;
1687 } else {
1688 WARN_ON(1);
1689 }
1690
1691 if (rdev->wiphy.software_iftypes & BIT(wdev_iter->iftype))
1692 continue;
1693
1694 /*
1695 * We may be holding the "wdev" mutex, but now need to lock
1696 * wdev_iter. This is OK because once we get here wdev_iter
1697 * is not wdev (tested above), but we need to use the nested
1698 * locking for lockdep.
1699 */
1700 mutex_lock_nested(&wdev_iter->mtx, 1);
1701 __acquire(wdev_iter->mtx);
1702 cfg80211_get_chan_state(wdev_iter, &ch, &chmode, &radar_detect);
1703 wdev_unlock(wdev_iter);
1704
1705 switch (chmode) {
1706 case CHAN_MODE_UNDEFINED:
1707 break;
1708 case CHAN_MODE_SHARED:
1709 for (i = 0; i < CFG80211_MAX_NUM_DIFFERENT_CHANNELS; i++)
1710 if (!used_channels[i] || used_channels[i] == ch)
1711 break;
1712
1713 if (i == CFG80211_MAX_NUM_DIFFERENT_CHANNELS)
1714 return -EBUSY;
1715
1716 if (used_channels[i] == NULL) {
1717 used_channels[i] = ch;
1718 num_different_channels++;
1719 }
1720 break;
1721 case CHAN_MODE_EXCLUSIVE:
1722 num_different_channels++;
1723 break;
1724 }
1725
1726 num[wdev_iter->iftype]++;
1727 total++;
1728 }
1729
1730 if (total == 1 && !radar_detect)
1731 return 0;
1732
1733 return cfg80211_check_combinations(&rdev->wiphy, num_different_channels,
1734 radar_detect, num);
1735}
1736
1737int ieee80211_get_ratemask(struct ieee80211_supported_band *sband, 1616int ieee80211_get_ratemask(struct ieee80211_supported_band *sband,
1738 const u8 *rates, unsigned int n_rates, 1617 const u8 *rates, unsigned int n_rates,
1739 u32 *mask) 1618 u32 *mask)