aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSurabhi Vishnoi <svishnoi@codeaurora.org>2019-07-12 17:47:31 +0530
committerJulan Hsu <julanhsu@google.com>2019-08-21 06:42:39 +0000
commitebf7a16795c6600eb6e0d9ca5966dade9ed3764d (patch)
tree16a7393874f060640093857ee793d64c02df788d
parentd6385714f1f217ba67bd62857b2ab811f23ceafe (diff)
CHROMIUM: ath10k: Handle wmi_tlv_pdev_bss_chan_info eventid
Currently pdev_bss_chan_info event is not handled for tlv targets. This event provides information of the current channel in which bss is created and is filled in survey dump in host. The firmware supports WMI_TLV_PDEV_BSS_CHAN_INFO_EVENTID only if WMI_SERVICE_BSS_CHANNEL_INFO_64 is set in wmi service ready event and host sets host capablity flag WMI_RSRC_CFG_FLAG_BSS_CHANNEL_INFO_64 in wmi init command to firmware. If WMI_SERVICE_BSS_CHANNEL_INFO_64 is set, then set the host_capab flag WMI_RSRC_CFG_FLAG_BSS_CHANNEL_INFO_64 in wmi init command and handle event WMI_TLV_PDEV_BSS_CHAN_INFO_EVENTID to get the information of current channel for tlv targets. BUG=b:137525452 TEST=None Change-Id: I4917dc7824dfd15b4fee9708146f3900ea50436c Signed-off-by: Surabhi Vishnoi <svishnoi@codeaurora.org> Signed-off-by: Vamsi Singamsetty <vamssi@codeaurora.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/1720380 Reviewed-by: Julan Hsu <julanhsu@google.com> Tested-by: Julan Hsu <julanhsu@google.com> Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org>
-rw-r--r--drivers/net/wireless/ath/ath10k/wmi-ops.h13
-rw-r--r--drivers/net/wireless/ath/ath10k/wmi-tlv.c42
-rw-r--r--drivers/net/wireless/ath/ath10k/wmi-tlv.h20
-rw-r--r--drivers/net/wireless/ath/ath10k/wmi.c57
-rw-r--r--drivers/net/wireless/ath/ath10k/wmi.h1
5 files changed, 119 insertions, 14 deletions
diff --git a/drivers/net/wireless/ath/ath10k/wmi-ops.h b/drivers/net/wireless/ath/ath10k/wmi-ops.h
index 7fe932bbb457..63581fa178b3 100644
--- a/drivers/net/wireless/ath/ath10k/wmi-ops.h
+++ b/drivers/net/wireless/ath/ath10k/wmi-ops.h
@@ -64,6 +64,9 @@ struct wmi_ops {
struct wmi_dfs_status_ev_arg *arg);
int (*pull_svc_avail)(struct ath10k *ar, struct sk_buff *skb,
struct wmi_svc_avail_ev_arg *arg);
+ int (*pull_pdev_bss_chan_info)(struct ath10k *ar, struct sk_buff *skb,
+ struct wmi_pdev_bss_chan_info_event
+ *arg);
enum wmi_txbf_conf (*get_txbf_conf_scheme)(struct ath10k *ar);
@@ -444,6 +447,16 @@ ath10k_wmi_pull_dfs_status(struct ath10k *ar, struct sk_buff *skb,
return ar->wmi.ops->pull_dfs_status_ev(ar, skb, arg);
}
+static inline int
+ath10k_wmi_pull_pdev_bss_chan_info(struct ath10k *ar, struct sk_buff *skb,
+ struct wmi_pdev_bss_chan_info_event *arg)
+{
+ if (!ar->wmi.ops->pull_pdev_bss_chan_info)
+ return -EOPNOTSUPP;
+
+ return ar->wmi.ops->pull_pdev_bss_chan_info(ar, skb, arg);
+}
+
static inline enum wmi_txbf_conf
ath10k_wmi_get_txbf_conf_scheme(struct ath10k *ar)
{
diff --git a/drivers/net/wireless/ath/ath10k/wmi-tlv.c b/drivers/net/wireless/ath/ath10k/wmi-tlv.c
index f78c9496c6b6..e5792c21d7a3 100644
--- a/drivers/net/wireless/ath/ath10k/wmi-tlv.c
+++ b/drivers/net/wireless/ath/ath10k/wmi-tlv.c
@@ -871,6 +871,9 @@ static void ath10k_wmi_tlv_op_rx(struct ath10k *ar, struct sk_buff *skb)
case WMI_TLV_PDEV_TEMPERATURE_EVENTID:
ath10k_wmi_tlv_event_temperature(ar, skb);
break;
+ case WMI_TLV_PDEV_BSS_CHAN_INFO_EVENTID:
+ ath10k_wmi_event_pdev_bss_chan_info(ar, skb);
+ break;
default:
ath10k_warn(ar, "Unknown eventid: %d\n", id);
break;
@@ -1774,6 +1777,41 @@ static int ath10k_wmi_tlv_op_pull_echo_ev(struct ath10k *ar,
return 0;
}
+static int
+ath10k_wmi_tlv_op_pull_pdev_bss_ch_info_ev(struct ath10k *ar,
+ struct sk_buff *skb,
+ struct wmi_pdev_bss_chan_info_event
+ *arg)
+{
+ const void **tb;
+ const struct wmi_pdev_bss_chan_info_event *ev;
+ int ret;
+
+ tb = ath10k_wmi_tlv_parse_alloc(ar, skb->data, skb->len, GFP_ATOMIC);
+ if (IS_ERR(tb)) {
+ ret = PTR_ERR(tb);
+ ath10k_warn(ar, "failed to parse tlv: %d\n", ret);
+ return ret;
+ }
+
+ ev = tb[WMI_TLV_TAG_STRUCT_PDEV_BSS_CHAN_INFO_EVENT];
+ if (!ev) {
+ kfree(tb);
+ return -EPROTO;
+ }
+
+ arg->freq = __le32_to_cpu(ev->freq);
+ arg->noise_floor = __le32_to_cpu(ev->noise_floor);
+ arg->cycle_busy = __le64_to_cpu(ev->cycle_busy);
+ arg->cycle_total = __le64_to_cpu(ev->cycle_total);
+ arg->cycle_tx = __le64_to_cpu(ev->cycle_tx);
+ arg->cycle_rx = __le64_to_cpu(ev->cycle_rx);
+ arg->cycle_rx_bss = __le64_to_cpu(ev->cycle_rx_bss);
+
+ kfree(tb);
+ return 0;
+}
+
static struct sk_buff *
ath10k_wmi_tlv_op_gen_pdev_suspend(struct ath10k *ar, u32 opt)
{
@@ -2029,6 +2067,9 @@ static struct sk_buff *ath10k_wmi_tlv_op_gen_init(struct ath10k *ar)
cfg->host_capab |=
WMI_RSRC_CFG_FLAG_THREE_WAY_COEX_CONFIG_OVERRIDE;
+ if (test_bit(WMI_SERVICE_BSS_CHANNEL_INFO_64, ar->wmi.svc_map))
+ cfg->host_capab |= WMI_RSRC_CFG_FLAG_BSS_CHANNEL_INFO_64;
+
ath10k_wmi_tlv_put_host_mem_chunks(ar, chunks);
ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi tlv init\n");
@@ -4628,6 +4669,7 @@ static const struct wmi_ops wmi_tlv_ops = {
.pull_roam_ev = ath10k_wmi_tlv_op_pull_roam_ev,
.pull_wow_event = ath10k_wmi_tlv_op_pull_wow_ev,
.pull_echo_ev = ath10k_wmi_tlv_op_pull_echo_ev,
+ .pull_pdev_bss_chan_info = ath10k_wmi_tlv_op_pull_pdev_bss_ch_info_ev,
.get_txbf_conf_scheme = ath10k_wmi_tlv_txbf_conf_scheme,
.gen_pdev_suspend = ath10k_wmi_tlv_op_gen_pdev_suspend,
diff --git a/drivers/net/wireless/ath/ath10k/wmi-tlv.h b/drivers/net/wireless/ath/ath10k/wmi-tlv.h
index 56776b5be74b..ba63a7952bde 100644
--- a/drivers/net/wireless/ath/ath10k/wmi-tlv.h
+++ b/drivers/net/wireless/ath/ath10k/wmi-tlv.h
@@ -28,6 +28,7 @@
#define WMI_RSRC_CFG_FLAG_TX_ACK_RSSI BIT(18)
#define WMI_RSRC_CFG_FLAG_PEER_TID_EXT BIT(22)
+#define WMI_RSRC_CFG_FLAG_BSS_CHANNEL_INFO_64 BIT(5)
#define WMI_RSRC_CFG_FLAG_THREE_WAY_COEX_CONFIG_OVERRIDE BIT(25)
@@ -357,6 +358,23 @@ enum wmi_tlv_event_id {
WMI_TLV_DFS_RADAR_EVENTID,
WMI_TLV_PDEV_L1SS_TRACK_EVENTID,
WMI_TLV_PDEV_TEMPERATURE_EVENTID,
+ WMI_TLV_SERVICE_READY_EXT_EVENTID,
+ WMI_TLV_PDEV_FIPS_EVENTID,
+ WMI_TLV_PDEV_CHANNEL_HOPPING_EVENTID,
+ WMI_TLV_PDEV_ANI_CCK_LEVEL_EVENTID,
+ WMI_TLV_PDEV_ANI_OFDM_LEVEL_EVENTID,
+ WMI_TLV_PDEV_TPC_EVENTID,
+ WMI_TLV_PDEV_NFCAL_POWER_ALL_CHANNELS_EVENTID,
+ WMI_TLV_PDEV_SET_HW_MODE_RESP_EVENTID,
+ WMI_TLV_PDEV_HW_MODE_TRANSITION_EVENTID,
+ WMI_TLV_PDEV_SET_MAC_CONFIG_RESP_EVENTID,
+ WMI_TLV_PDEV_ANTDIV_STATUS_EVENTID,
+ WMI_TLV_PDEV_CHIP_POWER_STATS_EVENTID,
+ WMI_TLV_PDEV_CHIP_POWER_SAVE_FAILURE_DETECTED_EVENTID,
+ WMI_TLV_PDEV_CSA_SWITCH_COUNT_STATUS_EVENTID,
+ WMI_TLV_PDEV_CHECK_CAL_VERSION_EVENTID,
+ WMI_TLV_PDEV_DIV_RSSI_ANTID_EVENTID,
+ WMI_TLV_PDEV_BSS_CHAN_INFO_EVENTID,
WMI_TLV_VDEV_START_RESP_EVENTID = WMI_TLV_EV(WMI_TLV_GRP_VDEV),
WMI_TLV_VDEV_STOPPED_EVENTID,
WMI_TLV_VDEV_INSTALL_KEY_COMPLETE_EVENTID,
@@ -1845,6 +1863,8 @@ wmi_tlv_svc_map(const __le32 *in, unsigned long *out, size_t len)
len);
SVCMAP(WMI_TLV_SERVICE_MESH_11S,
WMI_SERVICE_MESH_11S, len);
+ SVCMAP(WMI_TLV_SERVICE_BSS_CHANNEL_INFO_64,
+ WMI_SERVICE_BSS_CHANNEL_INFO_64, len);
}
static inline void
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c
index c9e004388536..5a430b661ad2 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -2696,6 +2696,8 @@ static void ath10k_wmi_event_chan_info_unpaired(struct ath10k *ar,
if (!params->mac_clk_mhz || !survey)
return;
+ ar->hw_params.channel_counters_freq_hz = params->mac_clk_mhz * 1000;
+
memset(survey, 0, sizeof(*survey));
survey->noise = params->noise_floor;
@@ -5644,27 +5646,51 @@ static int ath10k_wmi_event_temperature(struct ath10k *ar, struct sk_buff *skb)
return 0;
}
-static int ath10k_wmi_event_pdev_bss_chan_info(struct ath10k *ar,
- struct sk_buff *skb)
+static int
+ath10k_wmi_op_pull_pdev_bss_ch_info_ev(struct ath10k *ar,
+ struct sk_buff *skb,
+ struct wmi_pdev_bss_chan_info_event *arg)
{
- struct wmi_pdev_bss_chan_info_event *ev;
+ struct wmi_pdev_bss_chan_info_event *ev = (void *)skb->data;
+
+ if (skb->len < sizeof(*ev))
+ return -EPROTO;
+
+ arg->freq = __le32_to_cpu(ev->freq);
+ arg->noise_floor = __le32_to_cpu(ev->noise_floor);
+ arg->cycle_busy = __le64_to_cpu(ev->cycle_busy);
+ arg->cycle_total = __le64_to_cpu(ev->cycle_total);
+ arg->cycle_tx = __le64_to_cpu(ev->cycle_tx);
+ arg->cycle_rx = __le64_to_cpu(ev->cycle_rx);
+ arg->cycle_rx_bss = __le64_to_cpu(ev->cycle_rx_bss);
+
+ return 0;
+}
+
+int ath10k_wmi_event_pdev_bss_chan_info(struct ath10k *ar,
+ struct sk_buff *skb)
+{
+ struct wmi_pdev_bss_chan_info_event ev = {};
struct survey_info *survey;
u64 busy, total, tx, rx, rx_bss;
u32 freq, noise_floor;
u32 cc_freq_hz = ar->hw_params.channel_counters_freq_hz;
- int idx;
+ int idx, ret;
- ev = (struct wmi_pdev_bss_chan_info_event *)skb->data;
- if (WARN_ON(skb->len < sizeof(*ev)))
- return -EPROTO;
+ ret = ath10k_wmi_pull_pdev_bss_chan_info(ar, skb, &ev);
+ if (ret) {
+ ath10k_warn(ar, "failed to parse pdev bss chan info event: %d\n"
+ , ret);
+ return ret;
+ }
- freq = __le32_to_cpu(ev->freq);
- noise_floor = __le32_to_cpu(ev->noise_floor);
- busy = __le64_to_cpu(ev->cycle_busy);
- total = __le64_to_cpu(ev->cycle_total);
- tx = __le64_to_cpu(ev->cycle_tx);
- rx = __le64_to_cpu(ev->cycle_rx);
- rx_bss = __le64_to_cpu(ev->cycle_rx_bss);
+ freq = ev.freq;
+ noise_floor = ev.noise_floor;
+ busy = ev.cycle_busy;
+ total = ev.cycle_total;
+ tx = ev.cycle_tx;
+ rx = ev.cycle_rx;
+ rx_bss = ev.cycle_rx_bss;
ath10k_dbg(ar, ATH10K_DBG_WMI,
"wmi event pdev bss chan info:\n freq: %d noise: %d cycle: busy %llu total %llu tx %llu rx %llu rx_bss %llu\n",
@@ -9076,6 +9102,7 @@ static const struct wmi_ops wmi_10_2_ops = {
.pull_rdy = ath10k_wmi_op_pull_rdy_ev,
.pull_roam_ev = ath10k_wmi_op_pull_roam_ev,
.pull_echo_ev = ath10k_wmi_op_pull_echo_ev,
+ .pull_pdev_bss_chan_info = ath10k_wmi_op_pull_pdev_bss_ch_info_ev,
.gen_pdev_suspend = ath10k_wmi_op_gen_pdev_suspend,
.gen_pdev_resume = ath10k_wmi_op_gen_pdev_resume,
@@ -9144,6 +9171,7 @@ static const struct wmi_ops wmi_10_2_4_ops = {
.pull_rdy = ath10k_wmi_op_pull_rdy_ev,
.pull_roam_ev = ath10k_wmi_op_pull_roam_ev,
.pull_echo_ev = ath10k_wmi_op_pull_echo_ev,
+ .pull_pdev_bss_chan_info = ath10k_wmi_op_pull_pdev_bss_ch_info_ev,
.gen_pdev_suspend = ath10k_wmi_op_gen_pdev_suspend,
.gen_pdev_resume = ath10k_wmi_op_gen_pdev_resume,
@@ -9208,6 +9236,7 @@ static const struct wmi_ops wmi_10_4_ops = {
.pull_rdy = ath10k_wmi_op_pull_rdy_ev,
.pull_roam_ev = ath10k_wmi_op_pull_roam_ev,
.pull_dfs_status_ev = ath10k_wmi_10_4_op_pull_dfs_status_ev,
+ .pull_pdev_bss_chan_info = ath10k_wmi_op_pull_pdev_bss_ch_info_ev,
.get_txbf_conf_scheme = ath10k_wmi_10_4_txbf_conf_scheme,
.gen_pdev_suspend = ath10k_wmi_op_gen_pdev_suspend,
diff --git a/drivers/net/wireless/ath/ath10k/wmi.h b/drivers/net/wireless/ath/ath10k/wmi.h
index 6e7cac704c61..6a965a7f7cdf 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.h
+++ b/drivers/net/wireless/ath/ath10k/wmi.h
@@ -7455,5 +7455,6 @@ int ath10k_wmi_barrier(struct ath10k *ar);
void ath10k_wmi_tpc_config_get_rate_code(u8 *rate_code, u16 *pream_table,
u32 num_tx_chain);
void ath10k_wmi_event_tpc_final_table(struct ath10k *ar, struct sk_buff *skb);
+int ath10k_wmi_event_pdev_bss_chan_info(struct ath10k *ar, struct sk_buff *skb);
#endif /* _WMI_H_ */