diff options
author | Johannes Berg <johannes.berg@intel.com> | 2011-05-13 04:58:57 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-05-16 14:10:40 -0400 |
commit | 7527a782e187d1214a5b3dc2897ce441033bb4ef (patch) | |
tree | 3310adf988e72cb91736c0638d4c17edcccebfe1 /include | |
parent | 805d7d23ef9806e47b550ad80270c4cea4ffc984 (diff) |
cfg80211: advertise possible interface combinations
Add the ability to advertise interface combinations in nl80211.
This allows the driver to indicate what the combinations are
that it supports. "Combinations" of just a single interface are
implicit, as previously. Note that cfg80211 will enforce that
the restrictions are met, but not for all drivers yet (once all
drivers are updated, we can remove the flag and enforce for all).
When no combinations are actually supported, an empty list will
be exported so that userspace can know if the kernel exported
this info or not (although it isn't clear to me what tools using
the info should do if the kernel didn't export it).
Since some interface types are purely virtual/software and don't
fit the restrictions, those are exposed in a new list of pure SW
types, not subject to restrictions. This mainly exists to handle
AP-VLAN and monitor interfaces in mac80211.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/nl80211.h | 122 | ||||
-rw-r--r-- | include/net/cfg80211.h | 88 |
2 files changed, 209 insertions, 1 deletions
diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h index 281a2bb6a6ec..0ea497cb607c 100644 --- a/include/linux/nl80211.h +++ b/include/linux/nl80211.h | |||
@@ -77,6 +77,39 @@ | |||
77 | */ | 77 | */ |
78 | 78 | ||
79 | /** | 79 | /** |
80 | * DOC: Virtual interface / concurrency capabilities | ||
81 | * | ||
82 | * Some devices are able to operate with virtual MACs, they can have | ||
83 | * more than one virtual interface. The capability handling for this | ||
84 | * is a bit complex though, as there may be a number of restrictions | ||
85 | * on the types of concurrency that are supported. | ||
86 | * | ||
87 | * To start with, each device supports the interface types listed in | ||
88 | * the %NL80211_ATTR_SUPPORTED_IFTYPES attribute, but by listing the | ||
89 | * types there no concurrency is implied. | ||
90 | * | ||
91 | * Once concurrency is desired, more attributes must be observed: | ||
92 | * To start with, since some interface types are purely managed in | ||
93 | * software, like the AP-VLAN type in mac80211 for example, there's | ||
94 | * an additional list of these, they can be added at any time and | ||
95 | * are only restricted by some semantic restrictions (e.g. AP-VLAN | ||
96 | * cannot be added without a corresponding AP interface). This list | ||
97 | * is exported in the %NL80211_ATTR_SOFTWARE_IFTYPES attribute. | ||
98 | * | ||
99 | * Further, the list of supported combinations is exported. This is | ||
100 | * in the %NL80211_ATTR_INTERFACE_COMBINATIONS attribute. Basically, | ||
101 | * it exports a list of "groups", and at any point in time the | ||
102 | * interfaces that are currently active must fall into any one of | ||
103 | * the advertised groups. Within each group, there are restrictions | ||
104 | * on the number of interfaces of different types that are supported | ||
105 | * and also the number of different channels, along with potentially | ||
106 | * some other restrictions. See &enum nl80211_if_combination_attrs. | ||
107 | * | ||
108 | * All together, these attributes define the concurrency of virtual | ||
109 | * interfaces that a given device supports. | ||
110 | */ | ||
111 | |||
112 | /** | ||
80 | * enum nl80211_commands - supported nl80211 commands | 113 | * enum nl80211_commands - supported nl80211 commands |
81 | * | 114 | * |
82 | * @NL80211_CMD_UNSPEC: unspecified command to catch errors | 115 | * @NL80211_CMD_UNSPEC: unspecified command to catch errors |
@@ -954,6 +987,14 @@ enum nl80211_commands { | |||
954 | * @NL80211_ATTR_SCHED_SCAN_INTERVAL: Interval between scheduled scan | 987 | * @NL80211_ATTR_SCHED_SCAN_INTERVAL: Interval between scheduled scan |
955 | * cycles, in msecs. | 988 | * cycles, in msecs. |
956 | * | 989 | * |
990 | * @NL80211_ATTR_INTERFACE_COMBINATIONS: Nested attribute listing the supported | ||
991 | * interface combinations. In each nested item, it contains attributes | ||
992 | * defined in &enum nl80211_if_combination_attrs. | ||
993 | * @NL80211_ATTR_SOFTWARE_IFTYPES: Nested attribute (just like | ||
994 | * %NL80211_ATTR_SUPPORTED_IFTYPES) containing the interface types that | ||
995 | * are managed in software: interfaces of these types aren't subject to | ||
996 | * any restrictions in their number or combinations. | ||
997 | * | ||
957 | * @NL80211_ATTR_MAX: highest attribute number currently defined | 998 | * @NL80211_ATTR_MAX: highest attribute number currently defined |
958 | * @__NL80211_ATTR_AFTER_LAST: internal use | 999 | * @__NL80211_ATTR_AFTER_LAST: internal use |
959 | */ | 1000 | */ |
@@ -1149,6 +1190,9 @@ enum nl80211_attrs { | |||
1149 | 1190 | ||
1150 | NL80211_ATTR_SCHED_SCAN_INTERVAL, | 1191 | NL80211_ATTR_SCHED_SCAN_INTERVAL, |
1151 | 1192 | ||
1193 | NL80211_ATTR_INTERFACE_COMBINATIONS, | ||
1194 | NL80211_ATTR_SOFTWARE_IFTYPES, | ||
1195 | |||
1152 | /* add attributes here, update the policy in nl80211.c */ | 1196 | /* add attributes here, update the policy in nl80211.c */ |
1153 | 1197 | ||
1154 | __NL80211_ATTR_AFTER_LAST, | 1198 | __NL80211_ATTR_AFTER_LAST, |
@@ -1201,7 +1245,9 @@ enum nl80211_attrs { | |||
1201 | * @NL80211_IFTYPE_ADHOC: independent BSS member | 1245 | * @NL80211_IFTYPE_ADHOC: independent BSS member |
1202 | * @NL80211_IFTYPE_STATION: managed BSS member | 1246 | * @NL80211_IFTYPE_STATION: managed BSS member |
1203 | * @NL80211_IFTYPE_AP: access point | 1247 | * @NL80211_IFTYPE_AP: access point |
1204 | * @NL80211_IFTYPE_AP_VLAN: VLAN interface for access points | 1248 | * @NL80211_IFTYPE_AP_VLAN: VLAN interface for access points; VLAN interfaces |
1249 | * are a bit special in that they must always be tied to a pre-existing | ||
1250 | * AP type interface. | ||
1205 | * @NL80211_IFTYPE_WDS: wireless distribution interface | 1251 | * @NL80211_IFTYPE_WDS: wireless distribution interface |
1206 | * @NL80211_IFTYPE_MONITOR: monitor interface receiving all frames | 1252 | * @NL80211_IFTYPE_MONITOR: monitor interface receiving all frames |
1207 | * @NL80211_IFTYPE_MESH_POINT: mesh point | 1253 | * @NL80211_IFTYPE_MESH_POINT: mesh point |
@@ -2206,4 +2252,78 @@ enum nl80211_wowlan_triggers { | |||
2206 | MAX_NL80211_WOWLAN_TRIG = NUM_NL80211_WOWLAN_TRIG - 1 | 2252 | MAX_NL80211_WOWLAN_TRIG = NUM_NL80211_WOWLAN_TRIG - 1 |
2207 | }; | 2253 | }; |
2208 | 2254 | ||
2255 | /** | ||
2256 | * enum nl80211_iface_limit_attrs - limit attributes | ||
2257 | * @NL80211_IFACE_LIMIT_UNSPEC: (reserved) | ||
2258 | * @NL80211_IFACE_LIMIT_MAX: maximum number of interfaces that | ||
2259 | * can be chosen from this set of interface types (u32) | ||
2260 | * @NL80211_IFACE_LIMIT_TYPES: nested attribute containing a | ||
2261 | * flag attribute for each interface type in this set | ||
2262 | * @NUM_NL80211_IFACE_LIMIT: number of attributes | ||
2263 | * @MAX_NL80211_IFACE_LIMIT: highest attribute number | ||
2264 | */ | ||
2265 | enum nl80211_iface_limit_attrs { | ||
2266 | NL80211_IFACE_LIMIT_UNSPEC, | ||
2267 | NL80211_IFACE_LIMIT_MAX, | ||
2268 | NL80211_IFACE_LIMIT_TYPES, | ||
2269 | |||
2270 | /* keep last */ | ||
2271 | NUM_NL80211_IFACE_LIMIT, | ||
2272 | MAX_NL80211_IFACE_LIMIT = NUM_NL80211_IFACE_LIMIT - 1 | ||
2273 | }; | ||
2274 | |||
2275 | /** | ||
2276 | * enum nl80211_if_combination_attrs -- interface combination attributes | ||
2277 | * | ||
2278 | * @NL80211_IFACE_COMB_UNSPEC: (reserved) | ||
2279 | * @NL80211_IFACE_COMB_LIMITS: Nested attributes containing the limits | ||
2280 | * for given interface types, see &enum nl80211_iface_limit_attrs. | ||
2281 | * @NL80211_IFACE_COMB_MAXNUM: u32 attribute giving the total number of | ||
2282 | * interfaces that can be created in this group. This number doesn't | ||
2283 | * apply to interfaces purely managed in software, which are listed | ||
2284 | * in a separate attribute %NL80211_ATTR_INTERFACES_SOFTWARE. | ||
2285 | * @NL80211_IFACE_COMB_STA_AP_BI_MATCH: flag attribute specifying that | ||
2286 | * beacon intervals within this group must be all the same even for | ||
2287 | * infrastructure and AP/GO combinations, i.e. the GO(s) must adopt | ||
2288 | * the infrastructure network's beacon interval. | ||
2289 | * @NL80211_IFACE_COMB_NUM_CHANNELS: u32 attribute specifying how many | ||
2290 | * different channels may be used within this group. | ||
2291 | * @NUM_NL80211_IFACE_COMB: number of attributes | ||
2292 | * @MAX_NL80211_IFACE_COMB: highest attribute number | ||
2293 | * | ||
2294 | * Examples: | ||
2295 | * limits = [ #{STA} <= 1, #{AP} <= 1 ], matching BI, channels = 1, max = 2 | ||
2296 | * => allows an AP and a STA that must match BIs | ||
2297 | * | ||
2298 | * numbers = [ #{AP, P2P-GO} <= 8 ], channels = 1, max = 8 | ||
2299 | * => allows 8 of AP/GO | ||
2300 | * | ||
2301 | * numbers = [ #{STA} <= 2 ], channels = 2, max = 2 | ||
2302 | * => allows two STAs on different channels | ||
2303 | * | ||
2304 | * numbers = [ #{STA} <= 1, #{P2P-client,P2P-GO} <= 3 ], max = 4 | ||
2305 | * => allows a STA plus three P2P interfaces | ||
2306 | * | ||
2307 | * The list of these four possiblities could completely be contained | ||
2308 | * within the %NL80211_ATTR_INTERFACE_COMBINATIONS attribute to indicate | ||
2309 | * that any of these groups must match. | ||
2310 | * | ||
2311 | * "Combinations" of just a single interface will not be listed here, | ||
2312 | * a single interface of any valid interface type is assumed to always | ||
2313 | * be possible by itself. This means that implicitly, for each valid | ||
2314 | * interface type, the following group always exists: | ||
2315 | * numbers = [ #{<type>} <= 1 ], channels = 1, max = 1 | ||
2316 | */ | ||
2317 | enum nl80211_if_combination_attrs { | ||
2318 | NL80211_IFACE_COMB_UNSPEC, | ||
2319 | NL80211_IFACE_COMB_LIMITS, | ||
2320 | NL80211_IFACE_COMB_MAXNUM, | ||
2321 | NL80211_IFACE_COMB_STA_AP_BI_MATCH, | ||
2322 | NL80211_IFACE_COMB_NUM_CHANNELS, | ||
2323 | |||
2324 | /* keep last */ | ||
2325 | NUM_NL80211_IFACE_COMB, | ||
2326 | MAX_NL80211_IFACE_COMB = NUM_NL80211_IFACE_COMB - 1 | ||
2327 | }; | ||
2328 | |||
2209 | #endif /* __LINUX_NL80211_H */ | 2329 | #endif /* __LINUX_NL80211_H */ |
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index e1f1b41f7b13..04afcfb9eaf4 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h | |||
@@ -1547,6 +1547,10 @@ struct cfg80211_ops { | |||
1547 | * hints read the documenation for regulatory_hint_found_beacon() | 1547 | * hints read the documenation for regulatory_hint_found_beacon() |
1548 | * @WIPHY_FLAG_NETNS_OK: if not set, do not allow changing the netns of this | 1548 | * @WIPHY_FLAG_NETNS_OK: if not set, do not allow changing the netns of this |
1549 | * wiphy at all | 1549 | * wiphy at all |
1550 | * @WIPHY_FLAG_ENFORCE_COMBINATIONS: Set this flag to enforce interface | ||
1551 | * combinations for this device. This flag is used for backward | ||
1552 | * compatibility only until all drivers advertise combinations and | ||
1553 | * they will always be enforced. | ||
1550 | * @WIPHY_FLAG_PS_ON_BY_DEFAULT: if set to true, powersave will be enabled | 1554 | * @WIPHY_FLAG_PS_ON_BY_DEFAULT: if set to true, powersave will be enabled |
1551 | * by default -- this flag will be set depending on the kernel's default | 1555 | * by default -- this flag will be set depending on the kernel's default |
1552 | * on wiphy_new(), but can be changed by the driver if it has a good | 1556 | * on wiphy_new(), but can be changed by the driver if it has a good |
@@ -1574,6 +1578,81 @@ enum wiphy_flags { | |||
1574 | WIPHY_FLAG_IBSS_RSN = BIT(8), | 1578 | WIPHY_FLAG_IBSS_RSN = BIT(8), |
1575 | WIPHY_FLAG_MESH_AUTH = BIT(10), | 1579 | WIPHY_FLAG_MESH_AUTH = BIT(10), |
1576 | WIPHY_FLAG_SUPPORTS_SCHED_SCAN = BIT(11), | 1580 | WIPHY_FLAG_SUPPORTS_SCHED_SCAN = BIT(11), |
1581 | WIPHY_FLAG_ENFORCE_COMBINATIONS = BIT(12), | ||
1582 | }; | ||
1583 | |||
1584 | /** | ||
1585 | * struct ieee80211_iface_limit - limit on certain interface types | ||
1586 | * @max: maximum number of interfaces of these types | ||
1587 | * @types: interface types (bits) | ||
1588 | */ | ||
1589 | struct ieee80211_iface_limit { | ||
1590 | u16 max; | ||
1591 | u16 types; | ||
1592 | }; | ||
1593 | |||
1594 | /** | ||
1595 | * struct ieee80211_iface_combination - possible interface combination | ||
1596 | * @limits: limits for the given interface types | ||
1597 | * @n_limits: number of limitations | ||
1598 | * @num_different_channels: can use up to this many different channels | ||
1599 | * @max_interfaces: maximum number of interfaces in total allowed in this | ||
1600 | * group | ||
1601 | * @beacon_int_infra_match: In this combination, the beacon intervals | ||
1602 | * between infrastructure and AP types must match. This is required | ||
1603 | * only in special cases. | ||
1604 | * | ||
1605 | * These examples can be expressed as follows: | ||
1606 | * | ||
1607 | * Allow #STA <= 1, #AP <= 1, matching BI, channels = 1, 2 total: | ||
1608 | * | ||
1609 | * struct ieee80211_iface_limit limits1[] = { | ||
1610 | * { .max = 1, .types = BIT(NL80211_IFTYPE_STATION), }, | ||
1611 | * { .max = 1, .types = BIT(NL80211_IFTYPE_AP}, }, | ||
1612 | * }; | ||
1613 | * struct ieee80211_iface_combination combination1 = { | ||
1614 | * .limits = limits1, | ||
1615 | * .n_limits = ARRAY_SIZE(limits1), | ||
1616 | * .max_interfaces = 2, | ||
1617 | * .beacon_int_infra_match = true, | ||
1618 | * }; | ||
1619 | * | ||
1620 | * | ||
1621 | * Allow #{AP, P2P-GO} <= 8, channels = 1, 8 total: | ||
1622 | * | ||
1623 | * struct ieee80211_iface_limit limits2[] = { | ||
1624 | * { .max = 8, .types = BIT(NL80211_IFTYPE_AP) | | ||
1625 | * BIT(NL80211_IFTYPE_P2P_GO), }, | ||
1626 | * }; | ||
1627 | * struct ieee80211_iface_combination combination2 = { | ||
1628 | * .limits = limits2, | ||
1629 | * .n_limits = ARRAY_SIZE(limits2), | ||
1630 | * .max_interfaces = 8, | ||
1631 | * .num_different_channels = 1, | ||
1632 | * }; | ||
1633 | * | ||
1634 | * | ||
1635 | * Allow #STA <= 1, #{P2P-client,P2P-GO} <= 3 on two channels, 4 total. | ||
1636 | * This allows for an infrastructure connection and three P2P connections. | ||
1637 | * | ||
1638 | * struct ieee80211_iface_limit limits3[] = { | ||
1639 | * { .max = 1, .types = BIT(NL80211_IFTYPE_STATION), }, | ||
1640 | * { .max = 3, .types = BIT(NL80211_IFTYPE_P2P_GO) | | ||
1641 | * BIT(NL80211_IFTYPE_P2P_CLIENT), }, | ||
1642 | * }; | ||
1643 | * struct ieee80211_iface_combination combination3 = { | ||
1644 | * .limits = limits3, | ||
1645 | * .n_limits = ARRAY_SIZE(limits3), | ||
1646 | * .max_interfaces = 4, | ||
1647 | * .num_different_channels = 2, | ||
1648 | * }; | ||
1649 | */ | ||
1650 | struct ieee80211_iface_combination { | ||
1651 | const struct ieee80211_iface_limit *limits; | ||
1652 | u32 num_different_channels; | ||
1653 | u16 max_interfaces; | ||
1654 | u8 n_limits; | ||
1655 | bool beacon_int_infra_match; | ||
1577 | }; | 1656 | }; |
1578 | 1657 | ||
1579 | struct mac_address { | 1658 | struct mac_address { |
@@ -1653,6 +1732,11 @@ struct wiphy_wowlan_support { | |||
1653 | * @priv: driver private data (sized according to wiphy_new() parameter) | 1732 | * @priv: driver private data (sized according to wiphy_new() parameter) |
1654 | * @interface_modes: bitmask of interfaces types valid for this wiphy, | 1733 | * @interface_modes: bitmask of interfaces types valid for this wiphy, |
1655 | * must be set by driver | 1734 | * must be set by driver |
1735 | * @iface_combinations: Valid interface combinations array, should not | ||
1736 | * list single interface types. | ||
1737 | * @n_iface_combinations: number of entries in @iface_combinations array. | ||
1738 | * @software_iftypes: bitmask of software interface types, these are not | ||
1739 | * subject to any restrictions since they are purely managed in SW. | ||
1656 | * @flags: wiphy flags, see &enum wiphy_flags | 1740 | * @flags: wiphy flags, see &enum wiphy_flags |
1657 | * @bss_priv_size: each BSS struct has private data allocated with it, | 1741 | * @bss_priv_size: each BSS struct has private data allocated with it, |
1658 | * this variable determines its size | 1742 | * this variable determines its size |
@@ -1697,6 +1781,10 @@ struct wiphy { | |||
1697 | 1781 | ||
1698 | const struct ieee80211_txrx_stypes *mgmt_stypes; | 1782 | const struct ieee80211_txrx_stypes *mgmt_stypes; |
1699 | 1783 | ||
1784 | const struct ieee80211_iface_combination *iface_combinations; | ||
1785 | int n_iface_combinations; | ||
1786 | u16 software_iftypes; | ||
1787 | |||
1700 | u16 n_addresses; | 1788 | u16 n_addresses; |
1701 | 1789 | ||
1702 | /* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */ | 1790 | /* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */ |