7 #include <linux/kernel.h>
8 #include <linux/string.h>
18 #define ZERO_DBM_OFFSET 0x95
19 #define MAX_SIGNAL_LEVEL 0x8A
20 #define MIN_SIGNAL_LEVEL 0x2F
22 #define SIGNAL_TO_DBM(x) \
23 (clamp_t(s32, (x), MIN_SIGNAL_LEVEL, MAX_SIGNAL_LEVEL) \
25 #define SIGNAL_TO_MBM(x) (SIGNAL_TO_DBM(x) * 100)
27 static int symbol_build_supp_rates(
u8 *
buf,
const __le16 *rates)
33 for (i = 0; i < 5; i++) {
45 static int prism_build_supp_rates(
u8 *
buf,
const u8 *rates)
50 for (i = 0; i < 8; i++) {
54 buf[i + 2] = rates[
i];
60 if (i == 8 && rates[i] > 0) {
66 buf[i + 2] = rates[
i];
71 return (i < 8) ? i + 2 : i + 4;
95 memcpy(&ie_buf[2], bss->
a.essid, len);
97 ie = ie_buf + len + 2;
98 ie_len = ie_buf[1] + 2;
101 ie_len += symbol_build_supp_rates(ie, bss->
s.rates);
105 ie_len += prism_build_supp_rates(ie, bss->
p.rates);
113 freq = ieee80211_dsss_chan_to_freq(
le16_to_cpu(bss->
a.channel));
114 channel = ieee80211_get_channel(wiphy, freq);
117 bss->
a.channel, freq);
126 capability, beacon_interval, ie_buf, ie_len,
135 struct wiphy *wiphy = priv_to_wiphy(priv);
146 ie_len = len -
sizeof(*bss);
148 chan = ie ? ie[2] : 0;
149 freq = ieee80211_dsss_chan_to_freq(chan);
150 channel = ieee80211_get_channel(wiphy, freq);
154 beacon_interval =
le16_to_cpu(bss->beacon_interval);
159 capability, beacon_interval, ie, ie_len,
189 else if (len >= 1292 && buf[68] == 0)
203 "data: %zu\n", priv->
ndev->name,
218 if ((len - offset) % atom_len) {
220 "atom_len %zu, offset %d\n", priv->
ndev->name, len,
227 for (; offset + atom_len <= len; offset += atom_len) {
232 orinoco_add_hostscan_result(priv, atom);