mac80211: add ieee80211_get_he_iftype_cap() helper

This function is similar to ieee80211_get_he_sta_cap() but allows passing
the iftype. Also make ieee80211_get_he_sta_cap() use the new helper
rather than duplicating the code.

Signed-off-by: Shashidhar Lakkavalli <slakkavalli@datto.com>
Signed-off-by: John Crispin <john@phrozen.org>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
John Crispin 2019-05-21 17:02:58 +02:00 committed by Johannes Berg
parent 26f7044e95
commit d7edf40c15
1 changed files with 21 additions and 7 deletions

View File

@ -381,6 +381,26 @@ ieee80211_get_sband_iftype_data(const struct ieee80211_supported_band *sband,
return NULL;
}
/**
* ieee80211_get_he_iftype_cap - return HE capabilities for an sband's iftype
* @sband: the sband to search for the iftype on
* @iftype: enum nl80211_iftype
*
* Return: pointer to the struct ieee80211_sta_he_cap, or NULL is none found
*/
static inline const struct ieee80211_sta_he_cap *
ieee80211_get_he_iftype_cap(const struct ieee80211_supported_band *sband,
u8 iftype)
{
const struct ieee80211_sband_iftype_data *data =
ieee80211_get_sband_iftype_data(sband, iftype);
if (data && data->he_cap.has_he)
return &data->he_cap;
return NULL;
}
/**
* ieee80211_get_he_sta_cap - return HE capabilities for an sband's STA
* @sband: the sband to search for the STA on
@ -390,13 +410,7 @@ ieee80211_get_sband_iftype_data(const struct ieee80211_supported_band *sband,
static inline const struct ieee80211_sta_he_cap *
ieee80211_get_he_sta_cap(const struct ieee80211_supported_band *sband)
{
const struct ieee80211_sband_iftype_data *data =
ieee80211_get_sband_iftype_data(sband, NL80211_IFTYPE_STATION);
if (data && data->he_cap.has_he)
return &data->he_cap;
return NULL;
return ieee80211_get_he_iftype_cap(sband, NL80211_IFTYPE_STATION);
}
/**