2020-04-30 01:10:03

by Thomas Pedersen

[permalink] [raw]
Subject: [PATCH v3 0/5] initial S1G defines

This patchset finishes the work to make channels work on a KHz offset,
and includes the initial definitions for S1G (802.11ah).

These patches on top of wt-2020-04-29 with hostap c54a5e96b505 gives the
following hwsim test results:

Failed even on retry:
proxyarp_open_ebtables wpas_config_file fst_dynamic_iface_attach
TOTAL=3531 PASS=3265 FAIL=12 SKIP=251

Which is what we currently expect of HEAD.

Changes from v3 are rebasing on latest wireless-testing and making the
SCAN_FREQ_KHZ more robust so userspace can omit the MHZ-only scan
frequencies in the request, and kernel can do the same in the results.

Also some breakage introduced by patch #1 has been addressed by leaving
the existing cfg80211 API intact.

Thomas Pedersen (5):
cfg80211: add KHz variants of frame RX API
nl80211: add KHz frequency offset for most wifi commands
nl80211: support scan frequencies in KHz
ieee80211: S1G defines
nl80211: S1G band and channel definitions

include/linux/ieee80211.h | 222 +++++++++++++++++++++++++++++++++++
include/net/cfg80211.h | 71 ++++++++++-
include/uapi/linux/nl80211.h | 77 +++++++++---
net/mac80211/chan.c | 7 +-
net/mac80211/main.c | 2 +
net/mac80211/rx.c | 8 +-
net/mac80211/scan.c | 1 +
net/mac80211/tx.c | 5 +
net/mac80211/util.c | 5 +
net/wireless/chan.c | 29 +++++
net/wireless/core.c | 5 +-
net/wireless/mlme.c | 8 +-
net/wireless/nl80211.c | 135 +++++++++++++++------
net/wireless/trace.h | 12 +-
net/wireless/util.c | 8 ++
15 files changed, 521 insertions(+), 74 deletions(-)

--
2.20.1


2020-04-30 01:10:03

by Thomas Pedersen

[permalink] [raw]
Subject: [PATCH v3 1/5] cfg80211: add KHz variants of frame RX API

Drivers may wish to report the RX frequency in units of
KHz. Provide cfg80211_rx_mgmt_khz() and wrap it with
cfg80211_rx_mgmt() so exisiting drivers which can't report
KHz anyway don't need to change. Add a similar wrapper for
cfg80211_report_obss_beacon() so the frequency units stay
somewhat consistent.

This doesn't actually change the nl80211 API yet.

Signed-off-by: Thomas Pedersen <[email protected]>

---
v3:
wrap functions with _khz() (Johannes)
update trace entries with PR_KHZ()
---
include/linux/ieee80211.h | 1 +
include/net/cfg80211.h | 54 +++++++++++++++++++++++++++++++++++----
net/mac80211/rx.c | 8 +++---
net/wireless/mlme.c | 8 +++---
net/wireless/nl80211.c | 14 +++++-----
net/wireless/trace.h | 12 ++++-----
6 files changed, 72 insertions(+), 25 deletions(-)

diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index a561db435a4b..a152f7cfc8de 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -3333,6 +3333,7 @@ static inline int ieee80211_get_tdls_action(struct sk_buff *skb, u32 hdr_size)
/* convert frequencies */
#define MHZ_TO_KHZ(freq) ((freq) * 1000)
#define KHZ_TO_MHZ(freq) ((freq) / 1000)
+#define PR_KHZ(f) KHZ_TO_MHZ((float) f)

/* convert powers */
#define DBI_TO_MBI(gain) ((gain) * 100)
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index a82fc59a1d82..3746b52c954e 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -6986,6 +6986,26 @@ void cfg80211_conn_failed(struct net_device *dev, const u8 *mac_addr,
enum nl80211_connect_failed_reason reason,
gfp_t gfp);

+/**
+ * cfg80211_rx_mgmt_khz - notification of received, unprocessed management frame
+ * @wdev: wireless device receiving the frame
+ * @freq: Frequency on which the frame was received in KHz
+ * @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
+ *
+ * This function is called whenever an Action frame is received for a station
+ * mode interface, but is not processed in kernel.
+ *
+ * Return: %true if a user space application has registered for this frame.
+ * For action frames, that makes it responsible for rejecting unrecognized
+ * action frames; %false otherwise, in which case for action frames the
+ * driver is responsible for rejecting the frame.
+ */
+bool cfg80211_rx_mgmt_khz(struct wireless_dev *wdev, int freq, int sig_dbm,
+ const u8 *buf, size_t len, u32 flags);
+
/**
* cfg80211_rx_mgmt - notification of received, unprocessed management frame
* @wdev: wireless device receiving the frame
@@ -7003,8 +7023,13 @@ void cfg80211_conn_failed(struct net_device *dev, const u8 *mac_addr,
* action frames; %false otherwise, in which case for action frames the
* driver is responsible for rejecting the frame.
*/
-bool cfg80211_rx_mgmt(struct wireless_dev *wdev, int freq, int sig_dbm,
- const u8 *buf, size_t len, u32 flags);
+static inline bool cfg80211_rx_mgmt(struct wireless_dev *wdev, int freq,
+ int sig_dbm, const u8 *buf, size_t len,
+ u32 flags)
+{
+ return cfg80211_rx_mgmt_khz(wdev, MHZ_TO_KHZ(freq), sig_dbm, buf, len,
+ flags);
+}

