Commit b63967ca authored by Igor Mitsyanko's avatar Igor Mitsyanko Committed by Kalle Valo

qtnfmac: use scan duration param for different scan types

Use scan duration param for both active and passive scan dwell times.
Document what different types of dwell times are used for. Explicitly
specify that if unset, automatic selection by device firmware
will be used.
Signed-off-by: default avatarIgor Mitsyanko <igor.mitsyanko.os@quantenna.com>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent bc70732f
......@@ -11,6 +11,13 @@
#include "bus.h"
#include "commands.h"
#define QTNF_SCAN_TIME_AUTO 0
/* Let device itself to select best values for current conditions */
#define QTNF_SCAN_DWELL_ACTIVE_DEFAULT QTNF_SCAN_TIME_AUTO
#define QTNF_SCAN_DWELL_PASSIVE_DEFAULT QTNF_SCAN_TIME_AUTO
#define QTNF_SCAN_SAMPLE_DURATION_DEFAULT QTNF_SCAN_TIME_AUTO
static int qtnf_cmd_check_reply_header(const struct qlink_resp *resp,
u16 cmd_id, u8 mac_id, u8 vif_id,
size_t resp_size)
......@@ -938,7 +945,7 @@ qtnf_cmd_resp_proc_hw_info(struct qtnf_bus *bus,
"\nHardware ID: %s" \
"\nCalibration version: %s" \
"\nU-Boot version: %s" \
"\nHardware version: 0x%08x",
"\nHardware version: 0x%08x\n",
bld_name, bld_rev, bld_type, bld_label,
(unsigned long)bld_tmstamp,
(unsigned long)plat_id,
......@@ -2082,6 +2089,35 @@ static void qtnf_cmd_randmac_tlv_add(struct sk_buff *cmd_skb,
memcpy(randmac->mac_addr_mask, mac_addr_mask, ETH_ALEN);
}
static void qtnf_cmd_scan_set_dwell(struct qtnf_wmac *mac,
struct sk_buff *cmd_skb)
{
struct cfg80211_scan_request *scan_req = mac->scan_req;
u16 dwell_active = QTNF_SCAN_DWELL_ACTIVE_DEFAULT;
u16 dwell_passive = QTNF_SCAN_DWELL_PASSIVE_DEFAULT;
u16 duration = QTNF_SCAN_SAMPLE_DURATION_DEFAULT;
if (scan_req->duration) {
dwell_active = scan_req->duration;
dwell_passive = scan_req->duration;
}
pr_debug("MAC%u: %s scan dwell active=%u, passive=%u, duration=%u\n",
mac->macid,
scan_req->duration_mandatory ? "mandatory" : "max",
dwell_active, dwell_passive, duration);
qtnf_cmd_skb_put_tlv_u16(cmd_skb,
QTN_TLV_ID_SCAN_DWELL_ACTIVE,
dwell_active);
qtnf_cmd_skb_put_tlv_u16(cmd_skb,
QTN_TLV_ID_SCAN_DWELL_PASSIVE,
dwell_passive);
qtnf_cmd_skb_put_tlv_u16(cmd_skb,
QTN_TLV_ID_SCAN_SAMPLE_DURATION,
duration);
}
int qtnf_cmd_send_scan(struct qtnf_wmac *mac)
{
struct sk_buff *cmd_skb;
......@@ -2133,6 +2169,8 @@ int qtnf_cmd_send_scan(struct qtnf_wmac *mac)
}
}
qtnf_cmd_scan_set_dwell(mac, cmd_skb);
if (scan_req->flags & NL80211_SCAN_FLAG_RANDOM_ADDR) {
pr_debug("MAC%u: scan with random addr=%pM, mask=%pM\n",
mac->macid,
......@@ -2148,15 +2186,6 @@ int qtnf_cmd_send_scan(struct qtnf_wmac *mac)
qtnf_cmd_skb_put_tlv_tag(cmd_skb, QTN_TLV_ID_SCAN_FLUSH);
}
if (scan_req->duration) {
pr_debug("MAC%u: %s scan duration %u\n", mac->macid,
scan_req->duration_mandatory ? "mandatory" : "max",
scan_req->duration);
qtnf_cmd_skb_put_tlv_u16(cmd_skb, QTN_TLV_ID_SCAN_DWELL,
scan_req->duration);
}
ret = qtnf_cmd_send(mac->bus, cmd_skb);
if (ret)
goto out;
......
......@@ -1162,6 +1162,13 @@ struct qlink_event_external_auth {
* carried by QTN_TLV_ID_STA_STATS_MAP.
* @QTN_TLV_ID_MAX_SCAN_SSIDS: maximum number of SSIDs the device can scan
* for in any given scan.
* @QTN_TLV_ID_SCAN_DWELL_ACTIVE: time spent on a single channel for an active
* scan.
* @QTN_TLV_ID_SCAN_DWELL_PASSIVE: time spent on a single channel for a passive
* scan.
* @QTN_TLV_ID_SCAN_SAMPLE_DURATION: total duration of sampling a single channel
* during a scan including off-channel dwell time and operating channel
* time.
*/
enum qlink_tlv_id {
QTN_TLV_ID_FRAG_THRESH = 0x0201,
......@@ -1194,7 +1201,9 @@ enum qlink_tlv_id {
QTN_TLV_ID_WOWLAN_CAPAB = 0x0410,
QTN_TLV_ID_WOWLAN_PATTERN = 0x0411,
QTN_TLV_ID_SCAN_FLUSH = 0x0412,
QTN_TLV_ID_SCAN_DWELL = 0x0413,
QTN_TLV_ID_SCAN_DWELL_ACTIVE = 0x0413,
QTN_TLV_ID_SCAN_DWELL_PASSIVE = 0x0416,
QTN_TLV_ID_SCAN_SAMPLE_DURATION = 0x0417,
};
struct qlink_tlv_hdr {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment