Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 134878
b: refs/heads/master
c: 77965c9
h: refs/heads/master
v: v3
  • Loading branch information
Johannes Berg authored and John W. Linville committed Feb 27, 2009
1 parent 055dfe6 commit d8fcaf2
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 27 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: 630e64c487c0a9550f05b465216a1cd9125b52f2
refs/heads/master: 77965c970d7da9c9b6349ff2b1d9adecf54c403b
8 changes: 3 additions & 5 deletions trunk/include/net/cfg80211.h
Original file line number Diff line number Diff line change
Expand Up @@ -577,8 +577,7 @@ enum cfg80211_signal_type {
* @information_elements: the information elements (Note that there
* is no guarantee that these are well-formed!)
* @len_information_elements: total length of the information elements
* @signal: signal strength value
* @signal_type: signal type
* @signal: signal strength value (type depends on the wiphy's signal_type)
* @free_priv: function pointer to free private data
* @priv: private area for driver use, has at least wiphy->bss_priv_size bytes
*/
Expand All @@ -593,7 +592,6 @@ struct cfg80211_bss {
size_t len_information_elements;

s32 signal;
enum cfg80211_signal_type signal_type;

void (*free_priv)(struct cfg80211_bss *bss);
u8 priv[0] __attribute__((__aligned__(sizeof(void *))));
Expand Down Expand Up @@ -782,6 +780,7 @@ void cfg80211_scan_done(struct cfg80211_scan_request *request, bool aborted);
*
* @wiphy: the wiphy reporting the BSS
* @bss: the found BSS
* @signal: the signal strength, type depends on the wiphy's signal_type
* @gfp: context flags
*
* This informs cfg80211 that BSS information was found and
Expand All @@ -791,8 +790,7 @@ struct cfg80211_bss*
cfg80211_inform_bss_frame(struct wiphy *wiphy,
struct ieee80211_channel *channel,
struct ieee80211_mgmt *mgmt, size_t len,
s32 signal, enum cfg80211_signal_type sigtype,
gfp_t gfp);
s32 signal, gfp_t gfp);

struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy,
struct ieee80211_channel *channel,
Expand Down
3 changes: 3 additions & 0 deletions trunk/include/net/wireless.h
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ struct ieee80211_supported_band {
* the regulatory_hint() API. This can be used by the driver
* on the reg_notifier() if it chooses to ignore future
* regulatory domain changes caused by other drivers.
* @signal_type: signal type reported in &struct cfg80211_bss.
*/
struct wiphy {
/* assign these fields before you register the wiphy */
Expand All @@ -213,6 +214,8 @@ struct wiphy {
bool custom_regulatory;
bool strict_regulatory;

enum cfg80211_signal_type signal_type;

int bss_priv_size;
u8 max_scan_ssids;

Expand Down
5 changes: 5 additions & 0 deletions trunk/net/mac80211/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -861,6 +861,11 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
/* mac80211 always supports monitor */
local->hw.wiphy->interface_modes |= BIT(NL80211_IFTYPE_MONITOR);

if (local->hw.flags & IEEE80211_HW_SIGNAL_DBM)
local->hw.wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM;
else if (local->hw.flags & IEEE80211_HW_SIGNAL_UNSPEC)
local->hw.wiphy->signal_type = CFG80211_SIGNAL_TYPE_UNSPEC;

result = wiphy_register(local->hw.wiphy);
if (result < 0)
goto fail_wiphy_register;
Expand Down
11 changes: 3 additions & 8 deletions trunk/net/mac80211/scan.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,20 +63,15 @@ ieee80211_bss_info_update(struct ieee80211_local *local,
{
struct ieee80211_bss *bss;
int clen;
enum cfg80211_signal_type sigtype = CFG80211_SIGNAL_TYPE_NONE;
s32 signal = 0;

if (local->hw.flags & IEEE80211_HW_SIGNAL_DBM) {
sigtype = CFG80211_SIGNAL_TYPE_MBM;
if (local->hw.flags & IEEE80211_HW_SIGNAL_DBM)
signal = rx_status->signal * 100;
} else if (local->hw.flags & IEEE80211_HW_SIGNAL_UNSPEC) {
sigtype = CFG80211_SIGNAL_TYPE_UNSPEC;
else if (local->hw.flags & IEEE80211_HW_SIGNAL_UNSPEC)
signal = (rx_status->signal * 100) / local->hw.max_signal;
}

bss = (void *)cfg80211_inform_bss_frame(local->hw.wiphy, channel,
mgmt, len, signal, sigtype,
GFP_ATOMIC);
mgmt, len, signal, GFP_ATOMIC);

if (!bss)
return NULL;
Expand Down
2 changes: 1 addition & 1 deletion trunk/net/wireless/nl80211.c
Original file line number Diff line number Diff line change
Expand Up @@ -2457,7 +2457,7 @@ static int nl80211_send_bss(struct sk_buff *msg, u32 pid, u32 seq, int flags,
NLA_PUT_U16(msg, NL80211_BSS_CAPABILITY, res->capability);
NLA_PUT_U32(msg, NL80211_BSS_FREQUENCY, res->channel->center_freq);

switch (res->signal_type) {
switch (rdev->wiphy.signal_type) {
case CFG80211_SIGNAL_TYPE_MBM:
NLA_PUT_U32(msg, NL80211_BSS_SIGNAL_MBM, res->signal);
break;
Expand Down
21 changes: 9 additions & 12 deletions trunk/net/wireless/scan.c
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,6 @@ cfg80211_bss_update(struct cfg80211_registered_device *dev,
found->pub.beacon_interval = res->pub.beacon_interval;
found->pub.tsf = res->pub.tsf;
found->pub.signal = res->pub.signal;
found->pub.signal_type = res->pub.signal_type;
found->pub.capability = res->pub.capability;
found->ts = res->ts;
kref_put(&res->ref, bss_release);
Expand All @@ -392,16 +391,15 @@ struct cfg80211_bss *
cfg80211_inform_bss_frame(struct wiphy *wiphy,
struct ieee80211_channel *channel,
struct ieee80211_mgmt *mgmt, size_t len,
s32 signal, enum cfg80211_signal_type sigtype,
gfp_t gfp)
s32 signal, gfp_t gfp)
{
struct cfg80211_internal_bss *res;
size_t ielen = len - offsetof(struct ieee80211_mgmt,
u.probe_resp.variable);
bool overwrite;
size_t privsz = wiphy->bss_priv_size;

if (WARN_ON(sigtype == NL80211_BSS_SIGNAL_UNSPEC &&
if (WARN_ON(wiphy->signal_type == NL80211_BSS_SIGNAL_UNSPEC &&
(signal < 0 || signal > 100)))
return NULL;

Expand All @@ -415,7 +413,6 @@ cfg80211_inform_bss_frame(struct wiphy *wiphy,

memcpy(res->pub.bssid, mgmt->bssid, ETH_ALEN);
res->pub.channel = channel;
res->pub.signal_type = sigtype;
res->pub.signal = signal;
res->pub.tsf = le64_to_cpu(mgmt->u.probe_resp.timestamp);
res->pub.beacon_interval = le16_to_cpu(mgmt->u.probe_resp.beacon_int);
Expand Down Expand Up @@ -607,9 +604,9 @@ static inline unsigned int elapsed_jiffies_msecs(unsigned long start)
}

static char *
ieee80211_bss(struct iw_request_info *info,
struct cfg80211_internal_bss *bss,
char *current_ev, char *end_buf)
ieee80211_bss(struct wiphy *wiphy, struct iw_request_info *info,
struct cfg80211_internal_bss *bss, char *current_ev,
char *end_buf)
{
struct iw_event iwe;
u8 *buf, *cfg, *p;
Expand Down Expand Up @@ -638,13 +635,13 @@ ieee80211_bss(struct iw_request_info *info,
current_ev = iwe_stream_add_event(info, current_ev, end_buf, &iwe,
IW_EV_FREQ_LEN);

if (bss->pub.signal_type != CFG80211_SIGNAL_TYPE_NONE) {
if (wiphy->signal_type != CFG80211_SIGNAL_TYPE_NONE) {
memset(&iwe, 0, sizeof(iwe));
iwe.cmd = IWEVQUAL;
iwe.u.qual.updated = IW_QUAL_LEVEL_UPDATED |
IW_QUAL_NOISE_INVALID |
IW_QUAL_QUAL_UPDATED;
switch (bss->pub.signal_type) {
switch (wiphy->signal_type) {
case CFG80211_SIGNAL_TYPE_MBM:
sig = bss->pub.signal / 100;
iwe.u.qual.level = sig;
Expand Down Expand Up @@ -823,8 +820,8 @@ static int ieee80211_scan_results(struct cfg80211_registered_device *dev,
spin_unlock_bh(&dev->bss_lock);
return -E2BIG;
}
current_ev = ieee80211_bss(info, bss,
current_ev, end_buf);
current_ev = ieee80211_bss(&dev->wiphy, info, bss,
current_ev, end_buf);
}
spin_unlock_bh(&dev->bss_lock);
return current_ev - buf;
Expand Down

0 comments on commit d8fcaf2

Please sign in to comment.