/**
* cfg80211_mgmt_tx_status - notification of TX status for management frame
@@ -7202,6 +7227,21 @@ void cfg80211_probe_status(struct net_device *dev, const u8 *addr,
u64 cookie, bool acked, s32 ack_signal,
bool is_valid_ack_signal, gfp_t gfp);

+/**
+ * cfg80211_report_obss_beacon_khz - report beacon from other APs
+ * @wiphy: The wiphy that received the beacon
+ * @frame: the frame
+ * @len: length of the frame
+ * @freq: frequency the frame was received on in KHz
+ * @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
+ * netdev that is in AP/GO mode.
+ */
+void cfg80211_report_obss_beacon_khz(struct wiphy *wiphy, const u8 *frame,
+ size_t len, int freq, int sig_dbm);
+
/**
* cfg80211_report_obss_beacon - report beacon from other APs
* @wiphy: The wiphy that received the beacon
@@ -7214,9 +7254,13 @@ void cfg80211_probe_status(struct net_device *dev, const u8 *addr,
* received. It is not useful to call this when there is no
* netdev that is in AP/GO mode.
*/
-void cfg80211_report_obss_beacon(struct wiphy *wiphy,
- const u8 *frame, size_t len,
- int freq, int sig_dbm);
+static inline void cfg80211_report_obss_beacon(struct wiphy *wiphy,
+ const u8 *frame, size_t len,
+ int freq, int sig_dbm)
+{
+ cfg80211_report_obss_beacon_khz(wiphy, frame, len, MHZ_TO_KHZ(freq),
+ sig_dbm);
+}

