Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 247660
b: refs/heads/master
c: 7527a78
h: refs/heads/master
v: v3
  • Loading branch information
Johannes Berg authored and John W. Linville committed May 16, 2011
1 parent 5525408 commit 0828443
Show file tree
Hide file tree
Showing 8 changed files with 473 additions and 20 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 805d7d23ef9806e47b550ad80270c4cea4ffc984
refs/heads/master: 7527a782e187d1214a5b3dc2897ce441033bb4ef
122 changes: 121 additions & 1 deletion trunk/include/linux/nl80211.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,39 @@
* below.
*/

/**
* DOC: Virtual interface / concurrency capabilities
*
* Some devices are able to operate with virtual MACs, they can have
* more than one virtual interface. The capability handling for this
* is a bit complex though, as there may be a number of restrictions
* on the types of concurrency that are supported.
*
* To start with, each device supports the interface types listed in
* the %NL80211_ATTR_SUPPORTED_IFTYPES attribute, but by listing the
* types there no concurrency is implied.
*
* Once concurrency is desired, more attributes must be observed:
* To start with, since some interface types are purely managed in
* software, like the AP-VLAN type in mac80211 for example, there's
* an additional list of these, they can be added at any time and
* are only restricted by some semantic restrictions (e.g. AP-VLAN
* cannot be added without a corresponding AP interface). This list
* is exported in the %NL80211_ATTR_SOFTWARE_IFTYPES attribute.
*
* Further, the list of supported combinations is exported. This is
* in the %NL80211_ATTR_INTERFACE_COMBINATIONS attribute. Basically,
* it exports a list of "groups", and at any point in time the
* interfaces that are currently active must fall into any one of
* the advertised groups. Within each group, there are restrictions
* on the number of interfaces of different types that are supported
* and also the number of different channels, along with potentially
* some other restrictions. See &enum nl80211_if_combination_attrs.
*
* All together, these attributes define the concurrency of virtual
* interfaces that a given device supports.
*/

