History

cfg80211: support virtual interfaces with different beacon intervals

This commit provides a mechanism for the host drivers to advertise the support for different beacon intervals among the respective interface combinations in a group, through NL80211_IFACE_COMB_BI_MIN_GCD (u32). This value will be compared against GCD of all beaconing interfaces of matching combinations. If the driver doesn't advertise this value, the old behaviour where all beacon intervals must be identical is retained. If it is specified, then any beacon interval for an interface in the interface combination as well as the GCD of all active beacon intervals in the combination must be greater or equal to this value.

Purushottam Kushwaha committed 10 years ago

Commit 0c317a01 parent e2273005 files · +70 −12Browse files

Unified · Split

5 files
  1. include/net/cfg80211.h +15 −0
  2. include/uapi/linux/nl80211.h +6 −2
  3. net/wireless/core.h +1 −1
  4. net/wireless/nl80211.c +11 −3
  5. net/wireless/util.c +37 −6
include/net/cfg80211.h+15−0
@@ -784,11 +784,19 @@ struct cfg80211_csa_settings { · 783 unmodified lines
784 * @iftype_num: array with the number of interfaces of each interface784 * @iftype_num: array with the number of interfaces of each interface
785 * type. The index is the interface type as specified in &enum785 * type. The index is the interface type as specified in &enum
786 * nl80211_iftype.786 * nl80211_iftype.
787 * @beacon_int_gcd: a value specifying GCD of all beaconing interfaces,
788 * the GCD of a single value is considered the value itself, so for
789 * a single interface this should be set to that interface's beacon
790 * interval
791 * @beacon_int_different: a flag indicating whether or not all beacon
792 * intervals (of beaconing interfaces) are different or not.
787 */793 */
788struct iface_combination_params {794struct iface_combination_params {
789 int num_different_channels;795 int num_different_channels;
790 u8 radar_detect;796 u8 radar_detect;
791 int iftype_num[NUM_NL80211_IFTYPES];797 int iftype_num[NUM_NL80211_IFTYPES];
798 u32 beacon_int_gcd;
799 bool beacon_int_different;
792};800};
793 801
794/**802/**
@@ -3100,6 +3108,12 @@ struct ieee80211_iface_limit { · 2305 unmodified lines
3100 * only in special cases.3108 * only in special cases.
3101 * @radar_detect_widths: bitmap of channel widths supported for radar detection3109 * @radar_detect_widths: bitmap of channel widths supported for radar detection
3102 * @radar_detect_regions: bitmap of regions supported for radar detection3110 * @radar_detect_regions: bitmap of regions supported for radar detection
3111 * @beacon_int_min_gcd: This interface combination supports different
3112 * beacon intervals.
3113 * = 0 - all beacon intervals for different interface must be same.
3114 * > 0 - any beacon interval for the interface part of this combination AND
3115 * *GCD* of all beacon intervals from beaconing interfaces of this
3116 * combination must be greater or equal to this value.
3103 *3117 *
3104 * With this structure the driver can describe which interface3118 * With this structure the driver can describe which interface
3105 * combinations it supports concurrently.3119 * combinations it supports concurrently.
@@ -3158,6 +3172,7 @@ struct ieee80211_iface_combination { · 52 unmodified lines
3158 bool beacon_int_infra_match;3172 bool beacon_int_infra_match;
3159 u8 radar_detect_widths;3173 u8 radar_detect_widths;
3160 u8 radar_detect_regions;3174 u8 radar_detect_regions;
3175 u32 beacon_int_min_gcd;
3161};3176};
3162 3177
3163struct ieee80211_txrx_stypes {3178struct ieee80211_txrx_stypes {
include/uapi/linux/nl80211.h+6−2
@@ -4280,6 +4280,9 @@ enum nl80211_iface_limit_attrs { · 4279 unmodified lines
4280 * of supported channel widths for radar detection.4280 * of supported channel widths for radar detection.
4281 * @NL80211_IFACE_COMB_RADAR_DETECT_REGIONS: u32 attribute containing the bitmap4281 * @NL80211_IFACE_COMB_RADAR_DETECT_REGIONS: u32 attribute containing the bitmap
4282 * of supported regulatory regions for radar detection.4282 * of supported regulatory regions for radar detection.
4283 * @NL80211_IFACE_COMB_BI_MIN_GCD: u32 attribute specifying the minimum GCD of
4284 * different beacon intervals supported by all the interface combinations
4285 * in this group (if not present, all beacon intervals be identical).
4283 * @NUM_NL80211_IFACE_COMB: number of attributes4286 * @NUM_NL80211_IFACE_COMB: number of attributes
4284 * @MAX_NL80211_IFACE_COMB: highest attribute number4287 * @MAX_NL80211_IFACE_COMB: highest attribute number
4285 *4288 *
@@ -4287,8 +4290,8 @@ enum nl80211_iface_limit_attrs { · 1 unmodified line
4287 * limits = [ #{STA} <= 1, #{AP} <= 1 ], matching BI, channels = 1, max = 24290 * limits = [ #{STA} <= 1, #{AP} <= 1 ], matching BI, channels = 1, max = 2
4288 * => allows an AP and a STA that must match BIs4291 * => allows an AP and a STA that must match BIs
4289 *4292 *
4290 * numbers = [ #{AP, P2P-GO} <= 8 ], channels = 1, max = 84293 * numbers = [ #{AP, P2P-GO} <= 8 ], BI min gcd, channels = 1, max = 8,
4291 * => allows 8 of AP/GO4294 * => allows 8 of AP/GO that can have BI gcd >= min gcd
4292 *4295 *
4293 * numbers = [ #{STA} <= 2 ], channels = 2, max = 24296 * numbers = [ #{STA} <= 2 ], channels = 2, max = 2
4294 * => allows two STAs on different channels4297 * => allows two STAs on different channels
@@ -4314,6 +4317,7 @@ enum nl80211_if_combination_attrs { · 19 unmodified lines
4314 NL80211_IFACE_COMB_NUM_CHANNELS,4317 NL80211_IFACE_COMB_NUM_CHANNELS,
4315 NL80211_IFACE_COMB_RADAR_DETECT_WIDTHS,4318 NL80211_IFACE_COMB_RADAR_DETECT_WIDTHS,
4316 NL80211_IFACE_COMB_RADAR_DETECT_REGIONS,4319 NL80211_IFACE_COMB_RADAR_DETECT_REGIONS,
4320 NL80211_IFACE_COMB_BI_MIN_GCD,
4317 4321
4318 /* keep last */4322 /* keep last */
4319 NUM_NL80211_IFACE_COMB,4323 NUM_NL80211_IFACE_COMB,
net/wireless/core.h+1−1
@@ -475,7 +475,7 @@ int ieee80211_get_ratemask(struct ieee80211_supported_band *sband, · 474 unmodified lines
475 u32 *mask);475 u32 *mask);
476 476
477int cfg80211_validate_beacon_int(struct cfg80211_registered_device *rdev,477int cfg80211_validate_beacon_int(struct cfg80211_registered_device *rdev,
478 u32 beacon_int);478 enum nl80211_iftype iftype, u32 beacon_int);
479 479
480void cfg80211_update_iface_num(struct cfg80211_registered_device *rdev,480void cfg80211_update_iface_num(struct cfg80211_registered_device *rdev,
481 enum nl80211_iftype iftype, int num);481 enum nl80211_iftype iftype, int num);
net/wireless/nl80211.c+11−3
@@ -1075,6 +1075,10 @@ static int nl80211_put_iface_combinations(struct wiphy *wiphy, · 1074 unmodified lines
1075 nla_put_u32(msg, NL80211_IFACE_COMB_RADAR_DETECT_REGIONS,1075 nla_put_u32(msg, NL80211_IFACE_COMB_RADAR_DETECT_REGIONS,
1076 c->radar_detect_regions)))1076 c->radar_detect_regions)))
1077 goto nla_put_failure;1077 goto nla_put_failure;
1078 if (c->beacon_int_min_gcd &&
1079 nla_put_u32(msg, NL80211_IFACE_COMB_BI_MIN_GCD,
1080 c->beacon_int_min_gcd))
1081 goto nla_put_failure;
1078 1082
1079 nla_nest_end(msg, nl_combi);1083 nla_nest_end(msg, nl_combi);
1080 }1084 }
@@ -3803,7 +3807,8 @@ static int nl80211_start_ap(struct sk_buff *skb, struct genl_info *info) · 2722 unmodified lines
3803 params.dtim_period =3807 params.dtim_period =
3804 nla_get_u32(info->attrs[NL80211_ATTR_DTIM_PERIOD]);3808 nla_get_u32(info->attrs[NL80211_ATTR_DTIM_PERIOD]);
3805 3809
3806 err = cfg80211_validate_beacon_int(rdev, params.beacon_interval);3810 err = cfg80211_validate_beacon_int(rdev, dev->ieee80211_ptr->iftype,
3811 params.beacon_interval);
3807 if (err)3812 if (err)
3808 return err;3813 return err;
3809 3814
@@ -8152,7 +8157,8 @@ static int nl80211_join_ibss(struct sk_buff *skb, struct genl_info *info) · 4342 unmodified lines
8152 ibss.beacon_interval =8157 ibss.beacon_interval =
8153 nla_get_u32(info->attrs[NL80211_ATTR_BEACON_INTERVAL]);8158 nla_get_u32(info->attrs[NL80211_ATTR_BEACON_INTERVAL]);
8154 8159
8155 err = cfg80211_validate_beacon_int(rdev, ibss.beacon_interval);8160 err = cfg80211_validate_beacon_int(rdev, NL80211_IFTYPE_ADHOC,
8161 ibss.beacon_interval);
8156 if (err)8162 if (err)
8157 return err;8163 return err;
8158 8164
@@ -9417,7 +9423,9 @@ static int nl80211_join_mesh(struct sk_buff *skb, struct genl_info *info) · 1258 unmodified lines
9417 setup.beacon_interval =9423 setup.beacon_interval =
9418 nla_get_u32(info->attrs[NL80211_ATTR_BEACON_INTERVAL]);9424 nla_get_u32(info->attrs[NL80211_ATTR_BEACON_INTERVAL]);
9419 9425
9420 err = cfg80211_validate_beacon_int(rdev, setup.beacon_interval);9426 err = cfg80211_validate_beacon_int(rdev,
9427 NL80211_IFTYPE_MESH_POINT,
9428 setup.beacon_interval);
9421 if (err)9429 if (err)
9422 return err;9430 return err;
9423 }9431 }
net/wireless/util.c+37−6
@@ -1559,24 +1559,46 @@ bool ieee80211_chandef_to_operating_class(struct cfg80211_chan_def *chandef, · 1558 unmodified lines
1559EXPORT_SYMBOL(ieee80211_chandef_to_operating_class);1559EXPORT_SYMBOL(ieee80211_chandef_to_operating_class);
1560 1560
1561int cfg80211_validate_beacon_int(struct cfg80211_registered_device *rdev,1561int cfg80211_validate_beacon_int(struct cfg80211_registered_device *rdev,
1562 u32 beacon_int)1562 enum nl80211_iftype iftype, u32 beacon_int)
1563{1563{
1564 struct wireless_dev *wdev;1564 struct wireless_dev *wdev;
1565 int res = 0;1565 struct iface_combination_params params = {
1566 .beacon_int_gcd = beacon_int, /* GCD(n) = n */
1567 };
1566 1568
1567 if (beacon_int < 10 || beacon_int > 10000)1569 if (beacon_int < 10 || beacon_int > 10000)
1568 return -EINVAL;1570 return -EINVAL;
1569 1571
1572 params.iftype_num[iftype] = 1;
1570 list_for_each_entry(wdev, &rdev->wiphy.wdev_list, list) {1573 list_for_each_entry(wdev, &rdev->wiphy.wdev_list, list) {
1571 if (!wdev->beacon_interval)1574 if (!wdev->beacon_interval)
1572 continue;1575 continue;
1573 if (wdev->beacon_interval != beacon_int) {1576
1574 res = -EINVAL;1577 params.iftype_num[wdev->iftype]++;
1575 break;1578 }
1579
1580 list_for_each_entry(wdev, &rdev->wiphy.wdev_list, list) {
1581 u32 bi_prev = wdev->beacon_interval;
1582
1583 if (!wdev->beacon_interval)
1584 continue;
1585
1586 /* slight optimisation - skip identical BIs */
1587 if (wdev->beacon_interval == beacon_int)
1588 continue;
1589
1590 params.beacon_int_different = true;
1591
1592 /* Get the GCD */
1593 while (bi_prev != 0) {
1594 u32 tmp_bi = bi_prev;
1595
1596 bi_prev = params.beacon_int_gcd % bi_prev;
1597 params.beacon_int_gcd = tmp_bi;
1576 }1598 }
1577 }1599 }
1578 1600
1579 return res;1601 return cfg80211_check_combinations(&rdev->wiphy, &params);
1580}1602}
1581 1603
1582int cfg80211_iter_combinations(struct wiphy *wiphy,1604int cfg80211_iter_combinations(struct wiphy *wiphy,
@@ -1652,6 +1674,15 @@ int cfg80211_iter_combinations(struct wiphy *wiphy, · 69 unmodified lines
1652 if ((all_iftypes & used_iftypes) != used_iftypes)1674 if ((all_iftypes & used_iftypes) != used_iftypes)
1653 goto cont;1675 goto cont;
1654 1676
1677 if (params->beacon_int_gcd) {
1678 if (c->beacon_int_min_gcd &&
1679 params->beacon_int_gcd < c->beacon_int_min_gcd)
1680 return -EINVAL;
1681 if (!c->beacon_int_min_gcd &&
1682 params->beacon_int_different)
1683 goto cont;
1684 }
1685
1655 /* This combination covered all interface types and1686 /* This combination covered all interface types and
1656 * supported the requested numbers, so we're good.1687 * supported the requested numbers, so we're good.
1657 */1688 */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t