Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3a0284c2 authored by Ben Greear's avatar Ben Greear Committed by Alistair Strachan
Browse files

BACKPORT: 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: default avatarBen Greear <greearb@candelatech.com>
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
(cherry picked from commit ad28757eef268e609677d0e3d8c0bdadde52a711)
[astrachan: Minor rediff required for context changes only]
Bug: 70214720
Change-Id: Ib6c67070e873e2f911ae8c6eb6c924f9585483f9
Signed-off-by: default avatarAlistair Strachan <astrachan@google.com>
parent 00025285
Loading
Loading
Loading
Loading
+26 −2
Original line number Diff line number Diff line
@@ -3038,6 +3038,26 @@ struct ieee80211_ops {
	u32 (*get_expected_throughput)(struct ieee80211_sta *sta);
};

/**
 * 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
 *
@@ -3052,8 +3072,12 @@ struct ieee80211_ops {
 *
 * 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,
					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
+5 −4
Original line number Diff line number Diff line
@@ -486,8 +486,9 @@ static const u8 extended_capabilities[] = {
	WLAN_EXT_CAPA8_OPMODE_NOTIF,
};

struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len,
					const struct ieee80211_ops *ops)
struct ieee80211_hw *ieee80211_alloc_hw_nm(size_t priv_data_len,
					   const struct ieee80211_ops *ops,
					   const char *requested_name)
{
	struct ieee80211_local *local;
	int priv_size, i;
@@ -527,7 +528,7 @@ struct ieee80211_hw *ieee80211_alloc_hw(size_t 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)
		return NULL;
@@ -654,7 +655,7 @@ struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len,

	return &local->hw;
}
EXPORT_SYMBOL(ieee80211_alloc_hw);
EXPORT_SYMBOL(ieee80211_alloc_hw_nm);

static int ieee80211_init_cipher_suites(struct ieee80211_local *local)
{