/**
* cfg80211_reg_can_beacon - check if beaconing is allowed
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index eaf8931e4627..007eca52afe6 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -3097,7 +3097,8 @@ ieee80211_rx_h_mgmt_check(struct ieee80211_rx_data *rx)

cfg80211_report_obss_beacon(rx->local->hw.wiphy,
rx->skb->data, rx->skb->len,
- status->freq, sig);
+ ieee80211_rx_status_to_khz(status),
+ sig);
rx->flags |= IEEE80211_RX_BEACON_REPORTED;
}

@@ -3443,8 +3444,9 @@ ieee80211_rx_h_userspace_mgmt(struct ieee80211_rx_data *rx)
!(status->flag & RX_FLAG_NO_SIGNAL_VAL))
sig = status->signal;

- if (cfg80211_rx_mgmt(&rx->sdata->wdev, status->freq, sig,
- rx->skb->data, rx->skb->len, 0)) {
+ if (cfg80211_rx_mgmt_khz(&rx->sdata->wdev,
+ ieee80211_rx_status_to_khz(status), sig,
+ rx->skb->data, rx->skb->len, 0)) {
if (rx->sta)
rx->sta->rx_stats.packets++;
dev_kfree_skb(rx->skb);
diff --git a/net/wireless/mlme.c b/net/wireless/mlme.c
index 409497a3527d..ca51fbf89b80 100644
--- a/net/wireless/mlme.c
+++ b/net/wireless/mlme.c
@@ -729,8 +729,8 @@ 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_dbm,
- const u8 *buf, size_t len, u32 flags)
+bool cfg80211_rx_mgmt_khz(struct wireless_dev *wdev, int freq, int sig_dbm,
+ const u8 *buf, size_t len, u32 flags)
{
struct wiphy *wiphy = wdev->wiphy;
struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy);
@@ -745,7 +745,7 @@ bool cfg80211_rx_mgmt(struct wireless_dev *wdev, int freq, int sig_dbm,
cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE);
u16 stype;

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

if (!(stypes->rx & BIT(stype))) {
@@ -785,7 +785,7 @@ bool cfg80211_rx_mgmt(struct wireless_dev *wdev, int freq, int sig_dbm,
trace_cfg80211_return_bool(result);
return result;
}
-EXPORT_SYMBOL(cfg80211_rx_mgmt);
+EXPORT_SYMBOL(cfg80211_rx_mgmt_khz);

void cfg80211_sched_dfs_chan_update(struct cfg80211_registered_device *rdev)
{
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 3d27b24c68b2..755701132d71 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -16256,7 +16256,7 @@ int nl80211_send_mgmt(struct cfg80211_registered_device *rdev,
netdev->ifindex)) ||
nla_put_u64_64bit(msg, NL80211_ATTR_WDEV, wdev_id(wdev),
NL80211_ATTR_PAD) ||
- nla_put_u32(msg, NL80211_ATTR_WIPHY_FREQ, freq) ||
+ nla_put_u32(msg, NL80211_ATTR_WIPHY_FREQ, KHZ_TO_MHZ(freq)) ||
(sig_dbm &&
nla_put_u32(msg, NL80211_ATTR_RX_SIGNAL_DBM, sig_dbm)) ||
nla_put(msg, NL80211_ATTR_FRAME, len, buf) ||
@@ -16882,16 +16882,15 @@ void cfg80211_probe_status(struct net_device *dev, const u8 *addr,
}
EXPORT_SYMBOL(cfg80211_probe_status);

-void cfg80211_report_obss_beacon(struct wiphy *wiphy,
- const u8 *frame, size_t len,
- int freq, int sig_dbm)
+void cfg80211_report_obss_beacon_khz(struct wiphy *wiphy, const u8 *frame,
+ size_t len, int freq, int sig_dbm)
{
struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy);
struct sk_buff *msg;
void *hdr;
struct cfg80211_beacon_registration *reg;

- trace_cfg80211_report_obss_beacon(wiphy, frame, len, freq, sig_dbm);
+ trace_cfg80211_report_obss_beacon_khz(wiphy, frame, len, freq, sig_dbm);

spin_lock_bh(&rdev->beacon_registrations_lock);
list_for_each_entry(reg, &rdev->beacon_registrations, list) {
@@ -16907,7 +16906,8 @@ void cfg80211_report_obss_beacon(struct wiphy *wiphy,

if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx) ||
(freq &&
- nla_put_u32(msg, NL80211_ATTR_WIPHY_FREQ, freq)) ||
+ nla_put_u32(msg, NL80211_ATTR_WIPHY_FREQ,
+ KHZ_TO_MHZ(freq))) ||
(sig_dbm &&
nla_put_u32(msg, NL80211_ATTR_RX_SIGNAL_DBM, sig_dbm)) ||
nla_put(msg, NL80211_ATTR_FRAME, len, frame))
@@ -16924,7 +16924,7 @@ void cfg80211_report_obss_beacon(struct wiphy *wiphy,
spin_unlock_bh(&rdev->beacon_registrations_lock);
nlmsg_free(msg);
}
-EXPORT_SYMBOL(cfg80211_report_obss_beacon);
+EXPORT_SYMBOL(cfg80211_report_obss_beacon_khz);

#ifdef CONFIG_PM
static int cfg80211_net_detect_results(struct sk_buff *msg,
diff --git a/net/wireless/trace.h b/net/wireless/trace.h
index 53c887ea67c7..889c1784fd86 100644
--- a/net/wireless/trace.h
+++ b/net/wireless/trace.h
@@ -2827,7 +2827,7 @@ DEFINE_EVENT(cfg80211_netdev_mac_evt, cfg80211_del_sta,
TP_ARGS(netdev, macaddr)
);

-TRACE_EVENT(cfg80211_rx_mgmt,
+TRACE_EVENT(cfg80211_rx_mgmt_khz,
TP_PROTO(struct wireless_dev *wdev, int freq, int sig_dbm),
TP_ARGS(wdev, freq, sig_dbm),
TP_STRUCT__entry(
@@ -2840,8 +2840,8 @@ TRACE_EVENT(cfg80211_rx_mgmt,
__entry->freq = freq;
__entry->sig_dbm = sig_dbm;
),
- TP_printk(WDEV_PR_FMT ", freq: %d, sig dbm: %d",
- WDEV_PR_ARG, __entry->freq, __entry->sig_dbm)
+ TP_printk(WDEV_PR_FMT ", freq: %g, sig dbm: %d",
+ WDEV_PR_ARG, PR_KHZ(__entry->freq), __entry->sig_dbm)
);

TRACE_EVENT(cfg80211_mgmt_tx_status,
@@ -3107,7 +3107,7 @@ TRACE_EVENT(cfg80211_pmksa_candidate_notify,
BOOL_TO_STR(__entry->preauth))
);

-TRACE_EVENT(cfg80211_report_obss_beacon,
+TRACE_EVENT(cfg80211_report_obss_beacon_khz,
TP_PROTO(struct wiphy *wiphy, const u8 *frame, size_t len,
int freq, int sig_dbm),
TP_ARGS(wiphy, frame, len, freq, sig_dbm),
@@ -3121,8 +3121,8 @@ TRACE_EVENT(cfg80211_report_obss_beacon,
__entry->freq = freq;
__entry->sig_dbm = sig_dbm;
),
- TP_printk(WIPHY_PR_FMT ", freq: %d, sig_dbm: %d",
- WIPHY_PR_ARG, __entry->freq, __entry->sig_dbm)
+ TP_printk(WIPHY_PR_FMT ", freq: %g, sig_dbm: %d",
+ WIPHY_PR_ARG, PR_KHZ(__entry->freq), __entry->sig_dbm)
);

TRACE_EVENT(cfg80211_tdls_oper_request,
--
2.20.1

2020-04-30 01:10:03

by Thomas Pedersen

[permalink] [raw]
Subject: [PATCH v3 3/5] nl80211: support scan frequencies in KHz

If the driver advertises NL80211_EXT_FEATURE_SCAN_FREQ_KHZ
userspace can omit NL80211_ATTR_SCAN_FREQUENCIES in favor
of an NL80211_ATTR_SCAN_FREQ_KHZ. To get scan results in
KHz userspace must also set the
NL80211_SCAN_FLAG_FREQ_KHZ.

This lets nl80211 remain compatible with older userspaces
while not requring and sending redundant (and potentially
incorrect) scan frequency sets.

Signed-off-by: Thomas Pedersen <[email protected]>

---
v3:
- report SCAN_FREQ_KHZ in scan results
- advertise SCAN_FREQ_KHZ support in feature flag
- add SCAN_FLAG_FREQ_KHZ so user can select scan result
frequency units
---
include/uapi/linux/nl80211.h | 13 ++++++++-
net/mac80211/main.c | 2 ++
net/wireless/nl80211.c | 52 +++++++++++++++++++++++++++---------
3 files changed, 54 insertions(+), 13 deletions(-)

diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index 0ceb4de52d9a..b6012aa5103b 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -2492,7 +2492,7 @@ enum nl80211_commands {
* an %NL80211_ATTR_WIPHY_FREQ_OFFSET.
* @NL80211_ATTR_CENTER_FREQ1_OFFSET: Center frequency offset in KHz for the
* first channel segment specified in %NL80211_ATTR_CENTER_FREQ1.
- *
+ * @NL80211_ATTR_SCAN_FREQ_KHZ: nested attribute with KHz frequencies
*
* @NUM_NL80211_ATTR: total number of nl80211_attrs available
* @NL80211_ATTR_MAX: highest attribute number currently defined
@@ -2972,6 +2972,7 @@ enum nl80211_attrs {
NL80211_ATTR_RECEIVE_MULTICAST,
NL80211_ATTR_WIPHY_FREQ_OFFSET,
NL80211_ATTR_CENTER_FREQ1_OFFSET,
+ NL80211_ATTR_SCAN_FREQ_KHZ,

/* add attributes here, update the policy in nl80211.c */

