BACKPORT: UPSTREAM: cfg80211: separate get channel number from ies
Get channel number from ies is a common logic, so separate it to a new function, which could also be used by lower driver. Signed-off-by: Wen Gong <wgong@codeaurora.org> Link: https://lore.kernel.org/r/20210930081533.4898-1-wgong@codeaurora.org Signed-off-by: Johannes Berg <johannes.berg@intel.com> (cherry picked from commit 97981d89a1d47942a2d7517631d2400b99fe3f93) Conflicts: include/net/cfg80211.h net/wireless/scan.c BUG=b:197916309 TEST=test case success: wifi.RRMBeaconReport Signed-off-by: Wen Gong <quic_wgong@quicinc.com> Change-Id: I520f77730fcaeb4ab4ddd268ba6376cedaac0365 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/3340327 Reviewed-by: Matthew Wang <matthewmwang@chromium.org> Tested-by: Matthew Wang <matthewmwang@chromium.org> Commit-Queue: Matthew Wang <matthewmwang@chromium.org> Signed-off-by: UtsavBalar1231 <utsavbalar1231@gmail.com>
This commit is contained in:
parent
10c1f38b2b
commit
dc85ba48f3
@ -5450,6 +5450,17 @@ static inline void cfg80211_gen_new_bssid(const u8 *bssid, u8 max_bssid,
|
|||||||
u64_to_ether_addr(new_bssid_u64, new_bssid);
|
u64_to_ether_addr(new_bssid_u64, new_bssid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* cfg80211_get_ies_channel_number - returns the channel number from ies
|
||||||
|
* @ie: IEs
|
||||||
|
* @ielen: length of IEs
|
||||||
|
* @band: enum nl80211_band of the channel
|
||||||
|
*
|
||||||
|
* Returns the channel number, or -1 if none could be determined.
|
||||||
|
*/
|
||||||
|
int cfg80211_get_ies_channel_number(const u8 *ie, size_t ielen,
|
||||||
|
enum nl80211_band band);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* enum cfg80211_bss_frame_type - frame type that the BSS data came from
|
* enum cfg80211_bss_frame_type - frame type that the BSS data came from
|
||||||
* @CFG80211_BSS_FTYPE_UNKNOWN: driver doesn't know whether the data is
|
* @CFG80211_BSS_FTYPE_UNKNOWN: driver doesn't know whether the data is
|
||||||
|
@ -1218,6 +1218,28 @@ cfg80211_bss_update(struct cfg80211_registered_device *rdev,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int cfg80211_get_ies_channel_number(const u8 *ie, size_t ielen,
|
||||||
|
enum nl80211_band band)
|
||||||
|
{
|
||||||
|
const u8 *tmp;
|
||||||
|
int channel_number = -1;
|
||||||
|
|
||||||
|
tmp = cfg80211_find_ie(WLAN_EID_DS_PARAMS, ie, ielen);
|
||||||
|
if (tmp && tmp[1] == 1) {
|
||||||
|
channel_number = tmp[2];
|
||||||
|
} else {
|
||||||
|
tmp = cfg80211_find_ie(WLAN_EID_HT_OPERATION, ie, ielen);
|
||||||
|
if (tmp && tmp[1] >= sizeof(struct ieee80211_ht_operation)) {
|
||||||
|
struct ieee80211_ht_operation *htop = (void *)(tmp + 2);
|
||||||
|
|
||||||
|
channel_number = htop->primary_chan;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return channel_number;
|
||||||
|
}
|
||||||
|
EXPORT_SYMBOL(cfg80211_get_ies_channel_number);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Update RX channel information based on the available frame payload
|
* Update RX channel information based on the available frame payload
|
||||||
* information. This is mainly for the 2.4 GHz band where frames can be received
|
* information. This is mainly for the 2.4 GHz band where frames can be received
|
||||||
@ -1231,22 +1253,11 @@ cfg80211_get_bss_channel(struct wiphy *wiphy, const u8 *ie, size_t ielen,
|
|||||||
struct ieee80211_channel *channel,
|
struct ieee80211_channel *channel,
|
||||||
enum nl80211_bss_scan_width scan_width)
|
enum nl80211_bss_scan_width scan_width)
|
||||||
{
|
{
|
||||||
const u8 *tmp;
|
|
||||||
u32 freq;
|
u32 freq;
|
||||||
int channel_number = -1;
|
int channel_number = -1;
|
||||||
struct ieee80211_channel *alt_channel;
|
struct ieee80211_channel *alt_channel;
|
||||||
|
|
||||||
tmp = cfg80211_find_ie(WLAN_EID_DS_PARAMS, ie, ielen);
|
channel_number = cfg80211_get_ies_channel_number(ie, ielen, channel->band);
|
||||||
if (tmp && tmp[1] == 1) {
|
|
||||||
channel_number = tmp[2];
|
|
||||||
} else {
|
|
||||||
tmp = cfg80211_find_ie(WLAN_EID_HT_OPERATION, ie, ielen);
|
|
||||||
if (tmp && tmp[1] >= sizeof(struct ieee80211_ht_operation)) {
|
|
||||||
struct ieee80211_ht_operation *htop = (void *)(tmp + 2);
|
|
||||||
|
|
||||||
channel_number = htop->primary_chan;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (channel_number < 0) {
|
if (channel_number < 0) {
|
||||||
/* No channel information in frame payload */
|
/* No channel information in frame payload */
|
||||||
|
Loading…
Reference in New Issue
Block a user