/**
* enum nl80211_commands - supported nl80211 commands
*
Expand Down Expand Up @@ -954,6 +987,14 @@ enum nl80211_commands {
* @NL80211_ATTR_SCHED_SCAN_INTERVAL: Interval between scheduled scan
* cycles, in msecs.
*
* @NL80211_ATTR_INTERFACE_COMBINATIONS: Nested attribute listing the supported
* interface combinations. In each nested item, it contains attributes
* defined in &enum nl80211_if_combination_attrs.
* @NL80211_ATTR_SOFTWARE_IFTYPES: Nested attribute (just like
* %NL80211_ATTR_SUPPORTED_IFTYPES) containing the interface types that
* are managed in software: interfaces of these types aren't subject to
* any restrictions in their number or combinations.
*
* @NL80211_ATTR_MAX: highest attribute number currently defined
* @__NL80211_ATTR_AFTER_LAST: internal use
*/
Expand Down Expand Up @@ -1149,6 +1190,9 @@ enum nl80211_attrs {

NL80211_ATTR_SCHED_SCAN_INTERVAL,

NL80211_ATTR_INTERFACE_COMBINATIONS,
NL80211_ATTR_SOFTWARE_IFTYPES,

/* add attributes here, update the policy in nl80211.c */

__NL80211_ATTR_AFTER_LAST,
Expand Down Expand Up @@ -1201,7 +1245,9 @@ enum nl80211_attrs {
* @NL80211_IFTYPE_ADHOC: independent BSS member
* @NL80211_IFTYPE_STATION: managed BSS member
* @NL80211_IFTYPE_AP: access point
* @NL80211_IFTYPE_AP_VLAN: VLAN interface for access points
* @NL80211_IFTYPE_AP_VLAN: VLAN interface for access points; VLAN interfaces
* are a bit special in that they must always be tied to a pre-existing
* AP type interface.
* @NL80211_IFTYPE_WDS: wireless distribution interface
* @NL80211_IFTYPE_MONITOR: monitor interface receiving all frames
* @NL80211_IFTYPE_MESH_POINT: mesh point
Expand Down Expand Up @@ -2206,4 +2252,78 @@ enum nl80211_wowlan_triggers {
MAX_NL80211_WOWLAN_TRIG = NUM_NL80211_WOWLAN_TRIG - 1
};

/**
* enum nl80211_iface_limit_attrs - limit attributes
* @NL80211_IFACE_LIMIT_UNSPEC: (reserved)
* @NL80211_IFACE_LIMIT_MAX: maximum number of interfaces that
* can be chosen from this set of interface types (u32)
* @NL80211_IFACE_LIMIT_TYPES: nested attribute containing a
* flag attribute for each interface type in this set
* @NUM_NL80211_IFACE_LIMIT: number of attributes
* @MAX_NL80211_IFACE_LIMIT: highest attribute number
*/
enum nl80211_iface_limit_attrs {
NL80211_IFACE_LIMIT_UNSPEC,
NL80211_IFACE_LIMIT_MAX,
NL80211_IFACE_LIMIT_TYPES,

/* keep last */
NUM_NL80211_IFACE_LIMIT,
MAX_NL80211_IFACE_LIMIT = NUM_NL80211_IFACE_LIMIT - 1
};

/**
* enum nl80211_if_combination_attrs -- interface combination attributes
*
* @NL80211_IFACE_COMB_UNSPEC: (reserved)
* @NL80211_IFACE_COMB_LIMITS: Nested attributes containing the limits
* for given interface types, see &enum nl80211_iface_limit_attrs.
* @NL80211_IFACE_COMB_MAXNUM: u32 attribute giving the total number of
* interfaces that can be created in this group. This number doesn't
* apply to interfaces purely managed in software, which are listed
* in a separate attribute %NL80211_ATTR_INTERFACES_SOFTWARE.
* @NL80211_IFACE_COMB_STA_AP_BI_MATCH: flag attribute specifying that
* beacon intervals within this group must be all the same even for
* infrastructure and AP/GO combinations, i.e. the GO(s) must adopt
* the infrastructure network's beacon interval.
* @NL80211_IFACE_COMB_NUM_CHANNELS: u32 attribute specifying how many
* different channels may be used within this group.
* @NUM_NL80211_IFACE_COMB: number of attributes
* @MAX_NL80211_IFACE_COMB: highest attribute number
*
* Examples:
* limits = [ #{STA} <= 1, #{AP} <= 1 ], matching BI, channels = 1, max = 2
* => allows an AP and a STA that must match BIs
*
* numbers = [ #{AP, P2P-GO} <= 8 ], channels = 1, max = 8
* => allows 8 of AP/GO
*
* numbers = [ #{STA} <= 2 ], channels = 2, max = 2
* => allows two STAs on different channels
*
* numbers = [ #{STA} <= 1, #{P2P-client,P2P-GO} <= 3 ], max = 4
* => allows a STA plus three P2P interfaces
*
* The list of these four possiblities could completely be contained
* within the %NL80211_ATTR_INTERFACE_COMBINATIONS attribute to indicate
* that any of these groups must match.
*
* "Combinations" of just a single interface will not be listed here,
* a single interface of any valid interface type is assumed to always
* be possible by itself. This means that implicitly, for each valid
* interface type, the following group always exists:
* numbers = [ #{<type>} <= 1 ], channels = 1, max = 1
*/
enum nl80211_if_combination_attrs {
NL80211_IFACE_COMB_UNSPEC,
NL80211_IFACE_COMB_LIMITS,
NL80211_IFACE_COMB_MAXNUM,
NL80211_IFACE_COMB_STA_AP_BI_MATCH,
NL80211_IFACE_COMB_NUM_CHANNELS,

/* keep last */
NUM_NL80211_IFACE_COMB,
MAX_NL80211_IFACE_COMB = NUM_NL80211_IFACE_COMB - 1
};

#endif /* __LINUX_NL80211_H */
88 changes: 88 additions & 0 deletions trunk/include/net/cfg80211.h
Original file line number Diff line number Diff line change
Expand Up @@ -1547,6 +1547,10 @@ struct cfg80211_ops {
* hints read the documenation for regulatory_hint_found_beacon()
* @WIPHY_FLAG_NETNS_OK: if not set, do not allow changing the netns of this
* wiphy at all
* @WIPHY_FLAG_ENFORCE_COMBINATIONS: Set this flag to enforce interface
* combinations for this device. This flag is used for backward
* compatibility only until all drivers advertise combinations and
* they will always be enforced.
* @WIPHY_FLAG_PS_ON_BY_DEFAULT: if set to true, powersave will be enabled
* by default -- this flag will be set depending on the kernel's default
* on wiphy_new(), but can be changed by the driver if it has a good
Expand Down Expand Up @@ -1574,6 +1578,81 @@ enum wiphy_flags {
WIPHY_FLAG_IBSS_RSN = BIT(8),
WIPHY_FLAG_MESH_AUTH = BIT(10),
WIPHY_FLAG_SUPPORTS_SCHED_SCAN = BIT(11),
WIPHY_FLAG_ENFORCE_COMBINATIONS = BIT(12),
};

/**
* struct ieee80211_iface_limit - limit on certain interface types
* @max: maximum number of interfaces of these types
* @types: interface types (bits)
*/
struct ieee80211_iface_limit {
u16 max;
u16 types;
};

/**
* struct ieee80211_iface_combination - possible interface combination
* @limits: limits for the given interface types
* @n_limits: number of limitations
* @num_different_channels: can use up to this many different channels
* @max_interfaces: maximum number of interfaces in total allowed in this
* group
* @beacon_int_infra_match: In this combination, the beacon intervals
* between infrastructure and AP types must match. This is required
* only in special cases.
*
* These examples can be expressed as follows:
*
* Allow #STA <= 1, #AP <= 1, matching BI, channels = 1, 2 total:
*
* struct ieee80211_iface_limit limits1[] = {
* { .max = 1, .types = BIT(NL80211_IFTYPE_STATION), },
* { .max = 1, .types = BIT(NL80211_IFTYPE_AP}, },
* };
* struct ieee80211_iface_combination combination1 = {
* .limits = limits1,
* .n_limits = ARRAY_SIZE(limits1),
* .max_interfaces = 2,
* .beacon_int_infra_match = true,
* };
*
*
* Allow #{AP, P2P-GO} <= 8, channels = 1, 8 total:
*
* struct ieee80211_iface_limit limits2[] = {
* { .max = 8, .types = BIT(NL80211_IFTYPE_AP) |
* BIT(NL80211_IFTYPE_P2P_GO), },
* };
* struct ieee80211_iface_combination combination2 = {
* .limits = limits2,
* .n_limits = ARRAY_SIZE(limits2),
* .max_interfaces = 8,
* .num_different_channels = 1,
* };
*
*
* Allow #STA <= 1, #{P2P-client,P2P-GO} <= 3 on two channels, 4 total.
* This allows for an infrastructure connection and three P2P connections.
*
* struct ieee80211_iface_limit limits3[] = {
* { .max = 1, .types = BIT(NL80211_IFTYPE_STATION), },
* { .max = 3, .types = BIT(NL80211_IFTYPE_P2P_GO) |
* BIT(NL80211_IFTYPE_P2P_CLIENT), },
* };
* struct ieee80211_iface_combination combination3 = {
* .limits = limits3,
* .n_limits = ARRAY_SIZE(limits3),
* .max_interfaces = 4,
* .num_different_channels = 2,
* };
*/
struct ieee80211_iface_combination {
const struct ieee80211_iface_limit *limits;
u32 num_different_channels;
u16 max_interfaces;
u8 n_limits;
bool beacon_int_infra_match;
};

struct mac_address {
Expand Down Expand Up @@ -1653,6 +1732,11 @@ struct wiphy_wowlan_support {
* @priv: driver private data (sized according to wiphy_new() parameter)
* @interface_modes: bitmask of interfaces types valid for this wiphy,
* must be set by driver
* @iface_combinations: Valid interface combinations array, should not
* list single interface types.
* @n_iface_combinations: number of entries in @iface_combinations array.
* @software_iftypes: bitmask of software interface types, these are not
* subject to any restrictions since they are purely managed in SW.
* @flags: wiphy flags, see &enum wiphy_flags
* @bss_priv_size: each BSS struct has private data allocated with it,
* this variable determines its size
Expand Down Expand Up @@ -1697,6 +1781,10 @@ struct wiphy {

const struct ieee80211_txrx_stypes *mgmt_stypes;

const struct ieee80211_iface_combination *iface_combinations;
int n_iface_combinations;
u16 software_iftypes;

u16 n_addresses;

/* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */
Expand Down
16 changes: 12 additions & 4 deletions trunk/net/mac80211/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,7 @@ EXPORT_SYMBOL(ieee80211_alloc_hw);
int ieee80211_register_hw(struct ieee80211_hw *hw)
{
struct ieee80211_local *local = hw_to_local(hw);
int result;
int result, i;
enum ieee80211_band band;
int channels, max_bitrates;
bool supp_ht;
Expand Down Expand Up @@ -743,11 +743,19 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
return -ENOMEM;

/* if low-level driver supports AP, we also support VLAN */
if (local->hw.wiphy->interface_modes & BIT(NL80211_IFTYPE_AP))
local->hw.wiphy->interface_modes |= BIT(NL80211_IFTYPE_AP_VLAN);
if (local->hw.wiphy->interface_modes & BIT(NL80211_IFTYPE_AP)) {
hw->wiphy->interface_modes |= BIT(NL80211_IFTYPE_AP_VLAN);
hw->wiphy->software_iftypes |= BIT(NL80211_IFTYPE_AP_VLAN);
}

/* mac80211 always supports monitor */
local->hw.wiphy->interface_modes |= BIT(NL80211_IFTYPE_MONITOR);
hw->wiphy->interface_modes |= BIT(NL80211_IFTYPE_MONITOR);
hw->wiphy->software_iftypes |= BIT(NL80211_IFTYPE_MONITOR);

/* mac80211 doesn't support more than 1 channel */
for (i = 0; i < hw->wiphy->n_iface_combinations; i++)
if (hw->wiphy->iface_combinations[i].num_different_channels > 1)
return -EINVAL;

#ifndef CONFIG_MAC80211_MESH
/* mesh depends on Kconfig, but drivers should set it if they want */
Expand Down
Loading

0 comments on commit 0828443

Please sign in to comment.