@@ -5721,6 +5722,11 @@ enum nl80211_feature_flags {
* @NL80211_EXT_FEATURE_MULTICAST_REGISTRATIONS: management frame registrations
* are possible for multicast frames and those will be reported properly.
*
+ * @NL80211_EXT_FEATURE_SCAN_FREQ_KHZ: This driver supports receiving and
+ * reporting scan request with %NL80211_ATTR_SCAN_FREQ_KHZ. In order to
+ * report %NL80211_ATTR_SCAN_FREQ_KHZ, %NL80211_SCAN_FLAG_FREQ_KHZ must be
+ * included in the scan request.
+ *
* @NUM_NL80211_EXT_FEATURES: number of extended features.
* @MAX_NL80211_EXT_FEATURES: highest extended feature index.
*/
@@ -5774,6 +5780,7 @@ enum nl80211_ext_feature_index {
NL80211_EXT_FEATURE_DEL_IBSS_STA,
NL80211_EXT_FEATURE_MULTICAST_REGISTRATIONS,
NL80211_EXT_FEATURE_BEACON_PROTECTION_CLIENT,
+ NL80211_EXT_FEATURE_SCAN_FREQ_KHZ,

/* add new features before the definition below */
NUM_NL80211_EXT_FEATURES,
@@ -5885,6 +5892,9 @@ enum nl80211_timeout_reason {
* @NL80211_SCAN_FLAG_MIN_PREQ_CONTENT: minimize probe request content to
* only have supported rates and no additional capabilities (unless
* added by userspace explicitly.)
+ * @NL80211_SCAN_FLAG_FREQ_KHZ: report scan results with
+ * %NL80211_ATTR_SCAN_FREQ_KHZ. This also means
+ * %NL80211_ATTR_SCAN_FREQUENCIES will not be included.
*/
enum nl80211_scan_flags {
NL80211_SCAN_FLAG_LOW_PRIORITY = 1<<0,
@@ -5900,6 +5910,7 @@ enum nl80211_scan_flags {
NL80211_SCAN_FLAG_HIGH_ACCURACY = 1<<10,
NL80211_SCAN_FLAG_RANDOM_SN = 1<<11,
NL80211_SCAN_FLAG_MIN_PREQ_CONTENT = 1<<12,
+ NL80211_SCAN_FLAG_FREQ_KHZ = 1<<13,
};

/**
diff --git a/net/mac80211/main.c b/net/mac80211/main.c
index 06c90d360633..ac74bd780b42 100644
--- a/net/mac80211/main.c
+++ b/net/mac80211/main.c
@@ -596,6 +596,8 @@ struct ieee80211_hw *ieee80211_alloc_hw_nm(size_t priv_data_len,
NL80211_EXT_FEATURE_CONTROL_PORT_OVER_NL80211);
wiphy_ext_feature_set(wiphy,
NL80211_EXT_FEATURE_CONTROL_PORT_NO_PREAUTH);
+ wiphy_ext_feature_set(wiphy,
+ NL80211_EXT_FEATURE_SCAN_FREQ_KHZ);

if (!ops->hw_scan) {
wiphy->features |= NL80211_FEATURE_LOW_PRIORITY_SCAN |
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index fb056613a23f..decd37fd470e 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -664,6 +664,7 @@ const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = {
[NL80211_ATTR_PMK_REAUTH_THRESHOLD] = NLA_POLICY_RANGE(NLA_U8, 1, 100),
[NL80211_ATTR_RECEIVE_MULTICAST] = { .type = NLA_FLAG },
[NL80211_ATTR_WIPHY_FREQ_OFFSET] = NLA_POLICY_RANGE(NLA_U32, 0, 999),
+ [NL80211_ATTR_SCAN_FREQ_KHZ] = { .type = NLA_NESTED },
};

/* policy for the key attributes */
@@ -7761,6 +7762,8 @@ static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info)
struct cfg80211_registered_device *rdev = info->user_ptr[0];
struct wireless_dev *wdev = info->user_ptr[1];
struct cfg80211_scan_request *request;
+ struct nlattr *scan_freqs = NULL;
+ bool scan_freqs_khz = false;
struct nlattr *attr;
struct wiphy *wiphy;
int err, tmp, n_ssids = 0, n_channels, i;
@@ -7779,9 +7782,17 @@ static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info)
goto unlock;
}

- if (info->attrs[NL80211_ATTR_SCAN_FREQUENCIES]) {
- n_channels = validate_scan_freqs(
- info->attrs[NL80211_ATTR_SCAN_FREQUENCIES]);
+ if (info->attrs[NL80211_ATTR_SCAN_FREQ_KHZ]) {
+ if (!wiphy_ext_feature_isset(wiphy,
+ NL80211_EXT_FEATURE_SCAN_FREQ_KHZ))
+ return -EOPNOTSUPP;
+ scan_freqs = info->attrs[NL80211_ATTR_SCAN_FREQ_KHZ];
+ scan_freqs_khz = true;
+ } else if (info->attrs[NL80211_ATTR_SCAN_FREQUENCIES])
+ scan_freqs = info->attrs[NL80211_ATTR_SCAN_FREQUENCIES];
+
+ if (scan_freqs) {
+ n_channels = validate_scan_freqs(scan_freqs);
if (!n_channels) {
err = -EINVAL;
goto unlock;
@@ -7829,13 +7840,16 @@ static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info)
}

i = 0;
- if (info->attrs[NL80211_ATTR_SCAN_FREQUENCIES]) {
+ if (scan_freqs) {
/* user specified, bail out if channel not found */
- nla_for_each_nested(attr, info->attrs[NL80211_ATTR_SCAN_FREQUENCIES], tmp) {
+ nla_for_each_nested(attr, scan_freqs, tmp) {
struct ieee80211_channel *chan;
+ int freq = nla_get_u32(attr);

- chan = ieee80211_get_channel(wiphy, nla_get_u32(attr));
+ if (!scan_freqs_khz)
+ freq = MHZ_TO_KHZ(freq);

+ chan = ieee80211_get_channel_khz(wiphy, freq);
if (!chan) {
err = -EINVAL;
goto out_free;
@@ -15270,14 +15284,28 @@ static int nl80211_add_scan_req(struct sk_buff *msg,
}
nla_nest_end(msg, nest);

- nest = nla_nest_start_noflag(msg, NL80211_ATTR_SCAN_FREQUENCIES);
- if (!nest)
- goto nla_put_failure;
- for (i = 0; i < req->n_channels; i++) {
- if (nla_put_u32(msg, i, req->channels[i]->center_freq))
+ if (req->flags & NL80211_SCAN_FLAG_FREQ_KHZ) {
+ nest = nla_nest_start_noflag(msg,
+ NL80211_ATTR_SCAN_FREQ_KHZ);
+ if (!nest)
+ goto nla_put_failure;
+ for (i = 0; i < req->n_channels; i++) {
+ if (nla_put_u32(msg, i,
+ ieee80211_channel_to_khz(req->channels[i])))
+ goto nla_put_failure;
+ }
+ nla_nest_end(msg, nest);
+ } else {
+ nest = nla_nest_start_noflag(msg,
+ NL80211_ATTR_SCAN_FREQUENCIES);
+ if (!nest)
goto nla_put_failure;
+ for (i = 0; i < req->n_channels; i++) {
+ if (nla_put_u32(msg, i, req->channels[i]->center_freq))
+ goto nla_put_failure;
+ }
+ nla_nest_end(msg, nest);
}
- nla_nest_end(msg, nest);

if (req->ie &&
nla_put(msg, NL80211_ATTR_IE, req->ie_len, req->ie))
--
2.20.1

2020-04-30 08:11:57

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH v3 1/5] cfg80211: add KHz variants of frame RX API

Hi Thomas,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on mac80211-next/master]
[cannot apply to mac80211/master v5.7-rc3 next-20200429]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url: https://github.com/0day-ci/linux/commits/Thomas-Pedersen/initial-S1G-defines/20200430-091307
base: https://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next.git master
config: parisc-allyesconfig (attached as .config)
compiler: hppa-linux-gcc (GCC) 9.3.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day GCC_VERSION=9.3.0 make.cross ARCH=parisc

If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <[email protected]>

All errors (new ones prefixed by >>):

In file included from include/trace/define_trace.h:102,
from net/wireless/trace.h:3537,
from net/wireless/trace.c:5:
net/wireless/./trace.h: In function 'trace_raw_output_cfg80211_rx_mgmt_khz':
>> include/trace/trace_events.h:359:9: error: unable to generate reloads for:
359 | struct trace_event_raw_##call *field; \
| ^~~~~~~~~~~~~~~~
include/trace/trace_events.h:75:2: note: in expansion of macro 'DECLARE_EVENT_CLASS'
75 | DECLARE_EVENT_CLASS(name, \
| ^~~~~~~~~~~~~~~~~~~
net/wireless/./trace.h:2830:1: note: in expansion of macro 'TRACE_EVENT'
2830 | TRACE_EVENT(cfg80211_rx_mgmt_khz,
| ^~~~~~~~~~~
(insn 27 26 22 4 (set (reg:SF 28 %r28 [113])
(float:SF (reg:SI 28 %r28 [orig:114 field_12->freq ] [114]))) "net/wireless/./trace.h":2830:1 96 {floatsisf2}
(expr_list:REG_DEAD (reg:SI 28 %r28 [orig:114 field_12->freq ] [114])
(nil)))
during RTL pass: reload
include/trace/trace_events.h:359:9: internal compiler error: in find_reloads, at reload.c:3814
359 | struct trace_event_raw_##call *field; \
| ^~~~~~~~~~~~~~~~
include/trace/trace_events.h:75:2: note: in expansion of macro 'DECLARE_EVENT_CLASS'
75 | DECLARE_EVENT_CLASS(name, \
| ^~~~~~~~~~~~~~~~~~~
net/wireless/./trace.h:2830:1: note: in expansion of macro 'TRACE_EVENT'
2830 | TRACE_EVENT(cfg80211_rx_mgmt_khz,
| ^~~~~~~~~~~
0x513fa0 _fatal_insn(char const*, rtx_def const*, char const*, int, char const*)
/tmp/build-crosstools-xh-9.3.0-2.34/gcc/gcc-9.3.0/gcc/rtl-error.c:108
0x513967 find_reloads(rtx_insn*, int, int, int, short*)
/tmp/build-crosstools-xh-9.3.0-2.34/gcc/gcc-9.3.0/gcc/reload.c:3814
0x984bb6 calculate_needs_all_insns
/tmp/build-crosstools-xh-9.3.0-2.34/gcc/gcc-9.3.0/gcc/reload1.c:1474
0x984bb6 reload(rtx_insn*, int)
/tmp/build-crosstools-xh-9.3.0-2.34/gcc/gcc-9.3.0/gcc/reload1.c:986
0x847ef0 do_reload
/tmp/build-crosstools-xh-9.3.0-2.34/gcc/gcc-9.3.0/gcc/ira.c:5535
0x847ef0 execute
/tmp/build-crosstools-xh-9.3.0-2.34/gcc/gcc-9.3.0/gcc/ira.c:5707
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

vim +359 include/trace/trace_events.h

2fc1b6f0d0a719 include/trace/ftrace.h liubo 2011-04-19 328
5a2e3995951176 include/trace/ftrace.h Kei Tokunaga 2010-04-01 329 #undef __print_hex
2acae0d5b0f73a include/trace/trace_events.h Daniel Borkmann 2017-01-25 330 #define __print_hex(buf, buf_len) \
3898fac1f488c7 include/trace/trace_events.h Daniel Borkmann 2017-02-02 331 trace_print_hex_seq(p, buf, buf_len, false)
2acae0d5b0f73a include/trace/trace_events.h Daniel Borkmann 2017-01-25 332
2acae0d5b0f73a include/trace/trace_events.h Daniel Borkmann 2017-01-25 333 #undef __print_hex_str
2acae0d5b0f73a include/trace/trace_events.h Daniel Borkmann 2017-01-25 334 #define __print_hex_str(buf, buf_len) \
3898fac1f488c7 include/trace/trace_events.h Daniel Borkmann 2017-02-02 335 trace_print_hex_seq(p, buf, buf_len, true)
5a2e3995951176 include/trace/ftrace.h Kei Tokunaga 2010-04-01 336
6ea22486ba46bc include/trace/ftrace.h Dave Martin 2015-01-28 337 #undef __print_array
6ea22486ba46bc include/trace/ftrace.h Dave Martin 2015-01-28 338 #define __print_array(array, count, el_size) \
6ea22486ba46bc include/trace/ftrace.h Dave Martin 2015-01-28 339 ({ \
6ea22486ba46bc include/trace/ftrace.h Dave Martin 2015-01-28 340 BUILD_BUG_ON(el_size != 1 && el_size != 2 && \
6ea22486ba46bc include/trace/ftrace.h Dave Martin 2015-01-28 341 el_size != 4 && el_size != 8); \
645df987f7c174 include/trace/trace_events.h Steven Rostedt (Red Hat 2015-05-04 342) trace_print_array_seq(p, array, count, el_size); \
6ea22486ba46bc include/trace/ftrace.h Dave Martin 2015-01-28 343 })
6ea22486ba46bc include/trace/ftrace.h Dave Martin 2015-01-28 344
ef56e047b2bd4d include/trace/trace_events.h Piotr Maziarz 2019-11-07 345 #undef __print_hex_dump
ef56e047b2bd4d include/trace/trace_events.h Piotr Maziarz 2019-11-07 346 #define __print_hex_dump(prefix_str, prefix_type, \
ef56e047b2bd4d include/trace/trace_events.h Piotr Maziarz 2019-11-07 347 rowsize, groupsize, buf, len, ascii) \
ef56e047b2bd4d include/trace/trace_events.h Piotr Maziarz 2019-11-07 348 trace_print_hex_dump_seq(p, prefix_str, prefix_type, \
ef56e047b2bd4d include/trace/trace_events.h Piotr Maziarz 2019-11-07 349 rowsize, groupsize, buf, len, ascii)
ef56e047b2bd4d include/trace/trace_events.h Piotr Maziarz 2019-11-07 350
091ad3658e3c76 include/trace/ftrace.h Ingo Molnar 2009-11-26 351 #undef DECLARE_EVENT_CLASS
091ad3658e3c76 include/trace/ftrace.h Ingo Molnar 2009-11-26 352 #define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \
83f0d53993b296 include/trace/ftrace.h Steven Rostedt 2010-02-16 353 static notrace enum print_line_t \
892c505aac2bdd include/trace/trace_events.h Steven Rostedt (Red Hat 2015-05-05 354) trace_raw_output_##call(struct trace_iterator *iter, int flags, \
80decc70afc57c include/trace/ftrace.h Steven Rostedt 2010-04-23 355 struct trace_event *trace_event) \
f42c85e74faa42 include/trace/ftrace.h Steven Rostedt 2009-04-13 356 { \
f42c85e74faa42 include/trace/ftrace.h Steven Rostedt 2009-04-13 357 struct trace_seq *s = &iter->seq; \
f71130de5c7fba include/trace/ftrace.h Li Zefan 2013-02-21 358 struct trace_seq __maybe_unused *p = &iter->tmp_seq; \
a7237765730a10 include/trace/trace_events.h Steven Rostedt (Red Hat 2015-05-13 @359) struct trace_event_raw_##call *field; \
f42c85e74faa42 include/trace/ftrace.h Steven Rostedt 2009-04-13 360 int ret; \
f42c85e74faa42 include/trace/ftrace.h Steven Rostedt 2009-04-13 361 \
f71130de5c7fba include/trace/ftrace.h Li Zefan 2013-02-21 362 field = (typeof(field))iter->ent; \
80decc70afc57c include/trace/ftrace.h Steven Rostedt 2010-04-23 363 \
892c505aac2bdd include/trace/trace_events.h Steven Rostedt (Red Hat 2015-05-05 364) ret = trace_raw_output_prep(iter, trace_event); \
8e2e095cbecad2 include/trace/ftrace.h Steven Rostedt (Red Hat 2014-11-14 365) if (ret != TRACE_TYPE_HANDLED) \
f71130de5c7fba include/trace/ftrace.h Li Zefan 2013-02-21 366 return ret; \
f71130de5c7fba include/trace/ftrace.h Li Zefan 2013-02-21 367 \
19a7fe206232cc include/trace/ftrace.h Steven Rostedt (Red Hat 2014-11-12 368) trace_seq_printf(s, print); \
f42c85e74faa42 include/trace/ftrace.h Steven Rostedt 2009-04-13 369 \
19a7fe206232cc include/trace/ftrace.h Steven Rostedt (Red Hat 2014-11-12 370) return trace_handle_return(s); \
80decc70afc57c include/trace/ftrace.h Steven Rostedt 2010-04-23 371 } \
3ad017bac94ac8 include/trace/trace_events.h Steven Rostedt (Red Hat 2015-05-13 372) static struct trace_event_functions trace_event_type_funcs_##call = { \
892c505aac2bdd include/trace/trace_events.h Steven Rostedt (Red Hat 2015-05-05 373) .trace = trace_raw_output_##call, \
80decc70afc57c include/trace/ftrace.h Steven Rostedt 2010-04-23 374 };
ff038f5c37c207 include/trace/ftrace.h Steven Rostedt 2009-11-18 375

:::::: The code at line 359 was first introduced by commit
:::::: a7237765730a10d429736f47ac4b89779ec6c534 tracing: Rename ftrace_raw_##call event structures to trace_event_raw_##call

:::::: TO: Steven Rostedt (Red Hat) <[email protected]>
:::::: CC: Steven Rostedt <[email protected]>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]


Attachments:
(No filename) (9.48 kB)
.config.gz (60.17 kB)
Download all attachments

2020-04-30 09:06:40

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH v3 1/5] cfg80211: add KHz variants of frame RX API

Hi Thomas,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on mac80211-next/master]
[cannot apply to mac80211/master v5.7-rc3 next-20200429]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url: https://github.com/0day-ci/linux/commits/Thomas-Pedersen/initial-S1G-defines/20200430-091307
base: https://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211-next.git master
config: arm-exynos_defconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (GCC) 9.3.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day GCC_VERSION=9.3.0 make.cross ARCH=arm

If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <[email protected]>

All errors (new ones prefixed by >>):

arm-linux-gnueabi-ld: net/wireless/trace.o: in function `trace_raw_output_cfg80211_rx_mgmt_khz':
>> trace.c:(.text+0x4ef4): undefined reference to `__aeabi_i2f'
>> arm-linux-gnueabi-ld: trace.c:(.text+0x4f00): undefined reference to `__aeabi_fdiv'
>> arm-linux-gnueabi-ld: trace.c:(.text+0x4f04): undefined reference to `__aeabi_f2d'
arm-linux-gnueabi-ld: net/wireless/trace.o: in function `trace_raw_output_cfg80211_report_obss_beacon_khz':
trace.c:(.text+0x56b0): undefined reference to `__aeabi_i2f'
arm-linux-gnueabi-ld: trace.c:(.text+0x56bc): undefined reference to `__aeabi_fdiv'
arm-linux-gnueabi-ld: trace.c:(.text+0x56c0): undefined reference to `__aeabi_f2d'

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]


Attachments:
(No filename) (1.92 kB)
.config.gz (32.41 kB)
Download all attachments

2020-04-30 11:38:28

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH v3 1/5] cfg80211: add KHz variants of frame RX API

On Wed, 2020-04-29 at 18:06 -0700, Thomas Pedersen wrote:
>
> +#define PR_KHZ(f) KHZ_TO_MHZ((float) f)

You can't use float, sorry.

johannes

2020-04-30 16:58:57

by Thomas Pedersen

[permalink] [raw]
Subject: Re: [PATCH v3 1/5] cfg80211: add KHz variants of frame RX API

On 4/30/20 4:37 AM, Johannes Berg wrote:
> On Wed, 2020-04-29 at 18:06 -0700, Thomas Pedersen wrote:
>>
>> +#define PR_KHZ(f) KHZ_TO_MHZ((float) f)
>
> You can't use float, sorry.

OK, I'll need to do something else, thanks.

--
thomas