Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f695a5d7 authored by qctecmdr Service's avatar qctecmdr Service Committed by Gerrit - the friendly Code Review server
Browse files

Merge "wil6210: add sysfs for thermal throttling configuration"

parents aa9bff30 79be48af
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -6,6 +6,7 @@ wil6210-y += netdev.o
wil6210-y += cfg80211.o
wil6210-y += pcie_bus.o
wil6210-$(CONFIG_WIL6210_DEBUGFS) += debugfs.o
wil6210-y += sysfs.o
wil6210-y += wmi.o
wil6210-y += interrupt.o
wil6210-y += txrx.o
@@ -20,6 +21,7 @@ wil6210-y += wil_platform.o
wil6210-y += ethtool.o
wil6210-y += wil_crash_dump.o
wil6210-y += p2p.o
wil6210-y += ftm.o

# for tracing framework to find trace.h
CFLAGS_trace.o := -I$(src)
+73 −13
Original line number Diff line number Diff line
// SPDX-License-Identifier: ISC
/*
 * Copyright (c) 2012-2017 Qualcomm Atheros, Inc.
 * Copyright (c) 2018, The Linux Foundation. All rights reserved.
 *
 * Permission to use, copy, modify, and/or distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 * Copyright (c) 2018-2019, The Linux Foundation. All rights reserved.
 */

#include <linux/etherdevice.h>
@@ -21,6 +10,7 @@
#include <net/cfg80211.h>
#include "wil6210.h"
#include "wmi.h"
#include "ftm.h"
#include "fw.h"

#define WIL_MAX_ROC_DURATION_MS 5000
@@ -118,6 +108,15 @@ nla_policy wil_rf_sector_cfg_policy[QCA_ATTR_DMG_RF_SECTOR_CFG_MAX + 1] = {
};

