mac80211: allow creating wiphy devices with suggested name
Support creating wiphy devices with an optional name. This will be used by hwsim to have better automated control over virtual radio creation/deletion. Signed-off-by: Ben Greear <greearb@candelatech.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
parent
1998d90ad4
commit
ad28757eef
|
@ -3063,7 +3063,27 @@ struct ieee80211_ops {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ieee80211_alloc_hw - Allocate a new hardware device
|
* ieee80211_alloc_hw_nm - Allocate a new hardware device
|
||||||
|
*
|
||||||
|
* This must be called once for each hardware device. The returned pointer
|
||||||
|
* must be used to refer to this device when calling other functions.
|
||||||
|
* mac80211 allocates a private data area for the driver pointed to by
|
||||||
|
* @priv in &struct ieee80211_hw, the size of this area is given as
|
||||||
|
* @priv_data_len.
|
||||||
|
*
|
||||||
|
* @priv_data_len: length of private data
|
||||||
|
* @ops: callbacks for this device
|
||||||
|
* @requested_name: Requested name for this device.
|
||||||
|
* NULL is valid value, and means use the default naming (phy%d)
|
||||||
|
*
|
||||||
|
* Return: A pointer to the new hardware device, or %NULL on error.
|
||||||
|
*/
|
||||||
|
struct ieee80211_hw *ieee80211_alloc_hw_nm(size_t priv_data_len,
|
||||||
|
const struct ieee80211_ops *ops,
|
||||||
|
const char *requested_name);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ieee80211_alloc_hw - Allocate a new hardware device
|
||||||
*
|
*
|
||||||
* This must be called once for each hardware device. The returned pointer
|
* This must be called once for each hardware device. The returned pointer
|
||||||
* must be used to refer to this device when calling other functions.
|
* must be used to refer to this device when calling other functions.
|
||||||
|
@ -3076,8 +3096,12 @@ struct ieee80211_ops {
|
||||||
*
|
*
|
||||||
* Return: A pointer to the new hardware device, or %NULL on error.
|
* Return: A pointer to the new hardware device, or %NULL on error.
|
||||||
*/
|
*/
|
||||||
|
static inline
|
||||||
struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len,
|
struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len,
|
||||||
const struct ieee80211_ops *ops);
|
const struct ieee80211_ops *ops)
|
||||||
|
{
|
||||||
|
return ieee80211_alloc_hw_nm(priv_data_len, ops, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ieee80211_register_hw - Register hardware device
|
* ieee80211_register_hw - Register hardware device
|
||||||
|
|
|
@ -478,8 +478,9 @@ static const struct ieee80211_vht_cap mac80211_vht_capa_mod_mask = {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len,
|
struct ieee80211_hw *ieee80211_alloc_hw_nm(size_t priv_data_len,
|
||||||
const struct ieee80211_ops *ops)
|
const struct ieee80211_ops *ops,
|
||||||
|
const char *requested_name)
|
||||||
{
|
{
|
||||||
struct ieee80211_local *local;
|
struct ieee80211_local *local;
|
||||||
int priv_size, i;
|
int priv_size, i;
|
||||||
|
@ -519,7 +520,7 @@ struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len,
|
||||||
*/
|
*/
|
||||||
priv_size = ALIGN(sizeof(*local), NETDEV_ALIGN) + priv_data_len;
|
priv_size = ALIGN(sizeof(*local), NETDEV_ALIGN) + priv_data_len;
|
||||||
|
|
||||||
wiphy = wiphy_new(&mac80211_config_ops, priv_size);
|
wiphy = wiphy_new_nm(&mac80211_config_ops, priv_size, requested_name);
|
||||||
|
|
||||||
if (!wiphy)
|
if (!wiphy)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -649,7 +650,7 @@ struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len,
|
||||||
|
|
||||||
return &local->hw;
|
return &local->hw;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(ieee80211_alloc_hw);
|
EXPORT_SYMBOL(ieee80211_alloc_hw_nm);
|
||||||
|
|
||||||
static int ieee80211_init_cipher_suites(struct ieee80211_local *local)
|
static int ieee80211_init_cipher_suites(struct ieee80211_local *local)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue