Skip to content

Commit

Permalink
cfg80211: cleanup signal strength units notation
Browse files Browse the repository at this point in the history
Both cfg80211_rx_mgmt and cfg80211_report_obss_beacon functions send
reports to userspace using NL80211_ATTR_RX_SIGNAL_DBM attribute w/o
any processing of their input signal values. Which means that in
order to match userspace tools expectations, input signal values
for those functions are supposed to be in dBm units.

This patch cleans up comments, variable names, and trace reports
for those functions, replacing confusing 'mBm' by 'dBm'.

Signed-off-by: Sergey Matyukevich <sergey.matyukevich.os@quantenna.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  • Loading branch information
Sergey Matyukevich authored and Johannes Berg committed Dec 11, 2017
1 parent 9ae3b17 commit 6c2fb1e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions include/net/cfg80211.h
Original file line number Diff line number Diff line change
Expand Up @@ -5581,7 +5581,7 @@ void cfg80211_conn_failed(struct net_device *dev, const u8 *mac_addr,
* cfg80211_rx_mgmt - notification of received, unprocessed management frame
* @wdev: wireless device receiving the frame
* @freq: Frequency on which the frame was received in MHz
* @sig_dbm: signal strength in mBm, or 0 if unknown
* @sig_dbm: signal strength in dBm, or 0 if unknown
* @buf: Management frame (header + body)
* @len: length of the frame data
* @flags: flags, as defined in enum nl80211_rxmgmt_flags
Expand Down Expand Up @@ -5760,7 +5760,7 @@ void cfg80211_probe_status(struct net_device *dev, const u8 *addr,
* @frame: the frame
* @len: length of the frame
* @freq: frequency the frame was received on
* @sig_dbm: signal strength in mBm, or 0 if unknown
* @sig_dbm: signal strength in dBm, or 0 if unknown
*
* Use this function to report to userspace when a beacon was
* received. It is not useful to call this when there is no
Expand Down
6 changes: 3 additions & 3 deletions net/wireless/mlme.c
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,7 @@ int cfg80211_mlme_mgmt_tx(struct cfg80211_registered_device *rdev,
return rdev_mgmt_tx(rdev, wdev, params, cookie);
}

bool cfg80211_rx_mgmt(struct wireless_dev *wdev, int freq, int sig_mbm,
bool cfg80211_rx_mgmt(struct wireless_dev *wdev, int freq, int sig_dbm,
const u8 *buf, size_t len, u32 flags)
{
struct wiphy *wiphy = wdev->wiphy;
Expand All @@ -708,7 +708,7 @@ bool cfg80211_rx_mgmt(struct wireless_dev *wdev, int freq, int sig_mbm,
cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE);
u16 stype;

trace_cfg80211_rx_mgmt(wdev, freq, sig_mbm);
trace_cfg80211_rx_mgmt(wdev, freq, sig_dbm);
stype = (le16_to_cpu(mgmt->frame_control) & IEEE80211_FCTL_STYPE) >> 4;

if (!(stypes->rx & BIT(stype))) {
Expand All @@ -735,7 +735,7 @@ bool cfg80211_rx_mgmt(struct wireless_dev *wdev, int freq, int sig_mbm,

/* Indicate the received Action frame to user space */
if (nl80211_send_mgmt(rdev, wdev, reg->nlportid,
freq, sig_mbm,
freq, sig_dbm,
buf, len, flags, GFP_ATOMIC))
continue;

Expand Down
12 changes: 6 additions & 6 deletions net/wireless/trace.h
Original file line number Diff line number Diff line change
Expand Up @@ -2544,20 +2544,20 @@ DEFINE_EVENT(cfg80211_netdev_mac_evt, cfg80211_del_sta,
);

TRACE_EVENT(cfg80211_rx_mgmt,
TP_PROTO(struct wireless_dev *wdev, int freq, int sig_mbm),
TP_ARGS(wdev, freq, sig_mbm),
TP_PROTO(struct wireless_dev *wdev, int freq, int sig_dbm),
TP_ARGS(wdev, freq, sig_dbm),
TP_STRUCT__entry(
WDEV_ENTRY
__field(int, freq)
__field(int, sig_mbm)
__field(int, sig_dbm)
),
TP_fast_assign(
WDEV_ASSIGN;
__entry->freq = freq;
__entry->sig_mbm = sig_mbm;
__entry->sig_dbm = sig_dbm;
),
TP_printk(WDEV_PR_FMT ", freq: %d, sig mbm: %d",
WDEV_PR_ARG, __entry->freq, __entry->sig_mbm)
TP_printk(WDEV_PR_FMT ", freq: %d, sig dbm: %d",
WDEV_PR_ARG, __entry->freq, __entry->sig_dbm)
);

TRACE_EVENT(cfg80211_mgmt_tx_status,
Expand Down

0 comments on commit 6c2fb1e

Please sign in to comment.