enum qca_nl80211_vendor_subcmds {
	QCA_NL80211_VENDOR_SUBCMD_LOC_GET_CAPA = 128,
	QCA_NL80211_VENDOR_SUBCMD_FTM_START_SESSION = 129,
	QCA_NL80211_VENDOR_SUBCMD_FTM_ABORT_SESSION = 130,
	QCA_NL80211_VENDOR_SUBCMD_FTM_MEAS_RESULT = 131,
	QCA_NL80211_VENDOR_SUBCMD_FTM_SESSION_DONE = 132,
	QCA_NL80211_VENDOR_SUBCMD_FTM_CFG_RESPONDER = 133,
	QCA_NL80211_VENDOR_SUBCMD_AOA_MEAS = 134,
	QCA_NL80211_VENDOR_SUBCMD_AOA_ABORT_MEAS = 135,
	QCA_NL80211_VENDOR_SUBCMD_AOA_MEAS_RESULT = 136,
	QCA_NL80211_VENDOR_SUBCMD_DMG_RF_GET_SECTOR_CFG = 139,
	QCA_NL80211_VENDOR_SUBCMD_DMG_RF_SET_SECTOR_CFG = 140,
	QCA_NL80211_VENDOR_SUBCMD_DMG_RF_GET_SELECTED_SECTOR = 141,
@@ -139,6 +138,48 @@ static int wil_rf_sector_set_selected(struct wiphy *wiphy,

/* vendor specific commands */
static const struct wiphy_vendor_command wil_nl80211_vendor_commands[] = {
	{
		.info.vendor_id = QCA_NL80211_VENDOR_ID,
		.info.subcmd = QCA_NL80211_VENDOR_SUBCMD_LOC_GET_CAPA,
		.flags = WIPHY_VENDOR_CMD_NEED_WDEV |
			 WIPHY_VENDOR_CMD_NEED_RUNNING,
		.doit = wil_ftm_get_capabilities
	},
	{
		.info.vendor_id = QCA_NL80211_VENDOR_ID,
		.info.subcmd = QCA_NL80211_VENDOR_SUBCMD_FTM_START_SESSION,
		.flags = WIPHY_VENDOR_CMD_NEED_WDEV |
			 WIPHY_VENDOR_CMD_NEED_RUNNING,
		.doit = wil_ftm_start_session
	},
	{
		.info.vendor_id = QCA_NL80211_VENDOR_ID,
		.info.subcmd = QCA_NL80211_VENDOR_SUBCMD_FTM_ABORT_SESSION,
		.flags = WIPHY_VENDOR_CMD_NEED_WDEV |
			 WIPHY_VENDOR_CMD_NEED_RUNNING,
		.doit = wil_ftm_abort_session
	},
	{
		.info.vendor_id = QCA_NL80211_VENDOR_ID,
		.info.subcmd = QCA_NL80211_VENDOR_SUBCMD_FTM_CFG_RESPONDER,
		.flags = WIPHY_VENDOR_CMD_NEED_WDEV |
			 WIPHY_VENDOR_CMD_NEED_RUNNING,
		.doit = wil_ftm_configure_responder
	},
	{
		.info.vendor_id = QCA_NL80211_VENDOR_ID,
		.info.subcmd = QCA_NL80211_VENDOR_SUBCMD_AOA_MEAS,
		.flags = WIPHY_VENDOR_CMD_NEED_WDEV |
			 WIPHY_VENDOR_CMD_NEED_RUNNING,
		.doit = wil_aoa_start_measurement
	},
	{
		.info.vendor_id = QCA_NL80211_VENDOR_ID,
		.info.subcmd = QCA_NL80211_VENDOR_SUBCMD_AOA_ABORT_MEAS,
		.flags = WIPHY_VENDOR_CMD_NEED_WDEV |
			 WIPHY_VENDOR_CMD_NEED_RUNNING,
		.doit = wil_aoa_abort_measurement
	},
	{
		.info.vendor_id = QCA_NL80211_VENDOR_ID,
		.info.subcmd = QCA_NL80211_VENDOR_SUBCMD_DMG_RF_GET_SECTOR_CFG,
@@ -171,6 +212,22 @@ static const struct wiphy_vendor_command wil_nl80211_vendor_commands[] = {
	},
};

/* vendor specific events */
static const struct nl80211_vendor_cmd_info wil_nl80211_vendor_events[] = {
	[QCA_EVENT_FTM_MEAS_RESULT_INDEX] = {
			.vendor_id = QCA_NL80211_VENDOR_ID,
			.subcmd = QCA_NL80211_VENDOR_SUBCMD_FTM_MEAS_RESULT
	},
	[QCA_EVENT_FTM_SESSION_DONE_INDEX] = {
			.vendor_id = QCA_NL80211_VENDOR_ID,
			.subcmd = QCA_NL80211_VENDOR_SUBCMD_FTM_SESSION_DONE
	},
	[QCA_EVENT_AOA_MEAS_RESULT_INDEX] = {
			.vendor_id = QCA_NL80211_VENDOR_ID,
			.subcmd = QCA_NL80211_VENDOR_SUBCMD_AOA_MEAS_RESULT
	},
};

static struct ieee80211_supported_band wil_band_60ghz = {
	.channels = wil_60ghz_channels,
	.n_channels = ARRAY_SIZE(wil_60ghz_channels),
@@ -1950,6 +2007,7 @@ static int wil_cfg80211_suspend(struct wiphy *wiphy,

	mutex_lock(&wil->mutex);
	mutex_lock(&wil->vif_mutex);
	wil_ftm_stop_operations(wil);
	wil_p2p_stop_radio_operations(wil);
	wil_abort_scan_all_vifs(wil, true);
	mutex_unlock(&wil->vif_mutex);
@@ -2113,6 +2171,8 @@ static void wil_wiphy_init(struct wiphy *wiphy)

	wiphy->n_vendor_commands = ARRAY_SIZE(wil_nl80211_vendor_commands);
	wiphy->vendor_commands = wil_nl80211_vendor_commands;
	wiphy->vendor_events = wil_nl80211_vendor_events;
	wiphy->n_vendor_events = ARRAY_SIZE(wil_nl80211_vendor_events);

#ifdef CONFIG_PM
	wiphy->wowlan = &wil_wowlan_support;
+936 −0

File added.

Preview size limit exceeded, changes collapsed.

+504 −0
Original line number Diff line number Diff line
/* SPDX-License-Identifier: ISC */
/* Copyright (c) 2016-2019, The Linux Foundation. All rights reserved. */

#ifndef __WIL6210_FTM_H__
#define __WIL6210_FTM_H__

/**
 * NOTE: The authoritative place for definition of QCA_NL80211_VENDOR_ID,
 * vendor subcmd definitions prefixed with QCA_NL80211_VENDOR_SUBCMD, and
 * qca_attr is open source file src/common/qca-vendor.h in
 * git://w1.fi/srv/git/hostap.git; the values here are just a copy of that
 */

/**
 * enum qca_attr_loc - attributes for FTM and AOA commands
 *
 * @QCA_ATTR_FTM_SESSION_COOKIE: Session cookie, specified in
 *  %QCA_SUBCMD_FTM_START_SESSION. It will be provided by driver
 *  events and can be used to identify events targeted for this session.
 * @QCA_ATTR_LOC_CAPA: Nested attribute containing extra
 *  FTM/AOA capabilities, returned by %QCA_SUBCMD_LOC_GET_CAPA.
 *  see %enum qca_attr_loc_capa.
 * @QCA_ATTR_FTM_MEAS_PEERS: array of nested attributes
 *  containing information about each peer in measurement session
 *  request. See %enum qca_attr_peer_info for supported
 *  attributes for each peer
 * @QCA_ATTR_FTM_PEER_RESULTS: nested attribute containing
 *  measurement results for a peer. reported by the
 *  %QCA_SUBCMD_FTM_MEAS_RESULT event.
 *  See %enum qca_attr_peer_result for list of supported
 *  attributes.
 * @QCA_ATTR_FTM_RESPONDER_ENABLE: flag attribute for
 *  enabling or disabling responder functionality.
 * @QCA_ATTR_FTM_LCI: used in the
 *  %QCA_SUBCMD_FTM_CFG_RESPONDER command in order to
 *  specify the LCI report that will be sent by the responder during
 *  a measurement exchange. The format is defined in IEEE P802.11-REVmc/D5.0,
 *  9.4.2.22.10
 * @QCA_ATTR_FTM_LCR: provided with the
 *  %QCA_SUBCMD_FTM_CFG_RESPONDER command in order to
 *  specify the location civic report that will be sent by the responder during
 *  a measurement exchange. The format is defined in IEEE P802.11-REVmc/D5.0,
 *  9.4.2.22.13
 * @QCA_ATTR_LOC_SESSION_STATUS: session/measurement completion
 *  status code, reported in %QCA_SUBCMD_FTM_SESSION_DONE
 *  and %QCA_SUBCMD_AOA_MEAS_RESULT
 * @QCA_ATTR_FTM_INITIAL_TOKEN: initial dialog token used
 *  by responder (0 if not specified)
 * @QCA_ATTR_AOA_TYPE: AOA measurement type. Requested in
 *  %QCA_SUBCMD_AOA_MEAS and optionally in
 *  %QCA_SUBCMD_FTM_START_SESSION if AOA measurements
 *  are needed as part of an FTM session.
 *  Reported by QCA_SUBCMD_AOA_MEAS_RESULT.
 *  See enum qca_attr_aoa_type.
 * @QCA_ATTR_LOC_ANTENNA_ARRAY_MASK: bit mask indicating
 *  which antenna arrays were used in location measurement.
 *  Reported in %QCA_SUBCMD_FTM_MEAS_RESULT and
 *  %QCA_SUBCMD_AOA_MEAS_RESULT
 * @QCA_ATTR_AOA_MEAS_RESULT: AOA measurement data.
 *  Its contents depends on the AOA type and antenna array mask:
 *  %QCA_ATTR_AOA_TYPE_TOP_CIR_PHASE: array of U16 values,
 *  phase of the strongest CIR path for each antenna in the measured
 *  array(s).
 *  %QCA_ATTR_AOA_TYPE_TOP_CIR_PHASE_AMP: array of 2 U16
 *  values, phase and amplitude of the strongest CIR path for each
 *  antenna in the measured array(s)
 * @QCA_WLAN_VENDOR_ATTR_FREQ: Frequency where peer is listening, in MHz.
 *  Unsigned 32 bit value.
 */
enum qca_attr_loc {
	QCA_ATTR_FTM_SESSION_COOKIE = 14,
	QCA_ATTR_LOC_CAPA = 15,
	QCA_ATTR_FTM_MEAS_PEERS = 16,
	QCA_ATTR_FTM_MEAS_PEER_RESULTS = 17,
	QCA_ATTR_FTM_RESPONDER_ENABLE = 18,
	QCA_ATTR_FTM_LCI = 19,
	QCA_ATTR_FTM_LCR = 20,
	QCA_ATTR_LOC_SESSION_STATUS = 21,
	QCA_ATTR_FTM_INITIAL_TOKEN = 22,
	QCA_ATTR_AOA_TYPE = 23,
	QCA_ATTR_LOC_ANTENNA_ARRAY_MASK = 24,
	QCA_ATTR_AOA_MEAS_RESULT = 25,
	QCA_ATTR_FREQ = 28,
	/* keep last */
	QCA_ATTR_LOC_AFTER_LAST,
	QCA_ATTR_LOC_MAX = QCA_ATTR_LOC_AFTER_LAST - 1,
};

/**
 * enum qca_attr_loc_capa - indoor location capabilities
 *
 * @QCA_ATTR_LOC_CAPA_FLAGS: various flags. See
 *  %enum qca_attr_loc_capa_flags
 * @QCA_ATTR_FTM_CAPA_MAX_NUM_SESSIONS: Maximum number
 *  of measurement sessions that can run concurrently.
 *  Default is one session (no session concurrency)
 * @QCA_ATTR_FTM_CAPA_MAX_NUM_PEERS: The total number of unique
 *  peers that are supported in running sessions. For example,
 *  if the value is 8 and maximum number of sessions is 2, you can
 *  have one session with 8 unique peers, or 2 sessions with 4 unique
 *  peers each, and so on.
 * @QCA_ATTR_FTM_CAPA_MAX_NUM_BURSTS_EXP: Maximum number
 *  of bursts per peer, as an exponent (2^value). Default is 0,
 *  meaning no multi-burst support.
 * @QCA_ATTR_FTM_CAPA_MAX_MEAS_PER_BURST: Maximum number
 *  of measurement exchanges allowed in a single burst
 * @QCA_ATTR_AOA_CAPA_SUPPORTED_TYPES: Supported AOA measurement
 *  types. A bit mask (unsigned 32 bit value), each bit corresponds
 *  to an AOA type as defined by %enum qca_vendor_attr_aoa_type.
 */
enum qca_attr_loc_capa {
	QCA_ATTR_LOC_CAPA_INVALID,
	QCA_ATTR_LOC_CAPA_FLAGS,
	QCA_ATTR_FTM_CAPA_MAX_NUM_SESSIONS,
	QCA_ATTR_FTM_CAPA_MAX_NUM_PEERS,
	QCA_ATTR_FTM_CAPA_MAX_NUM_BURSTS_EXP,
	QCA_ATTR_FTM_CAPA_MAX_MEAS_PER_BURST,
	QCA_ATTR_AOA_CAPA_SUPPORTED_TYPES,
	/* keep last */
	QCA_ATTR_LOC_CAPA_AFTER_LAST,
	QCA_ATTR_LOC_CAPA_MAX =
		QCA_ATTR_LOC_CAPA_AFTER_LAST - 1,
};

/**
 * enum qca_attr_loc_capa_flags: Indoor location capability flags
 *
 * @QCA_ATTR_LOC_CAPA_FLAG_FTM_RESPONDER: Set if driver
 *  can be configured as an FTM responder (for example, an AP that
 *  services FTM requests). %QCA_SUBCMD_FTM_CFG_RESPONDER
 *  will be supported if set.
 * @QCA_ATTR_LOC_CAPA_FLAG_FTM_INITIATOR: Set if driver
 *  can run FTM sessions. %QCA_SUBCMD_FTM_START_SESSION
 *  will be supported if set.
 * @QCA_ATTR_LOC_CAPA_FLAG_ASAP: Set if FTM responder
 *  supports immediate (ASAP) response.
 * @QCA_ATTR_LOC_CAPA_FLAG_AOA: Set if driver supports standalone
 *  AOA measurement using %QCA_SUBCMD_AOA_MEAS
 * @QCA_ATTR_LOC_CAPA_FLAG_AOA_IN_FTM: Set if driver supports
 *  requesting AOA measurements as part of an FTM session.
 */
enum qca_attr_loc_capa_flags {
	QCA_ATTR_LOC_CAPA_FLAG_FTM_RESPONDER = 1 << 0,
	QCA_ATTR_LOC_CAPA_FLAG_FTM_INITIATOR = 1 << 1,
	QCA_ATTR_LOC_CAPA_FLAG_ASAP = 1 << 2,
	QCA_ATTR_LOC_CAPA_FLAG_AOA = 1 << 3,
	QCA_ATTR_LOC_CAPA_FLAG_AOA_IN_FTM = 1 << 4,
};

/**
 * enum qca_attr_peer_info: information about
 *  a single peer in a measurement session.
 *
 * @QCA_ATTR_FTM_PEER_MAC_ADDR: The MAC address of the peer.
 * @QCA_ATTR_FTM_PEER_MEAS_FLAGS: Various flags related
 *  to measurement. See %enum qca_attr_ftm_peer_meas_flags.
 * @QCA_ATTR_FTM_PEER_MEAS_PARAMS: Nested attribute of
 *  FTM measurement parameters, as specified by IEEE P802.11-REVmc/D7.0,
 *  9.4.2.167. See %enum qca_attr_ftm_meas_param for
 *  list of supported attributes.
 * @QCA_ATTR_FTM_PEER_SEC_TOK_ID: Initial token ID for
 *  secure measurement
 * @QCA_ATTR_FTM_PEER_AOA_BURST_PERIOD: Request AOA
 *  measurement every _value_ bursts. If 0 or not specified,
 *  AOA measurements will be disabled for this peer.
 * @QCA_WLAN_VENDOR_ATTR_FTM_PEER_FREQ: Frequency in MHz where
 *  peer is listening. Optional; if not specified, use the
 *  entry from the kernel scan results cache.
 */
enum qca_attr_ftm_peer_info {
	QCA_ATTR_FTM_PEER_INVALID,
	QCA_ATTR_FTM_PEER_MAC_ADDR,
	QCA_ATTR_FTM_PEER_MEAS_FLAGS,
	QCA_ATTR_FTM_PEER_MEAS_PARAMS,
	QCA_ATTR_FTM_PEER_SEC_TOK_ID,
	QCA_ATTR_FTM_PEER_AOA_BURST_PERIOD,
	QCA_ATTR_FTM_PEER_FREQ,
	/* keep last */
	QCA_ATTR_FTM_PEER_AFTER_LAST,
	QCA_ATTR_FTM_PEER_MAX =
		QCA_ATTR_FTM_PEER_AFTER_LAST - 1,
};

/**
 * enum qca_attr_ftm_peer_meas_flags: Measurement request flags,
 *  per-peer
 * @QCA_ATTR_FTM_PEER_MEAS_FLAG_ASAP: If set, request
 *  immediate (ASAP) response from peer
 * @QCA_ATTR_FTM_PEER_MEAS_FLAG_LCI: If set, request
 *  LCI report from peer. The LCI report includes the absolute
 *  location of the peer in "official" coordinates (similar to GPS).
 *  See IEEE P802.11-REVmc/D7.0, 11.24.6.7 for more information.
 * @QCA_ATTR_FTM_PEER_MEAS_FLAG_LCR: If set, request
 *  Location civic report from peer. The LCR includes the location
 *  of the peer in free-form format. See IEEE P802.11-REVmc/D7.0,
 *  11.24.6.7 for more information.
 * @QCA_ATTR_FTM_PEER_MEAS_FLAG_SECURE: If set,
 *  request a secure measurement.
 *  %QCA_ATTR_FTM_PEER_SEC_TOK_ID must also be provided.
 */
enum qca_attr_ftm_peer_meas_flags {
	QCA_ATTR_FTM_PEER_MEAS_FLAG_ASAP	= 1 << 0,
	QCA_ATTR_FTM_PEER_MEAS_FLAG_LCI	= 1 << 1,
	QCA_ATTR_FTM_PEER_MEAS_FLAG_LCR	= 1 << 2,
	QCA_ATTR_FTM_PEER_MEAS_FLAG_SECURE  = 1 << 3,
};

/**
 * enum qca_attr_ftm_meas_param: Measurement parameters
 *
 * @QCA_ATTR_FTM_PARAM_MEAS_PER_BURST: Number of measurements
 *  to perform in a single burst.
 * @QCA_ATTR_FTM_PARAM_NUM_BURSTS_EXP: Number of bursts to
 *  perform, specified as an exponent (2^value)
 * @QCA_ATTR_FTM_PARAM_BURST_DURATION: Duration of burst
 *  instance, as specified in IEEE P802.11-REVmc/D7.0, 9.4.2.167
 * @QCA_ATTR_FTM_PARAM_BURST_PERIOD: Time between bursts,
 *  as specified in IEEE P802.11-REVmc/D7.0, 9.4.2.167. Must
 *  be larger than %QCA_ATTR_FTM_PARAM_BURST_DURATION
 */
enum qca_attr_ftm_meas_param {
	QCA_ATTR_FTM_PARAM_INVALID,
	QCA_ATTR_FTM_PARAM_MEAS_PER_BURST,
	QCA_ATTR_FTM_PARAM_NUM_BURSTS_EXP,
	QCA_ATTR_FTM_PARAM_BURST_DURATION,
	QCA_ATTR_FTM_PARAM_BURST_PERIOD,
	/* keep last */
	QCA_ATTR_FTM_PARAM_AFTER_LAST,
	QCA_ATTR_FTM_PARAM_MAX =
		QCA_ATTR_FTM_PARAM_AFTER_LAST - 1,
};

/**
 * enum qca_attr_ftm_peer_result: Per-peer results
 *
 * @QCA_ATTR_FTM_PEER_RES_MAC_ADDR: MAC address of the reported
 *  peer
 * @QCA_ATTR_FTM_PEER_RES_STATUS: Status of measurement
 *  request for this peer.
 *  See %enum qca_attr_ftm_peer_result_status
 * @QCA_ATTR_FTM_PEER_RES_FLAGS: Various flags related
 *  to measurement results for this peer.
 *  See %enum qca_attr_ftm_peer_result_flags
 * @QCA_ATTR_FTM_PEER_RES_VALUE_SECONDS: Specified when
 *  request failed and peer requested not to send an additional request
 *  for this number of seconds.
 * @QCA_ATTR_FTM_PEER_RES_LCI: LCI report when received
 *  from peer. In the format specified by IEEE P802.11-REVmc/D7.0,
 *  9.4.2.22.10
 * @QCA_ATTR_FTM_PEER_RES_LCR: Location civic report when
 *  received from peer.In the format specified by IEEE P802.11-REVmc/D7.0,
 *  9.4.2.22.13
 * @QCA_ATTR_FTM_PEER_RES_MEAS_PARAMS: Reported when peer
 *  overridden some measurement request parameters. See
 *  enum qca_attr_ftm_meas_param.
 * @QCA_ATTR_FTM_PEER_RES_AOA_MEAS: AOA measurement
 *  for this peer. Same contents as %QCA_ATTR_AOA_MEAS_RESULT
 * @QCA_ATTR_FTM_PEER_RES_MEAS: Array of measurement
 *  results. Each entry is a nested attribute defined
 *  by enum qca_attr_ftm_meas.
 */
enum qca_attr_ftm_peer_result {
	QCA_ATTR_FTM_PEER_RES_INVALID,
	QCA_ATTR_FTM_PEER_RES_MAC_ADDR,
	QCA_ATTR_FTM_PEER_RES_STATUS,
	QCA_ATTR_FTM_PEER_RES_FLAGS,
	QCA_ATTR_FTM_PEER_RES_VALUE_SECONDS,
	QCA_ATTR_FTM_PEER_RES_LCI,
	QCA_ATTR_FTM_PEER_RES_LCR,
	QCA_ATTR_FTM_PEER_RES_MEAS_PARAMS,
	QCA_ATTR_FTM_PEER_RES_AOA_MEAS,
	QCA_ATTR_FTM_PEER_RES_MEAS,
	/* keep last */
	QCA_ATTR_FTM_PEER_RES_AFTER_LAST,
	QCA_ATTR_FTM_PEER_RES_MAX =
		QCA_ATTR_FTM_PEER_RES_AFTER_LAST - 1,
};

/**
 * enum qca_attr_ftm_peer_result_status
 *
 * @QCA_ATTR_FTM_PEER_RES_STATUS_OK: Request sent ok and results
 *  will be provided. Peer may have overridden some measurement parameters,
 *  in which case overridden parameters will be report by
 *  %QCA_ATTR_FTM_PEER_RES_MEAS_PARAMS attribute
 * @QCA_ATTR_FTM_PEER_RES_STATUS_INCAPABLE: Peer is incapable
 *  of performing the measurement request. No more results will be sent
 *  for this peer in this session.
 * @QCA_ATTR_FTM_PEER_RES_STATUS_FAILED: Peer reported request
 *  failed, and requested not to send an additional request for number
 *  of seconds specified by %QCA_ATTR_FTM_PEER_RES_VALUE_SECONDS
 *  attribute.
 * @QCA_ATTR_FTM_PEER_RES_STATUS_INVALID: Request validation
 *  failed. Request was not sent over the air.
 */
enum qca_attr_ftm_peer_result_status {
	QCA_ATTR_FTM_PEER_RES_STATUS_OK,
	QCA_ATTR_FTM_PEER_RES_STATUS_INCAPABLE,
	QCA_ATTR_FTM_PEER_RES_STATUS_FAILED,
	QCA_ATTR_FTM_PEER_RES_STATUS_INVALID,
};

/**
 * enum qca_attr_ftm_peer_result_flags : Various flags
 *  for measurement result, per-peer
 *
 * @QCA_ATTR_FTM_PEER_RES_FLAG_DONE: If set,
 *  measurement completed for this peer. No more results will be reported
 *  for this peer in this session.
 */
enum qca_attr_ftm_peer_result_flags {
	QCA_ATTR_FTM_PEER_RES_FLAG_DONE = 1 << 0,
};

/**
 * enum qca_vendor_attr_loc_session_status: Session completion status code
 *
 * @QCA_ATTR_LOC_SESSION_ST_OK: Session completed
 *  successfully.
 * @QCA_ATTR_LOC_SESSION_ST_ABORT: Session aborted
 *  by request
 * @QCA_ATTR_LOC_SESSION_ST_INVALID: Session request
 *  was invalid and was not started
 * @QCA_ATTR_LOC_SESSION_ST_FAIL: Session had an error
 *  and did not complete normally (for example out of resources)
 *
 */
enum qca_vendor_attr_loc_session_status {
	QCA_ATTR_LOC_SESSION_ST_OK,
	QCA_ATTR_LOC_SESSION_ST_ABORT,
	QCA_ATTR_LOC_SESSION_ST_INVALID,
	QCA_ATTR_LOC_SESSION_ST_FAIL,
};

/**
 * enum qca_attr_ftm_meas: Single measurement data
 *
 * @QCA_ATTR_FTM_MEAS_T1: Time of departure(TOD) of FTM packet as
 *  recorded by responder, in picoseconds.
 *  See IEEE P802.11-REVmc/D7.0, 11.24.6.4 for more information.
 * @QCA_ATTR_FTM_MEAS_T2: Time of arrival(TOA) of FTM packet at
 *  initiator, in picoseconds.
 *  See IEEE P802.11-REVmc/D7.0, 11.24.6.4 for more information.
 * @QCA_ATTR_FTM_MEAS_T3: TOD of ACK packet as recorded by
 *  initiator, in picoseconds.
 *  See IEEE P802.11-REVmc/D7.0, 11.24.6.4 for more information.
 * @QCA_ATTR_FTM_MEAS_T4: TOA of ACK packet at
 *  responder, in picoseconds.
 *  See IEEE P802.11-REVmc/D7.0, 11.24.6.4 for more information.
 * @QCA_ATTR_FTM_MEAS_RSSI: RSSI (signal level) as recorded
 *  during this measurement exchange. Optional and will be provided if
 *  the hardware can measure it.
 * @QCA_ATTR_FTM_MEAS_TOD_ERR: TOD error reported by
 *  responder. Not always provided.
 *  See IEEE P802.11-REVmc/D7.0, 9.6.8.33 for more information.
 * @QCA_ATTR_FTM_MEAS_TOA_ERR: TOA error reported by
 *  responder. Not always provided.
 *  See IEEE P802.11-REVmc/D7.0, 9.6.8.33 for more information.
 * @QCA_ATTR_FTM_MEAS_INITIATOR_TOD_ERR: TOD error measured by
 *  initiator. Not always provided.
 *  See IEEE P802.11-REVmc/D7.0, 9.6.8.33 for more information.
 * @QCA_ATTR_FTM_MEAS_INITIATOR_TOA_ERR: TOA error measured by
 *  initiator. Not always provided.
 *  See IEEE P802.11-REVmc/D7.0, 9.6.8.33 for more information.
 * @QCA_ATTR_FTM_MEAS_PAD: Dummy attribute for padding.
 */
enum qca_attr_ftm_meas {
	QCA_ATTR_FTM_MEAS_INVALID,
	QCA_ATTR_FTM_MEAS_T1,
	QCA_ATTR_FTM_MEAS_T2,
	QCA_ATTR_FTM_MEAS_T3,
	QCA_ATTR_FTM_MEAS_T4,
	QCA_ATTR_FTM_MEAS_RSSI,
	QCA_ATTR_FTM_MEAS_TOD_ERR,
	QCA_ATTR_FTM_MEAS_TOA_ERR,
	QCA_ATTR_FTM_MEAS_INITIATOR_TOD_ERR,
	QCA_ATTR_FTM_MEAS_INITIATOR_TOA_ERR,
	QCA_ATTR_FTM_MEAS_PAD,
	/* keep last */
	QCA_ATTR_FTM_MEAS_AFTER_LAST,
	QCA_ATTR_FTM_MEAS_MAX =
		QCA_ATTR_FTM_MEAS_AFTER_LAST - 1,
};

/**
 * enum qca_attr_aoa_type: AOA measurement type
 *
 * @QCA_ATTR_AOA_TYPE_TOP_CIR_PHASE: Phase of the strongest
 *  CIR (channel impulse response) path for each antenna.
 * @QCA_ATTR_AOA_TYPE_TOP_CIR_PHASE_AMP: Phase and amplitude
 *  of the strongest CIR path for each antenna.
 */
enum qca_attr_aoa_type {
	QCA_ATTR_AOA_TYPE_TOP_CIR_PHASE,
	QCA_ATTR_AOA_TYPE_TOP_CIR_PHASE_AMP,
	QCA_ATTR_AOA_TYPE_MAX,
};

/* vendor event indices, used from both cfg80211.c and ftm.c */
enum qca_events_index {
	QCA_EVENT_FTM_MEAS_RESULT_INDEX,
	QCA_EVENT_FTM_SESSION_DONE_INDEX,
	QCA_EVENT_AOA_MEAS_RESULT_INDEX,
};

/* measurement parameters. Specified for each peer as part
 * of measurement request, or provided with measurement
 * results for peer in case peer overridden parameters
 */
struct wil_ftm_meas_params {
	u8 meas_per_burst;
	u8 num_of_bursts_exp;
	u8 burst_duration;
	u16 burst_period;
};

/* measurement request for a single peer */
struct wil_ftm_meas_peer_info {
	u8 mac_addr[ETH_ALEN];
	u32 freq;
	u32 flags; /* enum qca_attr_ftm_peer_meas_flags */
	struct wil_ftm_meas_params params;
	u8 secure_token_id;
};

/* session request, passed to wil_ftm_cfg80211_start_session */
struct wil_ftm_session_request {
	u64 session_cookie;
	u32 n_peers;
	/* keep last, variable size according to n_peers */
	struct wil_ftm_meas_peer_info peers[0];
};

/* single measurement for a peer */
struct wil_ftm_peer_meas {
	u64 t1, t2, t3, t4;
};

/* measurement results for a single peer */
struct wil_ftm_peer_meas_res {
	u8 mac_addr[ETH_ALEN];
	u32 flags; /* enum qca_attr_ftm_peer_result_flags */
	u8 status; /* enum qca_attr_ftm_peer_result_status */
	u8 value_seconds;
	u8 has_params; /* true if params is valid */
	struct wil_ftm_meas_params params; /* peer overridden params */
	u8 *lci;
	u8 lci_length;
	u8 *lcr;
	u8 lcr_length;
	u32 n_meas;
	/* keep last, variable size according to n_meas */
	struct wil_ftm_peer_meas meas[0];
};

/* standalone AOA measurement request */
struct wil_aoa_meas_request {
	u8 mac_addr[ETH_ALEN];
	u32 freq;
	u32 type;
};

/* AOA measurement result */
struct wil_aoa_meas_result {
	u8 mac_addr[ETH_ALEN];
	u32 type;
	u32 antenna_array_mask;
	u32 status;
	u32 length;
	/* keep last, variable size according to length */
	u8 data[0];
};

/* private data related to FTM. Part of the wil6210_priv structure */
struct wil_ftm_priv {
	struct mutex lock; /* protects the FTM data */
	u8 session_started;
	u64 session_cookie;
	struct wil_ftm_peer_meas_res *ftm_res;
	u8 has_ftm_res;
	u32 max_ftm_meas;

	/* standalone AOA measurement */
	u8 aoa_started;
	u8 aoa_peer_mac_addr[ETH_ALEN];
	u32 aoa_type;
	struct timer_list aoa_timer;
	struct work_struct aoa_timeout_work;
};

int wil_ftm_get_capabilities(struct wiphy *wiphy, struct wireless_dev *wdev,
			     const void *data, int data_len);
int wil_ftm_start_session(struct wiphy *wiphy, struct wireless_dev *wdev,
			  const void *data, int data_len);
int wil_ftm_abort_session(struct wiphy *wiphy, struct wireless_dev *wdev,
			  const void *data, int data_len);
int wil_ftm_configure_responder(struct wiphy *wiphy, struct wireless_dev *wdev,
				const void *data, int data_len);
int wil_aoa_start_measurement(struct wiphy *wiphy, struct wireless_dev *wdev,
			      const void *data, int data_len);
int wil_aoa_abort_measurement(struct wiphy *wiphy, struct wireless_dev *wdev,
			      const void *data, int data_len);

#endif /* __WIL6210_FTM_H__ */
+6 −13
Original line number Diff line number Diff line
// SPDX-License-Identifier: ISC
/*
 * Copyright (c) 2012-2017 Qualcomm Atheros, Inc.
 * Copyright (c) 2018, The Linux Foundation. All rights reserved.
 *
 * Permission to use, copy, modify, and/or distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 * Copyright (c) 2018-2019, The Linux Foundation. All rights reserved.
 */

#include <linux/moduleparam.h>
@@ -1627,6 +1616,9 @@ int wil_reset(struct wil6210_priv *wil, bool load_fw)
			return rc;
		}

		if (wil->tt_data_set)
			wmi_set_tt_cfg(wil, &wil->tt_data);

		wil_collect_fw_info(wil);

		if (wil->ps_profile != WMI_PS_PROFILE_TYPE_DEFAULT)
@@ -1753,6 +1745,7 @@ int __wil_down(struct wil6210_priv *wil)
	wil_enable_irq(wil);

	mutex_lock(&wil->vif_mutex);
	wil_ftm_stop_operations(wil);
	wil_p2p_stop_radio_operations(wil);
	wil_abort_scan_all_vifs(wil, false);
	mutex_unlock(&wil->vif_mutex);
Loading