* [PATCH V2 1/3] ath11k: rename ath11k_wmi_base instances from wmi_sc to wmi_ab
@ 2019-11-20 19:28 John Crispin
2019-11-20 19:28 ` [PATCH V2 2/3] ath11k: add WMI calls to manually add/del/pause/resume TWT dialogs John Crispin
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: John Crispin @ 2019-11-20 19:28 UTC (permalink / raw)
To: Kalle Valo; +Cc: ath11k, John Crispin
This makes the code consistent with the recent sc to ab rename.
Signed-off-by: John Crispin <john@phrozen.org>
---
drivers/net/wireless/ath/ath11k/core.c | 4 +-
drivers/net/wireless/ath/ath11k/core.h | 2 +-
drivers/net/wireless/ath/ath11k/htc.c | 2 +-
drivers/net/wireless/ath/ath11k/mac.c | 4 +-
drivers/net/wireless/ath/ath11k/testmode.c | 2 +-
drivers/net/wireless/ath/ath11k/wmi.c | 146 ++++++++++-----------
drivers/net/wireless/ath/ath11k/wmi.h | 2 +-
7 files changed, 81 insertions(+), 81 deletions(-)
diff --git a/drivers/net/wireless/ath/ath11k/core.c b/drivers/net/wireless/ath/ath11k/core.c
index 37d4ecb458db..c72453cdcdd7 100644
--- a/drivers/net/wireless/ath/ath11k/core.c
+++ b/drivers/net/wireless/ath/ath11k/core.c
@@ -629,7 +629,7 @@ static void ath11k_core_restart(struct work_struct *work)
idr_destroy(&ar->txmgmt_idr);
}
- wake_up(&ab->wmi_sc.tx_credits_wq);
+ wake_up(&ab->wmi_ab.tx_credits_wq);
wake_up(&ab->peer_mapping_wq);
ret = ath11k_core_reconfigure_on_crash(ab);
@@ -739,7 +739,7 @@ struct ath11k_base *ath11k_core_alloc(struct device *dev)
INIT_LIST_HEAD(&ab->peers);
init_waitqueue_head(&ab->peer_mapping_wq);
- init_waitqueue_head(&ab->wmi_sc.tx_credits_wq);
+ init_waitqueue_head(&ab->wmi_ab.tx_credits_wq);
INIT_WORK(&ab->restart_work, ath11k_core_restart);
timer_setup(&ab->rx_replenish_retry, ath11k_ce_rx_replenish_retry, 0);
ab->dev = dev;
diff --git a/drivers/net/wireless/ath/ath11k/core.h b/drivers/net/wireless/ath/ath11k/core.h
index 065cb9dc880b..90b78360bb07 100644
--- a/drivers/net/wireless/ath/ath11k/core.h
+++ b/drivers/net/wireless/ath/ath11k/core.h
@@ -577,7 +577,7 @@ struct ath11k_base {
struct platform_device *pdev;
struct device *dev;
struct ath11k_qmi qmi;
- struct ath11k_wmi_base wmi_sc;
+ struct ath11k_wmi_base wmi_ab;
struct completion fw_ready;
struct rproc *tgt_rproc;
int num_radios;
diff --git a/drivers/net/wireless/ath/ath11k/htc.c b/drivers/net/wireless/ath/ath11k/htc.c
index 9d4115f25ceb..8f54f58b83e6 100644
--- a/drivers/net/wireless/ath/ath11k/htc.c
+++ b/drivers/net/wireless/ath/ath11k/htc.c
@@ -736,7 +736,7 @@ int ath11k_htc_init(struct ath11k_base *ab)
htc->ab = ab;
- switch (ab->wmi_sc.preferred_hw_mode) {
+ switch (ab->wmi_ab.preferred_hw_mode) {
case WMI_HOST_HW_MODE_SINGLE:
htc->wmi_ep_count = 1;
break;
diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c
index 6097195fec52..fc9ada2caa9f 100644
--- a/drivers/net/wireless/ath/ath11k/mac.c
+++ b/drivers/net/wireless/ath/ath11k/mac.c
@@ -5245,7 +5245,7 @@ ath11k_mac_update_bss_chan_survey(struct ath11k *ar,
lockdep_assert_held(&ar->conf_mutex);
- if (!test_bit(WMI_TLV_SERVICE_BSS_CHANNEL_INFO_64, ar->ab->wmi_sc.svc_map) ||
+ if (!test_bit(WMI_TLV_SERVICE_BSS_CHANNEL_INFO_64, ar->ab->wmi_ab.svc_map) ||
ar->rx_channel != channel)
return;
@@ -5713,7 +5713,7 @@ int ath11k_mac_create(struct ath11k_base *ab)
ar->pdev_idx = i;
ar->lmac_id = ath11k_core_get_hw_mac_id(ab, i);
- ar->wmi = &ab->wmi_sc.wmi[i];
+ ar->wmi = &ab->wmi_ab.wmi[i];
/* FIXME wmi[0] is already initialized during attach,
* Should we do this again?
*/
diff --git a/drivers/net/wireless/ath/ath11k/testmode.c b/drivers/net/wireless/ath/ath11k/testmode.c
index 932bee6d1740..d2dc9db01491 100644
--- a/drivers/net/wireless/ath/ath11k/testmode.c
+++ b/drivers/net/wireless/ath/ath11k/testmode.c
@@ -150,7 +150,7 @@ static int ath11k_tm_cmd_wmi(struct ath11k *ar, struct nlattr *tb[])
ath11k_dbg_dump(ar->ab, ATH11K_DBG_TESTMODE, NULL, "", buf, buf_len);
- skb = ath11k_wmi_alloc_skb(wmi->wmi_sc, buf_len);
+ skb = ath11k_wmi_alloc_skb(wmi->wmi_ab, buf_len);
if (!skb) {
ret = -ENOMEM;
goto out;
diff --git a/drivers/net/wireless/ath/ath11k/wmi.c b/drivers/net/wireless/ath/ath11k/wmi.c
index bf3c246ce883..b16bfb50d73e 100644
--- a/drivers/net/wireless/ath/ath11k/wmi.c
+++ b/drivers/net/wireless/ath/ath11k/wmi.c
@@ -205,7 +205,7 @@ static int ath11k_wmi_cmd_send_nowait(struct ath11k_pdev_wmi *wmi, struct sk_buf
u32 cmd_id)
{
struct ath11k_skb_cb *skb_cb = ATH11K_SKB_CB(skb);
- struct ath11k_base *ab = wmi->wmi_sc->ab;
+ struct ath11k_base *ab = wmi->wmi_ab->ab;
struct wmi_cmd_hdr *cmd_hdr;
int ret;
u32 cmd = 0;
@@ -234,7 +234,7 @@ static int ath11k_wmi_cmd_send_nowait(struct ath11k_pdev_wmi *wmi, struct sk_buf
int ath11k_wmi_cmd_send(struct ath11k_pdev_wmi *wmi, struct sk_buff *skb,
u32 cmd_id)
{
- struct ath11k_wmi_base *wmi_sc = wmi->wmi_sc;
+ struct ath11k_wmi_base *wmi_sc = wmi->wmi_ab;
int ret = -EOPNOTSUPP;
might_sleep();
@@ -448,7 +448,7 @@ static void ath11k_wmi_service_bitmap_copy(struct ath11k_pdev_wmi *wmi,
for (i = 0, j = 0; i < WMI_SERVICE_BM_SIZE && j < WMI_MAX_SERVICE; i++) {
do {
if (wmi_svc_bm[i] & BIT(j % WMI_SERVICE_BITS_IN_SIZE32))
- set_bit(j, wmi->wmi_sc->svc_map);
+ set_bit(j, wmi->wmi_ab->svc_map);
} while (++j % WMI_SERVICE_BITS_IN_SIZE32);
}
}
@@ -457,7 +457,7 @@ static int ath11k_wmi_tlv_svc_rdy_parse(struct ath11k_base *ab, u16 tag, u16 len
const void *ptr, void *data)
{
struct wmi_tlv_svc_ready_parse *svc_ready = data;
- struct ath11k_pdev_wmi *wmi_handle = &ab->wmi_sc.wmi[0];
+ struct ath11k_pdev_wmi *wmi_handle = &ab->wmi_ab.wmi[0];
u16 expect_len;
switch (tag) {
@@ -538,7 +538,7 @@ int ath11k_wmi_mgmt_send(struct ath11k *ar, u32 vdev_id, u32 buf_id,
len = sizeof(*cmd) + sizeof(*frame_tlv) + roundup(buf_len, 4);
- skb = ath11k_wmi_alloc_skb(wmi->wmi_sc, len);
+ skb = ath11k_wmi_alloc_skb(wmi->wmi_ab, len);
if (!skb)
return -ENOMEM;
@@ -590,7 +590,7 @@ int ath11k_wmi_vdev_create(struct ath11k *ar, u8 *macaddr,
len = sizeof(*cmd) + TLV_HDR_SIZE +
(WMI_NUM_SUPPORTED_BAND_MAX * sizeof(*txrx_streams));
- skb = ath11k_wmi_alloc_skb(wmi->wmi_sc, len);
+ skb = ath11k_wmi_alloc_skb(wmi->wmi_ab, len);
if (!skb)
return -ENOMEM;
@@ -656,7 +656,7 @@ int ath11k_wmi_vdev_delete(struct ath11k *ar, u8 vdev_id)
struct sk_buff *skb;
int ret;
- skb = ath11k_wmi_alloc_skb(wmi->wmi_sc, sizeof(*cmd));
+ skb = ath11k_wmi_alloc_skb(wmi->wmi_ab, sizeof(*cmd));
if (!skb)
return -ENOMEM;
@@ -683,7 +683,7 @@ int ath11k_wmi_vdev_stop(struct ath11k *ar, u8 vdev_id)
struct sk_buff *skb;
int ret;
- skb = ath11k_wmi_alloc_skb(wmi->wmi_sc, sizeof(*cmd));
+ skb = ath11k_wmi_alloc_skb(wmi->wmi_ab, sizeof(*cmd));
if (!skb)
return -ENOMEM;
@@ -711,7 +711,7 @@ int ath11k_wmi_vdev_down(struct ath11k *ar, u8 vdev_id)
struct sk_buff *skb;
int ret;
- skb = ath11k_wmi_alloc_skb(wmi->wmi_sc, sizeof(*cmd));
+ skb = ath11k_wmi_alloc_skb(wmi->wmi_ab, sizeof(*cmd));
if (!skb)
return -ENOMEM;
@@ -789,7 +789,7 @@ int ath11k_wmi_vdev_start(struct ath11k *ar, struct wmi_vdev_start_req_arg *arg,
len = sizeof(*cmd) + sizeof(*chan) + TLV_HDR_SIZE;
- skb = ath11k_wmi_alloc_skb(wmi->wmi_sc, len);
+ skb = ath11k_wmi_alloc_skb(wmi->wmi_ab, len);
if (!skb)
return -ENOMEM;
@@ -867,7 +867,7 @@ int ath11k_wmi_vdev_up(struct ath11k *ar, u32 vdev_id, u32 aid, const u8 *bssid)
struct sk_buff *skb;
int ret;
- skb = ath11k_wmi_alloc_skb(wmi->wmi_sc, sizeof(*cmd));
+ skb = ath11k_wmi_alloc_skb(wmi->wmi_ab, sizeof(*cmd));
if (!skb)
return -ENOMEM;
@@ -901,7 +901,7 @@ int ath11k_wmi_send_peer_create_cmd(struct ath11k *ar,
struct sk_buff *skb;
int ret;
- skb = ath11k_wmi_alloc_skb(wmi->wmi_sc, sizeof(*cmd));
+ skb = ath11k_wmi_alloc_skb(wmi->wmi_ab, sizeof(*cmd));
if (!skb)
return -ENOMEM;
@@ -934,7 +934,7 @@ int ath11k_wmi_send_peer_delete_cmd(struct ath11k *ar,
struct sk_buff *skb;
int ret;
- skb = ath11k_wmi_alloc_skb(wmi->wmi_sc, sizeof(*cmd));
+ skb = ath11k_wmi_alloc_skb(wmi->wmi_ab, sizeof(*cmd));
if (!skb)
return -ENOMEM;
@@ -966,7 +966,7 @@ int ath11k_wmi_send_pdev_set_regdomain(struct ath11k *ar,
struct sk_buff *skb;
int ret;
- skb = ath11k_wmi_alloc_skb(wmi->wmi_sc, sizeof(*cmd));
+ skb = ath11k_wmi_alloc_skb(wmi->wmi_ab, sizeof(*cmd));
if (!skb)
return -ENOMEM;
@@ -1006,7 +1006,7 @@ int ath11k_wmi_set_peer_param(struct ath11k *ar, const u8 *peer_addr,
struct sk_buff *skb;
int ret;
- skb = ath11k_wmi_alloc_skb(wmi->wmi_sc, sizeof(*cmd));
+ skb = ath11k_wmi_alloc_skb(wmi->wmi_ab, sizeof(*cmd));
if (!skb)
return -ENOMEM;
@@ -1040,7 +1040,7 @@ int ath11k_wmi_send_peer_flush_tids_cmd(struct ath11k *ar,
struct sk_buff *skb;
int ret;
- skb = ath11k_wmi_alloc_skb(wmi->wmi_sc, sizeof(*cmd));
+ skb = ath11k_wmi_alloc_skb(wmi->wmi_ab, sizeof(*cmd));
if (!skb)
return -ENOMEM;
@@ -1076,7 +1076,7 @@ int ath11k_wmi_peer_rx_reorder_queue_setup(struct ath11k *ar,
struct sk_buff *skb;
int ret;
- skb = ath11k_wmi_alloc_skb(ar->wmi->wmi_sc, sizeof(*cmd));
+ skb = ath11k_wmi_alloc_skb(ar->wmi->wmi_ab, sizeof(*cmd));
if (!skb)
return -ENOMEM;
@@ -1118,7 +1118,7 @@ ath11k_wmi_rx_reord_queue_remove(struct ath11k *ar,
struct sk_buff *skb;
int ret;
- skb = ath11k_wmi_alloc_skb(wmi->wmi_sc, sizeof(*cmd));
+ skb = ath11k_wmi_alloc_skb(wmi->wmi_ab, sizeof(*cmd));
if (!skb)
return -ENOMEM;
@@ -1154,7 +1154,7 @@ int ath11k_wmi_pdev_set_param(struct ath11k *ar, u32 param_id,
struct sk_buff *skb;
int ret;
- skb = ath11k_wmi_alloc_skb(wmi->wmi_sc, sizeof(*cmd));
+ skb = ath11k_wmi_alloc_skb(wmi->wmi_ab, sizeof(*cmd));
if (!skb)
return -ENOMEM;
@@ -1185,7 +1185,7 @@ int ath11k_wmi_pdev_set_ps_mode(struct ath11k *ar, int vdev_id, u32 enable)
struct sk_buff *skb;
int ret;
- skb = ath11k_wmi_alloc_skb(wmi->wmi_sc, sizeof(*cmd));
+ skb = ath11k_wmi_alloc_skb(wmi->wmi_ab, sizeof(*cmd));
if (!skb)
return -ENOMEM;
@@ -1216,7 +1216,7 @@ int ath11k_wmi_pdev_suspend(struct ath11k *ar, u32 suspend_opt,
struct sk_buff *skb;
int ret;
- skb = ath11k_wmi_alloc_skb(wmi->wmi_sc, sizeof(*cmd));
+ skb = ath11k_wmi_alloc_skb(wmi->wmi_ab, sizeof(*cmd));
if (!skb)
return -ENOMEM;
@@ -1247,7 +1247,7 @@ int ath11k_wmi_pdev_resume(struct ath11k *ar, u32 pdev_id)
struct sk_buff *skb;
int ret;
- skb = ath11k_wmi_alloc_skb(wmi->wmi_sc, sizeof(*cmd));
+ skb = ath11k_wmi_alloc_skb(wmi->wmi_ab, sizeof(*cmd));
if (!skb)
return -ENOMEM;
@@ -1281,7 +1281,7 @@ int ath11k_wmi_pdev_bss_chan_info_request(struct ath11k *ar,
struct sk_buff *skb;
int ret;
- skb = ath11k_wmi_alloc_skb(wmi->wmi_sc, sizeof(*cmd));
+ skb = ath11k_wmi_alloc_skb(wmi->wmi_ab, sizeof(*cmd));
if (!skb)
return -ENOMEM;
@@ -1314,7 +1314,7 @@ int ath11k_wmi_send_set_ap_ps_param_cmd(struct ath11k *ar, u8 *peer_addr,
struct sk_buff *skb;
int ret;
- skb = ath11k_wmi_alloc_skb(wmi->wmi_sc, sizeof(*cmd));
+ skb = ath11k_wmi_alloc_skb(wmi->wmi_ab, sizeof(*cmd));
if (!skb)
return -ENOMEM;
@@ -1349,7 +1349,7 @@ int ath11k_wmi_set_sta_ps_param(struct ath11k *ar, u32 vdev_id,
struct sk_buff *skb;
int ret;
- skb = ath11k_wmi_alloc_skb(wmi->wmi_sc, sizeof(*cmd));
+ skb = ath11k_wmi_alloc_skb(wmi->wmi_ab, sizeof(*cmd));
if (!skb)
return -ENOMEM;
@@ -1384,7 +1384,7 @@ int ath11k_wmi_force_fw_hang_cmd(struct ath11k *ar, u32 type, u32 delay_time_ms)
len = sizeof(*cmd);
- skb = ath11k_wmi_alloc_skb(wmi->wmi_sc, len);
+ skb = ath11k_wmi_alloc_skb(wmi->wmi_ab, len);
if (!skb)
return -ENOMEM;
@@ -1412,7 +1412,7 @@ int ath11k_wmi_vdev_set_param_cmd(struct ath11k *ar, u32 vdev_id,
struct sk_buff *skb;
int ret;
- skb = ath11k_wmi_alloc_skb(wmi->wmi_sc, sizeof(*cmd));
+ skb = ath11k_wmi_alloc_skb(wmi->wmi_ab, sizeof(*cmd));
if (!skb)
return -ENOMEM;
@@ -1446,7 +1446,7 @@ int ath11k_wmi_send_stats_request_cmd(struct ath11k *ar,
struct sk_buff *skb;
int ret;
- skb = ath11k_wmi_alloc_skb(wmi->wmi_sc, sizeof(*cmd));
+ skb = ath11k_wmi_alloc_skb(wmi->wmi_ab, sizeof(*cmd));
if (!skb)
return -ENOMEM;
@@ -1479,7 +1479,7 @@ int ath11k_wmi_send_bcn_offload_control_cmd(struct ath11k *ar,
struct sk_buff *skb;
int ret;
- skb = ath11k_wmi_alloc_skb(wmi->wmi_sc, sizeof(*cmd));
+ skb = ath11k_wmi_alloc_skb(wmi->wmi_ab, sizeof(*cmd));
if (!skb)
return -ENOMEM;
@@ -1520,7 +1520,7 @@ int ath11k_wmi_bcn_tmpl(struct ath11k *ar, u32 vdev_id,
len = sizeof(*cmd) + sizeof(*bcn_prb_info) + TLV_HDR_SIZE + aligned_len;
- skb = ath11k_wmi_alloc_skb(wmi->wmi_sc, len);
+ skb = ath11k_wmi_alloc_skb(wmi->wmi_ab, len);
if (!skb)
return -ENOMEM;
@@ -1571,7 +1571,7 @@ int ath11k_wmi_vdev_install_key(struct ath11k *ar,
len = sizeof(*cmd) + TLV_HDR_SIZE + key_len_aligned;
- skb = ath11k_wmi_alloc_skb(wmi->wmi_sc, len);
+ skb = ath11k_wmi_alloc_skb(wmi->wmi_ab, len);
if (!skb)
return -ENOMEM;
@@ -1717,7 +1717,7 @@ int ath11k_wmi_send_peer_assoc_cmd(struct ath11k *ar,
sizeof(*mcs) + TLV_HDR_SIZE +
(sizeof(*he_mcs) * param->peer_he_mcs_count);
- skb = ath11k_wmi_alloc_skb(wmi->wmi_sc, len);
+ skb = ath11k_wmi_alloc_skb(wmi->wmi_ab, len);
if (!skb)
return -ENOMEM;
@@ -1983,7 +1983,7 @@ int ath11k_wmi_send_scan_start_cmd(struct ath11k *ar,
roundup(params->extraie.len, sizeof(u32));
len += extraie_len_with_pad;
- skb = ath11k_wmi_alloc_skb(wmi->wmi_sc, len);
+ skb = ath11k_wmi_alloc_skb(wmi->wmi_ab, len);
if (!skb)
return -ENOMEM;
@@ -2099,7 +2099,7 @@ int ath11k_wmi_send_scan_stop_cmd(struct ath11k *ar,
struct sk_buff *skb;
int ret;
- skb = ath11k_wmi_alloc_skb(wmi->wmi_sc, sizeof(*cmd));
+ skb = ath11k_wmi_alloc_skb(wmi->wmi_ab, sizeof(*cmd));
if (!skb)
return -ENOMEM;
@@ -2155,7 +2155,7 @@ int ath11k_wmi_send_scan_chan_list_cmd(struct ath11k *ar,
len = sizeof(*cmd) + TLV_HDR_SIZE +
sizeof(*chan_info) * chan_list->nallchans;
- skb = ath11k_wmi_alloc_skb(wmi->wmi_sc, len);
+ skb = ath11k_wmi_alloc_skb(wmi->wmi_ab, len);
if (!skb)
return -ENOMEM;
@@ -2247,7 +2247,7 @@ int ath11k_wmi_send_wmm_update_cmd_tlv(struct ath11k *ar, u32 vdev_id,
struct sk_buff *skb;
int ret, ac;
- skb = ath11k_wmi_alloc_skb(wmi->wmi_sc, sizeof(*cmd));
+ skb = ath11k_wmi_alloc_skb(wmi->wmi_ab, sizeof(*cmd));
if (!skb)
return -ENOMEM;
@@ -2314,7 +2314,7 @@ int ath11k_wmi_send_dfs_phyerr_offload_enable_cmd(struct ath11k *ar,
struct sk_buff *skb;
int ret;
- skb = ath11k_wmi_alloc_skb(wmi->wmi_sc, sizeof(*cmd));
+ skb = ath11k_wmi_alloc_skb(wmi->wmi_ab, sizeof(*cmd));
if (!skb)
return -ENOMEM;
@@ -2351,7 +2351,7 @@ int ath11k_wmi_pdev_peer_pktlog_filter(struct ath11k *ar, u8 *addr, u8 enable)
int ret, len;
len = sizeof(*cmd) + sizeof(*info) + TLV_HDR_SIZE;
- skb = ath11k_wmi_alloc_skb(wmi->wmi_sc, len);
+ skb = ath11k_wmi_alloc_skb(wmi->wmi_ab, len);
if (!skb)
return -ENOMEM;
@@ -2397,7 +2397,7 @@ ath11k_wmi_send_init_country_cmd(struct ath11k *ar,
struct sk_buff *skb;
int ret;
- skb = ath11k_wmi_alloc_skb(wmi->wmi_sc, sizeof(*cmd));
+ skb = ath11k_wmi_alloc_skb(wmi->wmi_ab, sizeof(*cmd));
if (!skb)
return -ENOMEM;
@@ -2449,7 +2449,7 @@ int ath11k_wmi_pdev_pktlog_enable(struct ath11k *ar, u32 pktlog_filter)
struct sk_buff *skb;
int ret;
- skb = ath11k_wmi_alloc_skb(wmi->wmi_sc, sizeof(*cmd));
+ skb = ath11k_wmi_alloc_skb(wmi->wmi_ab, sizeof(*cmd));
if (!skb)
return -ENOMEM;
@@ -2479,7 +2479,7 @@ int ath11k_wmi_pdev_pktlog_disable(struct ath11k *ar)
struct sk_buff *skb;
int ret;
- skb = ath11k_wmi_alloc_skb(wmi->wmi_sc, sizeof(*cmd));
+ skb = ath11k_wmi_alloc_skb(wmi->wmi_ab, sizeof(*cmd));
if (!skb)
return -ENOMEM;
@@ -2504,14 +2504,14 @@ int
ath11k_wmi_send_twt_enable_cmd(struct ath11k *ar, u32 pdev_id)
{
struct ath11k_pdev_wmi *wmi = ar->wmi;
- struct ath11k_base *ab = wmi->wmi_sc->ab;
+ struct ath11k_base *ab = wmi->wmi_ab->ab;
struct wmi_twt_enable_params_cmd *cmd;
struct sk_buff *skb;
int ret, len;
len = sizeof(*cmd);
- skb = ath11k_wmi_alloc_skb(wmi->wmi_sc, len);
+ skb = ath11k_wmi_alloc_skb(wmi->wmi_ab, len);
if (!skb)
return -ENOMEM;
@@ -2555,14 +2555,14 @@ int
ath11k_wmi_send_twt_disable_cmd(struct ath11k *ar, u32 pdev_id)
{
struct ath11k_pdev_wmi *wmi = ar->wmi;
- struct ath11k_base *ab = wmi->wmi_sc->ab;
+ struct ath11k_base *ab = wmi->wmi_ab->ab;
struct wmi_twt_disable_params_cmd *cmd;
struct sk_buff *skb;
int ret, len;
len = sizeof(*cmd);
- skb = ath11k_wmi_alloc_skb(wmi->wmi_sc, len);
+ skb = ath11k_wmi_alloc_skb(wmi->wmi_ab, len);
if (!skb)
return -ENOMEM;
@@ -2585,14 +2585,14 @@ ath11k_wmi_send_obss_spr_cmd(struct ath11k *ar, u32 vdev_id,
struct ieee80211_he_obss_pd *he_obss_pd)
{
struct ath11k_pdev_wmi *wmi = ar->wmi;
- struct ath11k_base *ab = wmi->wmi_sc->ab;
+ struct ath11k_base *ab = wmi->wmi_ab->ab;
struct wmi_obss_spatial_reuse_params_cmd *cmd;
struct sk_buff *skb;
int ret, len;
len = sizeof(*cmd);
- skb = ath11k_wmi_alloc_skb(wmi->wmi_sc, len);
+ skb = ath11k_wmi_alloc_skb(wmi->wmi_ab, len);
if (!skb)
return -ENOMEM;
@@ -2714,7 +2714,7 @@ ath11k_wmi_copy_resource_config(struct wmi_resource_config *wmi_cfg,
static int ath11k_init_cmd_send(struct ath11k_pdev_wmi *wmi,
struct wmi_init_cmd_param *param)
{
- struct ath11k_base *ab = wmi->wmi_sc->ab;
+ struct ath11k_base *ab = wmi->wmi_ab->ab;
struct sk_buff *skb;
struct wmi_init_cmd *cmd;
struct wmi_resource_config *cfg;
@@ -2734,7 +2734,7 @@ static int ath11k_init_cmd_send(struct ath11k_pdev_wmi *wmi,
len = sizeof(*cmd) + TLV_HDR_SIZE + sizeof(*cfg) + hw_mode_len +
(sizeof(*host_mem_chunks) * WMI_MAX_MEM_REQS);
- skb = ath11k_wmi_alloc_skb(wmi->wmi_sc, len);
+ skb = ath11k_wmi_alloc_skb(wmi->wmi_ab, len);
if (!skb)
return -ENOMEM;
@@ -2829,7 +2829,7 @@ int ath11k_wmi_wait_for_service_ready(struct ath11k_base *ab)
{
unsigned long time_left;
- time_left = wait_for_completion_timeout(&ab->wmi_sc.service_ready,
+ time_left = wait_for_completion_timeout(&ab->wmi_ab.service_ready,
WMI_SERVICE_READY_TIMEOUT_HZ);
if (!time_left)
return -ETIMEDOUT;
@@ -2841,7 +2841,7 @@ int ath11k_wmi_wait_for_unified_ready(struct ath11k_base *ab)
{
unsigned long time_left;
- time_left = wait_for_completion_timeout(&ab->wmi_sc.unified_ready,
+ time_left = wait_for_completion_timeout(&ab->wmi_ab.unified_ready,
WMI_SERVICE_READY_TIMEOUT_HZ);
if (!time_left)
return -ETIMEDOUT;
@@ -2851,7 +2851,7 @@ int ath11k_wmi_wait_for_unified_ready(struct ath11k_base *ab)
int ath11k_wmi_cmd_init(struct ath11k_base *ab)
{
- struct ath11k_wmi_base *wmi_sc = &ab->wmi_sc;
+ struct ath11k_wmi_base *wmi_sc = &ab->wmi_ab;
struct wmi_init_cmd_param init_param;
struct target_resource_config config;
@@ -2971,16 +2971,16 @@ static int ath11k_wmi_tlv_hw_mode_caps(struct ath11k_base *soc,
while (i < svc_rdy_ext->n_hw_mode_caps) {
hw_mode_caps = &svc_rdy_ext->hw_mode_caps[i];
mode = hw_mode_caps->hw_mode_id;
- pref = soc->wmi_sc.preferred_hw_mode;
+ pref = soc->wmi_ab.preferred_hw_mode;
if (ath11k_hw_mode_pri_map[mode] < ath11k_hw_mode_pri_map[pref]) {
svc_rdy_ext->pref_hw_mode_caps = *hw_mode_caps;
- soc->wmi_sc.preferred_hw_mode = mode;
+ soc->wmi_ab.preferred_hw_mode = mode;
}
i++;
}
- if (soc->wmi_sc.preferred_hw_mode == WMI_HOST_HW_MODE_MAX)
+ if (soc->wmi_ab.preferred_hw_mode == WMI_HOST_HW_MODE_MAX)
return -EINVAL;
return 0;
@@ -3030,7 +3030,7 @@ static int ath11k_wmi_tlv_ext_hal_reg_caps_parse(struct ath11k_base *soc,
static int ath11k_wmi_tlv_ext_hal_reg_caps(struct ath11k_base *soc,
u16 len, const void *ptr, void *data)
{
- struct ath11k_pdev_wmi *wmi_handle = &soc->wmi_sc.wmi[0];
+ struct ath11k_pdev_wmi *wmi_handle = &soc->wmi_ab.wmi[0];
struct wmi_tlv_svc_rdy_ext_parse *svc_rdy_ext = data;
struct ath11k_hal_reg_capabilities_ext reg_cap;
int ret;
@@ -3066,7 +3066,7 @@ static int ath11k_wmi_tlv_ext_soc_hal_reg_caps_parse(struct ath11k_base *soc,
u16 len, const void *ptr,
void *data)
{
- struct ath11k_pdev_wmi *wmi_handle = &soc->wmi_sc.wmi[0];
+ struct ath11k_pdev_wmi *wmi_handle = &soc->wmi_ab.wmi[0];
struct wmi_tlv_svc_rdy_ext_parse *svc_rdy_ext = data;
u8 hw_mode_id = svc_rdy_ext->pref_hw_mode_caps.hw_mode_id;
u32 phy_id_map;
@@ -3104,7 +3104,7 @@ static int ath11k_wmi_tlv_svc_rdy_ext_parse(struct ath11k_base *ab,
u16 tag, u16 len,
const void *ptr, void *data)
{
- struct ath11k_pdev_wmi *wmi_handle = &ab->wmi_sc.wmi[0];
+ struct ath11k_pdev_wmi *wmi_handle = &ab->wmi_ab.wmi[0];
struct wmi_tlv_svc_rdy_ext_parse *svc_rdy_ext = data;
int ret;
@@ -3156,7 +3156,7 @@ static int ath11k_wmi_tlv_svc_rdy_ext_parse(struct ath11k_base *ab,
return ret;
svc_rdy_ext->ext_hal_reg_done = true;
- complete(&ab->wmi_sc.service_ready);
+ complete(&ab->wmi_ab.service_ready);
}
break;
@@ -4498,7 +4498,7 @@ void ath11k_wmi_fw_stats_fill(struct ath11k *ar,
static void ath11k_wmi_op_ep_tx_credits(struct ath11k_base *ab)
{
/* try to send pending beacons first. they take priority */
- wake_up(&ab->wmi_sc.tx_credits_wq);
+ wake_up(&ab->wmi_ab.tx_credits_wq);
}
static void ath11k_wmi_htc_tx_complete(struct ath11k_base *ab,
@@ -4668,7 +4668,7 @@ static int ath11k_ready_event(struct ath11k_base *ab, struct sk_buff *skb)
return ret;
}
- complete(&ab->wmi_sc.unified_ready);
+ complete(&ab->wmi_ab.unified_ready);
return 0;
}
@@ -5319,7 +5319,7 @@ static void ath11k_service_available_event(struct ath11k_base *ab, struct sk_buf
do {
if (ev->wmi_service_segment_bitmap[i] &
BIT(j % WMI_AVAIL_SERVICE_BITS_IN_SIZE32))
- set_bit(j, ab->wmi_sc.svc_map);
+ set_bit(j, ab->wmi_ab.svc_map);
} while (++j % WMI_AVAIL_SERVICE_BITS_IN_SIZE32);
}
@@ -5639,9 +5639,9 @@ static int ath11k_connect_pdev_htc_service(struct ath11k_base *ab,
return status;
}
- ab->wmi_sc.wmi_endpoint_id[pdev_idx] = conn_resp.eid;
- ab->wmi_sc.wmi[pdev_idx].eid = conn_resp.eid;
- ab->wmi_sc.max_msg_len[pdev_idx] = conn_resp.max_msg_len;
+ ab->wmi_ab.wmi_endpoint_id[pdev_idx] = conn_resp.eid;
+ ab->wmi_ab.wmi[pdev_idx].eid = conn_resp.eid;
+ ab->wmi_ab.max_msg_len[pdev_idx] = conn_resp.max_msg_len;
return 0;
}
@@ -5664,7 +5664,7 @@ ath11k_wmi_send_unit_test_cmd(struct ath11k *ar,
arg_len = sizeof(u32) * ut_cmd.num_args;
buf_len = sizeof(ut_cmd) + arg_len + TLV_HDR_SIZE;
- skb = ath11k_wmi_alloc_skb(wmi->wmi_sc, buf_len);
+ skb = ath11k_wmi_alloc_skb(wmi->wmi_ab, buf_len);
if (!skb)
return -ENOMEM;
@@ -5771,11 +5771,11 @@ int ath11k_wmi_pdev_attach(struct ath11k_base *ab,
if (pdev_id >= MAX_RADIOS)
return -EINVAL;
- wmi_handle = &ab->wmi_sc.wmi[pdev_id];
+ wmi_handle = &ab->wmi_ab.wmi[pdev_id];
- wmi_handle->wmi_sc = &ab->wmi_sc;
+ wmi_handle->wmi_ab = &ab->wmi_ab;
- ab->wmi_sc.ab = ab;
+ ab->wmi_ab.ab = ab;
/* TODO: Init remaining resource specific to pdev */
return 0;
@@ -5789,12 +5789,12 @@ int ath11k_wmi_attach(struct ath11k_base *ab)
if (ret)
return ret;
- ab->wmi_sc.ab = ab;
- ab->wmi_sc.preferred_hw_mode = WMI_HOST_HW_MODE_MAX;
+ ab->wmi_ab.ab = ab;
+ ab->wmi_ab.preferred_hw_mode = WMI_HOST_HW_MODE_MAX;
/* TODO: Init remaining wmi soc resources required */
- init_completion(&ab->wmi_sc.service_ready);
- init_completion(&ab->wmi_sc.unified_ready);
+ init_completion(&ab->wmi_ab.service_ready);
+ init_completion(&ab->wmi_ab.unified_ready);
return 0;
}
diff --git a/drivers/net/wireless/ath/ath11k/wmi.h b/drivers/net/wireless/ath/ath11k/wmi.h
index 9919d8bf297b..ab983aac604b 100644
--- a/drivers/net/wireless/ath/ath11k/wmi.h
+++ b/drivers/net/wireless/ath/ath11k/wmi.h
@@ -2354,7 +2354,7 @@ struct wmi_service_available_event {
} __packed;
struct ath11k_pdev_wmi {
- struct ath11k_wmi_base *wmi_sc;
+ struct ath11k_wmi_base *wmi_ab;
enum ath11k_htc_ep_id eid;
const struct wmi_peer_flags_map *peer_flags;
u32 rx_decap_mode;
--
2.20.1
_______________________________________________
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH V2 2/3] ath11k: add WMI calls to manually add/del/pause/resume TWT dialogs
2019-11-20 19:28 [PATCH V2 1/3] ath11k: rename ath11k_wmi_base instances from wmi_sc to wmi_ab John Crispin
@ 2019-11-20 19:28 ` John Crispin
2019-11-20 19:28 ` [PATCH V2 3/3] ath11k: add debugfs for TWT debug calls John Crispin
2019-11-29 8:31 ` [PATCH V2 1/3] ath11k: rename ath11k_wmi_base instances from wmi_sc to wmi_ab Kalle Valo
2 siblings, 0 replies; 4+ messages in thread
From: John Crispin @ 2019-11-20 19:28 UTC (permalink / raw)
To: Kalle Valo; +Cc: ath11k, John Crispin
These calls are used for debugging and will be required for WFA certification
tests.
Signed-off-by: John Crispin <john@phrozen.org>
---
drivers/net/wireless/ath/ath11k/wmi.c | 218 ++++++++++++++++++++++++--
drivers/net/wireless/ath/ath11k/wmi.h | 114 ++++++++++++++
2 files changed, 318 insertions(+), 14 deletions(-)
diff --git a/drivers/net/wireless/ath/ath11k/wmi.c b/drivers/net/wireless/ath/ath11k/wmi.c
index b16bfb50d73e..ba08a7d95764 100644
--- a/drivers/net/wireless/ath/ath11k/wmi.c
+++ b/drivers/net/wireless/ath/ath11k/wmi.c
@@ -97,6 +97,8 @@ static const struct wmi_tlv_policy wmi_tlv_policies[] = {
= { .min_len = sizeof(struct wmi_stats_event) },
[WMI_TAG_PDEV_CTL_FAILSAFE_CHECK_EVENT]
= { .min_len = sizeof(struct wmi_pdev_ctl_failsafe_chk_event) },
+ [WMI_TAG_TWT_ADD_DIALOG_COMPLETE_EVENT]
+ = { .min_len = sizeof(struct wmi_twt_add_dialog_event) },
};
#define PRIMAP(_hw_mode_) \
@@ -234,22 +236,22 @@ static int ath11k_wmi_cmd_send_nowait(struct ath11k_pdev_wmi *wmi, struct sk_buf
int ath11k_wmi_cmd_send(struct ath11k_pdev_wmi *wmi, struct sk_buff *skb,
u32 cmd_id)
{
- struct ath11k_wmi_base *wmi_sc = wmi->wmi_ab;
+ struct ath11k_wmi_base *wmi_ab = wmi->wmi_ab;
int ret = -EOPNOTSUPP;
might_sleep();
- wait_event_timeout(wmi_sc->tx_credits_wq, ({
+ wait_event_timeout(wmi_ab->tx_credits_wq, ({
ret = ath11k_wmi_cmd_send_nowait(wmi, skb, cmd_id);
- if (ret && test_bit(ATH11K_FLAG_CRASH_FLUSH, &wmi_sc->ab->dev_flags))
+ if (ret && test_bit(ATH11K_FLAG_CRASH_FLUSH, &wmi_ab->ab->dev_flags))
ret = -ESHUTDOWN;
(ret != -EAGAIN);
}), WMI_SEND_TIMEOUT_HZ);
if (ret == -EAGAIN)
- ath11k_warn(wmi_sc->ab, "wmi command %d timeout\n", cmd_id);
+ ath11k_warn(wmi_ab->ab, "wmi command %d timeout\n", cmd_id);
return ret;
}
@@ -503,10 +505,10 @@ static int ath11k_service_ready_event(struct ath11k_base *ab, struct sk_buff *sk
return 0;
}
-struct sk_buff *ath11k_wmi_alloc_skb(struct ath11k_wmi_base *wmi_sc, u32 len)
+struct sk_buff *ath11k_wmi_alloc_skb(struct ath11k_wmi_base *wmi_ab, u32 len)
{
struct sk_buff *skb;
- struct ath11k_base *ab = wmi_sc->ab;
+ struct ath11k_base *ab = wmi_ab->ab;
u32 round_len = roundup(len, 4);
skb = ath11k_htc_alloc_skb(ab, WMI_SKB_HEADROOM + round_len);
@@ -2580,6 +2582,157 @@ ath11k_wmi_send_twt_disable_cmd(struct ath11k *ar, u32 pdev_id)
return ret;
}
+int
+ath11k_wmi_send_twt_add_dialog_cmd(struct ath11k *ar,
+ struct wmi_twt_add_dialog_params *params)
+{
+ struct ath11k_pdev_wmi *wmi = ar->wmi;
+ struct ath11k_base *ab = wmi->wmi_ab->ab;
+ struct wmi_twt_add_dialog_params_cmd *cmd;
+ struct sk_buff *skb;
+ int ret, len;
+
+ len = sizeof(*cmd);
+
+ skb = ath11k_wmi_alloc_skb(wmi->wmi_ab, len);
+ if (!skb)
+ return -ENOMEM;
+
+ cmd = (void *)skb->data;
+ cmd->tlv_header = FIELD_PREP(WMI_TLV_TAG,
+ WMI_TAG_TWT_ADD_DIALOG_CMD) |
+ FIELD_PREP(WMI_TLV_LEN, len - TLV_HDR_SIZE);
+
+ cmd->vdev_id = params->vdev_id;
+ ether_addr_copy(cmd->peer_macaddr.addr, params->peer_macaddr);
+ cmd->dialog_id = params->dialog_id;
+ cmd->wake_intvl_us = params->wake_intvl_us;
+ cmd->wake_intvl_mantis = params->wake_intvl_mantis;
+ cmd->wake_dura_us = params->wake_dura_us;
+ cmd->sp_offset_us = params->sp_offset_us;
+ cmd->flags = params->twt_cmd;
+ if (params->flag_bcast)
+ cmd->flags |= WMI_TWT_ADD_DIALOG_FLAG_BCAST;
+ if (params->flag_trigger)
+ cmd->flags |= WMI_TWT_ADD_DIALOG_FLAG_TRIGGER;
+ if (params->flag_flow_type)
+ cmd->flags |= WMI_TWT_ADD_DIALOG_FLAG_FLOW_TYPE;
+ if (params->flag_protection)
+ cmd->flags |= WMI_TWT_ADD_DIALOG_FLAG_PROTECTION;
+
+ ret = ath11k_wmi_cmd_send(wmi, skb,
+ WMI_TWT_ADD_DIALOG_CMDID);
+ if (ret) {
+ ath11k_warn(ab, "Failed to send WMI_TWT_ADD_DIALOG_CMDID");
+ dev_kfree_skb(skb);
+ }
+ return ret;
+}
+
+int
+ath11k_wmi_send_twt_del_dialog_cmd(struct ath11k *ar,
+ struct wmi_twt_del_dialog_params *params)
+{
+ struct ath11k_pdev_wmi *wmi = ar->wmi;
+ struct ath11k_base *ab = wmi->wmi_ab->ab;
+ struct wmi_twt_del_dialog_params_cmd *cmd;
+ struct sk_buff *skb;
+ int ret, len;
+
+ len = sizeof(*cmd);
+
+ skb = ath11k_wmi_alloc_skb(wmi->wmi_ab, len);
+ if (!skb)
+ return -ENOMEM;
+
+ cmd = (void *)skb->data;
+ cmd->tlv_header = FIELD_PREP(WMI_TLV_TAG,
+ WMI_TAG_TWT_DEL_DIALOG_CMD) |
+ FIELD_PREP(WMI_TLV_LEN, len - TLV_HDR_SIZE);
+
+ cmd->vdev_id = params->vdev_id;
+ ether_addr_copy(cmd->peer_macaddr.addr, params->peer_macaddr);
+ cmd->dialog_id = params->dialog_id;
+
+ ret = ath11k_wmi_cmd_send(wmi, skb,
+ WMI_TWT_DEL_DIALOG_CMDID);
+ if (ret) {
+ ath11k_warn(ab, "Failed to send WMI_TWT_DEL_DIALOG_CMDID");
+ dev_kfree_skb(skb);
+ }
+ return ret;
+}
+
+int
+ath11k_wmi_send_twt_pause_dialog_cmd(struct ath11k *ar,
+ struct wmi_twt_pause_dialog_params *params)
+{
+ struct ath11k_pdev_wmi *wmi = ar->wmi;
+ struct ath11k_base *ab = wmi->wmi_ab->ab;
+ struct wmi_twt_pause_dialog_params_cmd *cmd;
+ struct sk_buff *skb;
+ int ret, len;
+
+ len = sizeof(*cmd);
+
+ skb = ath11k_wmi_alloc_skb(wmi->wmi_ab, len);
+ if (!skb)
+ return -ENOMEM;
+
+ cmd = (void *)skb->data;
+ cmd->tlv_header = FIELD_PREP(WMI_TLV_TAG,
+ WMI_TAG_TWT_PAUSE_DIALOG_CMD) |
+ FIELD_PREP(WMI_TLV_LEN, len - TLV_HDR_SIZE);
+
+ cmd->vdev_id = params->vdev_id;
+ ether_addr_copy(cmd->peer_macaddr.addr, params->peer_macaddr);
+ cmd->dialog_id = params->dialog_id;
+
+ ret = ath11k_wmi_cmd_send(wmi, skb,
+ WMI_TWT_PAUSE_DIALOG_CMDID);
+ if (ret) {
+ ath11k_warn(ab, "Failed to send WMI_TWT_PAUSE_DIALOG_CMDID");
+ dev_kfree_skb(skb);
+ }
+ return ret;
+}
+
+int
+ath11k_wmi_send_twt_resume_dialog_cmd(struct ath11k *ar,
+ struct wmi_twt_resume_dialog_params *params)
+{
+ struct ath11k_pdev_wmi *wmi = ar->wmi;
+ struct ath11k_base *ab = wmi->wmi_ab->ab;
+ struct wmi_twt_resume_dialog_params_cmd *cmd;
+ struct sk_buff *skb;
+ int ret, len;
+
+ len = sizeof(*cmd);
+
+ skb = ath11k_wmi_alloc_skb(wmi->wmi_ab, len);
+ if (!skb)
+ return -ENOMEM;
+
+ cmd = (void *)skb->data;
+ cmd->tlv_header = FIELD_PREP(WMI_TLV_TAG,
+ WMI_TAG_TWT_RESUME_DIALOG_CMD) |
+ FIELD_PREP(WMI_TLV_LEN, len - TLV_HDR_SIZE);
+
+ cmd->vdev_id = params->vdev_id;
+ ether_addr_copy(cmd->peer_macaddr.addr, params->peer_macaddr);
+ cmd->dialog_id = params->dialog_id;
+ cmd->sp_offset_us = params->sp_offset_us;
+ cmd->next_twt_size = params->next_twt_size;
+
+ ret = ath11k_wmi_cmd_send(wmi, skb,
+ WMI_TWT_RESUME_DIALOG_CMDID);
+ if (ret) {
+ ath11k_warn(ab, "Failed to send WMI_TWT_RESUME_DIALOG_CMDID");
+ dev_kfree_skb(skb);
+ }
+ return ret;
+}
+
int
ath11k_wmi_send_obss_spr_cmd(struct ath11k *ar, u32 vdev_id,
struct ieee80211_he_obss_pd *he_obss_pd)
@@ -2851,7 +3004,7 @@ int ath11k_wmi_wait_for_unified_ready(struct ath11k_base *ab)
int ath11k_wmi_cmd_init(struct ath11k_base *ab)
{
- struct ath11k_wmi_base *wmi_sc = &ab->wmi_ab;
+ struct ath11k_wmi_base *wmi_ab = &ab->wmi_ab;
struct wmi_init_cmd_param init_param;
struct target_resource_config config;
@@ -2903,21 +3056,21 @@ int ath11k_wmi_cmd_init(struct ath11k_base *ab)
config.twt_ap_pdev_count = 2;
config.twt_ap_sta_count = 1000;
- memcpy(&wmi_sc->wlan_resource_config, &config, sizeof(config));
+ memcpy(&wmi_ab->wlan_resource_config, &config, sizeof(config));
- init_param.res_cfg = &wmi_sc->wlan_resource_config;
- init_param.num_mem_chunks = wmi_sc->num_mem_chunks;
- init_param.hw_mode_id = wmi_sc->preferred_hw_mode;
- init_param.mem_chunks = wmi_sc->mem_chunks;
+ init_param.res_cfg = &wmi_ab->wlan_resource_config;
+ init_param.num_mem_chunks = wmi_ab->num_mem_chunks;
+ init_param.hw_mode_id = wmi_ab->preferred_hw_mode;
+ init_param.mem_chunks = wmi_ab->mem_chunks;
- if (wmi_sc->preferred_hw_mode == WMI_HOST_HW_MODE_SINGLE)
+ if (wmi_ab->preferred_hw_mode == WMI_HOST_HW_MODE_SINGLE)
init_param.hw_mode_id = WMI_HOST_HW_MODE_MAX;
init_param.num_band_to_mac = ab->num_radios;
ath11k_fill_band_to_mac_param(ab, init_param.band_to_mac);
- return ath11k_init_cmd_send(&wmi_sc->wmi[0], &init_param);
+ return ath11k_init_cmd_send(&wmi_ab->wmi[0], &init_param);
}
static int ath11k_wmi_tlv_hw_mode_caps_parse(struct ath11k_base *soc,
@@ -5511,6 +5664,37 @@ ath11k_wmi_pdev_dfs_radar_detected_event(struct ath11k_base *ab, struct sk_buff
kfree(tb);
}
+static void ath11k_wmi_twt_add_dialog_event(struct ath11k_base *ab, struct sk_buff *skb)
+{
+ const char *status[] = {
+ "OK", "TWT_NOT_ENABLED", "USED_DIALOG_ID", "INVALID_PARAM",
+ "NOT_READY", "NO_RESOURCE", "NO_ACK", "NO_RESPONSE",
+ "DENIED", "UNKNOWN_ERROR"
+ };
+ const void **tb;
+ const struct wmi_twt_add_dialog_event *ev;
+ int ret;
+
+ tb = ath11k_wmi_tlv_parse_alloc(ab, skb->data, skb->len, GFP_ATOMIC);
+ if (IS_ERR(tb)) {
+ ret = PTR_ERR(tb);
+ ath11k_warn(ab, "failed to parse tlv: %d\n", ret);
+ return;
+ }
+
+ ev = tb[WMI_TAG_TWT_ADD_DIALOG_COMPLETE_EVENT];
+ if (!ev) {
+ ath11k_warn(ab, "failed to fetch twt add dialog ev");
+ goto exit;
+ }
+
+ ath11k_info(ab, "TWT Add Dialog Event - Status: %s, DialogId: %d, VdevId: %d\n",
+ status[ev->status], ev->vdev_id, ev->dialog_id);
+
+exit:
+ kfree(tb);
+}
+
static void ath11k_wmi_tlv_op_rx(struct ath11k_base *ab, struct sk_buff *skb)
{
struct wmi_cmd_hdr *cmd_hdr;
@@ -5588,12 +5772,18 @@ static void ath11k_wmi_tlv_op_rx(struct ath11k_base *ab, struct sk_buff *skb)
case WMI_PDEV_CSA_SWITCH_COUNT_STATUS_EVENTID:
ath11k_wmi_pdev_csa_switch_count_status_event(ab, skb);
break;
+ case WMI_TWT_ADD_DIALOG_EVENTID:
+ ath11k_wmi_twt_add_dialog_event(ab, skb);
+ break;
/* add Unsupported events here */
case WMI_TBTTOFFSET_EXT_UPDATE_EVENTID:
case WMI_VDEV_DELETE_RESP_EVENTID:
case WMI_PEER_OPER_MODE_CHANGE_EVENTID:
case WMI_TWT_ENABLE_EVENTID:
case WMI_TWT_DISABLE_EVENTID:
+ case WMI_TWT_DEL_DIALOG_EVENTID:
+ case WMI_TWT_PAUSE_DIALOG_EVENTID:
+ case WMI_TWT_RESUME_DIALOG_EVENTID:
ath11k_dbg(ab, ATH11K_DBG_WMI,
"ignoring unsupported event 0x%x\n", id);
break;
diff --git a/drivers/net/wireless/ath/ath11k/wmi.h b/drivers/net/wireless/ath/ath11k/wmi.h
index ab983aac604b..6e0be33bd37c 100644
--- a/drivers/net/wireless/ath/ath11k/wmi.h
+++ b/drivers/net/wireless/ath/ath11k/wmi.h
@@ -4569,6 +4569,112 @@ struct wmi_twt_disable_params_cmd {
u32 pdev_id;
};
+enum WMI_HOST_TWT_COMMAND {
+ WMI_HOST_TWT_COMMAND_REQUEST_TWT = 0,
+ WMI_HOST_TWT_COMMAND_SUGGEST_TWT,
+ WMI_HOST_TWT_COMMAND_DEMAND_TWT,
+ WMI_HOST_TWT_COMMAND_TWT_GROUPING,
+ WMI_HOST_TWT_COMMAND_ACCEPT_TWT,
+ WMI_HOST_TWT_COMMAND_ALTERNATE_TWT,
+ WMI_HOST_TWT_COMMAND_DICTATE_TWT,
+ WMI_HOST_TWT_COMMAND_REJECT_TWT,
+};
+
+#define WMI_TWT_ADD_DIALOG_FLAG_BCAST BIT(8)
+#define WMI_TWT_ADD_DIALOG_FLAG_TRIGGER BIT(9)
+#define WMI_TWT_ADD_DIALOG_FLAG_FLOW_TYPE BIT(10)
+#define WMI_TWT_ADD_DIALOG_FLAG_PROTECTION BIT(11)
+
+struct wmi_twt_add_dialog_params_cmd {
+ u32 tlv_header;
+ u32 vdev_id;
+ struct wmi_mac_addr peer_macaddr;
+ u32 dialog_id;
+ u32 wake_intvl_us;
+ u32 wake_intvl_mantis;
+ u32 wake_dura_us;
+ u32 sp_offset_us;
+ u32 flags;
+};
+
+struct wmi_twt_add_dialog_params {
+ u32 vdev_id;
+ u8 peer_macaddr[ETH_ALEN];
+ u32 dialog_id;
+ u32 wake_intvl_us;
+ u32 wake_intvl_mantis;
+ u32 wake_dura_us;
+ u32 sp_offset_us;
+ u8 twt_cmd;
+ u8 flag_bcast;
+ u8 flag_trigger;
+ u8 flag_flow_type;
+ u8 flag_protection;
+};
+
+enum wmi_twt_add_dialog_status {
+ WMI_ADD_TWT_STATUS_OK,
+ WMI_ADD_TWT_STATUS_TWT_NOT_ENABLED,
+ WMI_ADD_TWT_STATUS_USED_DIALOG_ID,
+ WMI_ADD_TWT_STATUS_INVALID_PARAM,
+ WMI_ADD_TWT_STATUS_NOT_READY,
+ WMI_ADD_TWT_STATUS_NO_RESOURCE,
+ WMI_ADD_TWT_STATUS_NO_ACK,
+ WMI_ADD_TWT_STATUS_NO_RESPONSE,
+ WMI_ADD_TWT_STATUS_DENIED,
+ WMI_ADD_TWT_STATUS_UNKNOWN_ERROR,
+};
+
+struct wmi_twt_add_dialog_event {
+ u32 vdev_id;
+ struct wmi_mac_addr peer_macaddr;
+ u32 dialog_id;
+ u32 status;
+};
+
+struct wmi_twt_del_dialog_params {
+ u32 vdev_id;
+ u8 peer_macaddr[ETH_ALEN];
+ u32 dialog_id;
+};
+
+struct wmi_twt_del_dialog_params_cmd {
+ u32 tlv_header;
+ u32 vdev_id;
+ struct wmi_mac_addr peer_macaddr;
+ u32 dialog_id;
+};
+
+struct wmi_twt_pause_dialog_params {
+ u32 vdev_id;
+ u8 peer_macaddr[ETH_ALEN];
+ u32 dialog_id;
+};
+
+struct wmi_twt_pause_dialog_params_cmd {
+ u32 tlv_header;
+ u32 vdev_id;
+ struct wmi_mac_addr peer_macaddr;
+ u32 dialog_id;
+};
+
+struct wmi_twt_resume_dialog_params {
+ u32 vdev_id;
+ u8 peer_macaddr[ETH_ALEN];
+ u32 dialog_id;
+ u32 sp_offset_us;
+ u32 next_twt_size;
+};
+
+struct wmi_twt_resume_dialog_params_cmd {
+ u32 tlv_header;
+ u32 vdev_id;
+ struct wmi_mac_addr peer_macaddr;
+ u32 dialog_id;
+ u32 sp_offset_us;
+ u32 next_twt_size;
+};
+
struct wmi_obss_spatial_reuse_params_cmd {
u32 tlv_header;
u32 pdev_id;
@@ -4766,6 +4872,14 @@ void ath11k_wmi_fw_stats_fill(struct ath11k *ar,
int ath11k_wmi_simulate_radar(struct ath11k *ar);
int ath11k_wmi_send_twt_enable_cmd(struct ath11k *ar, u32 pdev_id);
int ath11k_wmi_send_twt_disable_cmd(struct ath11k *ar, u32 pdev_id);
+int ath11k_wmi_send_twt_add_dialog_cmd(struct ath11k *ar,
+ struct wmi_twt_add_dialog_params *params);
+int ath11k_wmi_send_twt_del_dialog_cmd(struct ath11k *ar,
+ struct wmi_twt_del_dialog_params *params);
+int ath11k_wmi_send_twt_pause_dialog_cmd(struct ath11k *ar,
+ struct wmi_twt_pause_dialog_params *params);
+int ath11k_wmi_send_twt_resume_dialog_cmd(struct ath11k *ar,
+ struct wmi_twt_resume_dialog_params *params);
int ath11k_wmi_send_obss_spr_cmd(struct ath11k *ar, u32 vdev_id,
struct ieee80211_he_obss_pd *he_obss_pd);
#endif
--
2.20.1
_______________________________________________
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH V2 3/3] ath11k: add debugfs for TWT debug calls
2019-11-20 19:28 [PATCH V2 1/3] ath11k: rename ath11k_wmi_base instances from wmi_sc to wmi_ab John Crispin
2019-11-20 19:28 ` [PATCH V2 2/3] ath11k: add WMI calls to manually add/del/pause/resume TWT dialogs John Crispin
@ 2019-11-20 19:28 ` John Crispin
2019-11-29 8:31 ` [PATCH V2 1/3] ath11k: rename ath11k_wmi_base instances from wmi_sc to wmi_ab Kalle Valo
2 siblings, 0 replies; 4+ messages in thread
From: John Crispin @ 2019-11-20 19:28 UTC (permalink / raw)
To: Kalle Valo; +Cc: ath11k, John Crispin
These new debugfs files allow us to manually add/del/pause/resume TWT
dialogs for test/debug purposes.
Signed-off-by: John Crispin <john@phrozen.org>
---
drivers/net/wireless/ath/ath11k/core.h | 1 +
drivers/net/wireless/ath/ath11k/debug.c | 197 ++++++++++++++++++++++++
drivers/net/wireless/ath/ath11k/debug.h | 8 +
drivers/net/wireless/ath/ath11k/mac.c | 4 +
4 files changed, 210 insertions(+)
diff --git a/drivers/net/wireless/ath/ath11k/core.h b/drivers/net/wireless/ath/ath11k/core.h
index 90b78360bb07..3120d553893c 100644
--- a/drivers/net/wireless/ath/ath11k/core.h
+++ b/drivers/net/wireless/ath/ath11k/core.h
@@ -216,6 +216,7 @@ struct ath11k_vif {
int num_legacy_stations;
int rtscts_prot_mode;
int txpower;
+ struct dentry *debugfs_twt;
};
struct ath11k_vif_iter {
diff --git a/drivers/net/wireless/ath/ath11k/debug.c b/drivers/net/wireless/ath/ath11k/debug.c
index c27fffd13a5d..bcae14e5de9f 100644
--- a/drivers/net/wireless/ath/ath11k/debug.c
+++ b/drivers/net/wireless/ath/ath11k/debug.c
@@ -104,6 +104,203 @@ void ath11k_dbg_dump(struct ath11k_base *ab,
#endif
+#ifdef CONFIG_MAC80211_DEBUGFS
+static ssize_t ath11k_write_twt_add_dialog(struct file *file,
+ const char __user *ubuf,
+ size_t count, loff_t *ppos)
+{
+ struct ath11k_vif *arvif = file->private_data;
+ struct wmi_twt_add_dialog_params params = { 0 };
+ u8 buf[128] = {0};
+ int ret;
+
+ ret = simple_write_to_buffer(buf, sizeof(buf) - 1, ppos, ubuf, count);
+ if (ret < 0)
+ return ret;
+
+ buf[ret] = '\0';
+ ret = sscanf(buf, "%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx %u %u %u %u %u %hhu %hhu %hhu %hhu %hhu",
+ ¶ms.peer_macaddr[0],
+ ¶ms.peer_macaddr[1],
+ ¶ms.peer_macaddr[2],
+ ¶ms.peer_macaddr[3],
+ ¶ms.peer_macaddr[4],
+ ¶ms.peer_macaddr[5],
+ ¶ms.dialog_id,
+ ¶ms.wake_intvl_us,
+ ¶ms.wake_intvl_mantis,
+ ¶ms.wake_dura_us,
+ ¶ms.sp_offset_us,
+ ¶ms.twt_cmd,
+ ¶ms.flag_bcast,
+ ¶ms.flag_trigger,
+ ¶ms.flag_flow_type,
+ ¶ms.flag_protection);
+ if (ret != 16)
+ return -EINVAL;
+
+ params.vdev_id = arvif->vdev_id;
+
+ ret = ath11k_wmi_send_twt_add_dialog_cmd(arvif->ar, ¶ms);
+
+ return ret ? ret : count;
+}
+
+static ssize_t ath11k_write_twt_del_dialog(struct file *file,
+ const char __user *ubuf,
+ size_t count, loff_t *ppos)
+{
+ struct ath11k_vif *arvif = file->private_data;
+ struct wmi_twt_del_dialog_params params = { 0 };
+ u8 buf[64] = {0};
+ int ret;
+
+ ret = simple_write_to_buffer(buf, sizeof(buf) - 1, ppos, ubuf, count);
+ if (ret < 0)
+ return ret;
+
+ buf[ret] = '\0';
+ ret = sscanf(buf, "%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx %u",
+ ¶ms.peer_macaddr[0],
+ ¶ms.peer_macaddr[1],
+ ¶ms.peer_macaddr[2],
+ ¶ms.peer_macaddr[3],
+ ¶ms.peer_macaddr[4],
+ ¶ms.peer_macaddr[5],
+ ¶ms.dialog_id);
+ if (ret != 7)
+ return -EINVAL;
+
+ params.vdev_id = arvif->vdev_id;
+
+ ret = ath11k_wmi_send_twt_del_dialog_cmd(arvif->ar, ¶ms);
+
+ return ret ? ret : count;
+}
+
+static ssize_t ath11k_write_twt_pause_dialog(struct file *file,
+ const char __user *ubuf,
+ size_t count, loff_t *ppos)
+{
+ struct ath11k_vif *arvif = file->private_data;
+ struct wmi_twt_pause_dialog_params params = { 0 };
+ u8 buf[64] = {0};
+ int ret;
+
+ ret = simple_write_to_buffer(buf, sizeof(buf) - 1, ppos, ubuf, count);
+ if (ret < 0)
+ return ret;
+
+ buf[ret] = '\0';
+ ret = sscanf(buf, "%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx %u",
+ ¶ms.peer_macaddr[0],
+ ¶ms.peer_macaddr[1],
+ ¶ms.peer_macaddr[2],
+ ¶ms.peer_macaddr[3],
+ ¶ms.peer_macaddr[4],
+ ¶ms.peer_macaddr[5],
+ ¶ms.dialog_id);
+ if (ret != 7)
+ return -EINVAL;
+
+ params.vdev_id = arvif->vdev_id;
+
+ ret = ath11k_wmi_send_twt_pause_dialog_cmd(arvif->ar, ¶ms);
+
+ return ret ? ret : count;
+}
+
+static ssize_t ath11k_write_twt_resume_dialog(struct file *file,
+ const char __user *ubuf,
+ size_t count, loff_t *ppos)
+{
+ struct ath11k_vif *arvif = file->private_data;
+ struct wmi_twt_resume_dialog_params params = { 0 };
+ u8 buf[64] = {0};
+ int ret;
+
+ ret = simple_write_to_buffer(buf, sizeof(buf) - 1, ppos, ubuf, count);
+ if (ret < 0)
+ return ret;
+ buf[ret] = '\0';
+ ret = sscanf(buf, "%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx %u %u %u",
+ ¶ms.peer_macaddr[0],
+ ¶ms.peer_macaddr[1],
+ ¶ms.peer_macaddr[2],
+ ¶ms.peer_macaddr[3],
+ ¶ms.peer_macaddr[4],
+ ¶ms.peer_macaddr[5],
+ ¶ms.dialog_id,
+ ¶ms.sp_offset_us,
+ ¶ms.next_twt_size);
+ if (ret != 9)
+ return -EINVAL;
+
+ params.vdev_id = arvif->vdev_id;
+
+ ret = ath11k_wmi_send_twt_resume_dialog_cmd(arvif->ar, ¶ms);
+
+ return ret ? ret : count;
+}
+
+static const struct file_operations ath11k_fops_twt_add_dialog = {
+ .write = ath11k_write_twt_add_dialog,
+ .open = simple_open
+};
+
+static const struct file_operations ath11k_fops_twt_del_dialog = {
+ .write = ath11k_write_twt_del_dialog,
+ .open = simple_open
+};
+
+static const struct file_operations ath11k_fops_twt_pause_dialog = {
+ .write = ath11k_write_twt_pause_dialog,
+ .open = simple_open
+};
+
+static const struct file_operations ath11k_fops_twt_resume_dialog = {
+ .write = ath11k_write_twt_resume_dialog,
+ .open = simple_open
+};
+
+void ath11k_debugfs_twt(struct ath11k_vif *arvif, bool enable)
+{
+ if (!enable && arvif->debugfs_twt) {
+ debugfs_remove_recursive(arvif->debugfs_twt);
+ arvif->debugfs_twt = NULL;
+ return;
+ }
+
+ if (arvif->debugfs_twt)
+ return;
+
+ arvif->debugfs_twt = debugfs_create_dir("twt", arvif->vif->debugfs_dir);
+ if (IS_ERR_OR_NULL(arvif->debugfs_twt)) {
+ ath11k_warn(arvif->ar->ab,
+ "failed to create twt debugfs: %p\n",
+ arvif->debugfs_twt);
+ arvif->debugfs_twt = NULL;
+ return;
+ }
+
+ debugfs_create_file("add_dialog", 0200,
+ arvif->debugfs_twt, arvif,
+ &ath11k_fops_twt_add_dialog);
+
+ debugfs_create_file("del_dialog", 0200,
+ arvif->debugfs_twt, arvif,
+ &ath11k_fops_twt_del_dialog);
+
+ debugfs_create_file("pause_dialog", 0200,
+ arvif->debugfs_twt, arvif,
+ &ath11k_fops_twt_pause_dialog);
+
+ debugfs_create_file("resume_dialog", 0200,
+ arvif->debugfs_twt, arvif,
+ &ath11k_fops_twt_resume_dialog);
+}
+#endif
+
#ifdef CONFIG_ATH11K_DEBUGFS
static void ath11k_fw_stats_pdevs_free(struct list_head *head)
{
diff --git a/drivers/net/wireless/ath/ath11k/debug.h b/drivers/net/wireless/ath/ath11k/debug.h
index a317a7bdb9a2..805e30c07e14 100644
--- a/drivers/net/wireless/ath/ath11k/debug.h
+++ b/drivers/net/wireless/ath/ath11k/debug.h
@@ -133,6 +133,14 @@ static inline void ath11k_dbg_dump(struct ath11k_base *ab,
}
#endif /* CONFIG_ATH11K_DEBUG */
+#ifdef CONFIG_MAC80211_DEBUGFS
+void ath11k_debugfs_twt(struct ath11k_vif *arvif, bool enable);
+#else
+static inline void ath11k_debugfs_twt(struct ath11k_vif *arvif, bool enable)
+{
+}
+#endif
+
#ifdef CONFIG_ATH11K_DEBUGFS
int ath11k_debug_soc_create(struct ath11k_base *ab);
void ath11k_debug_soc_destroy(struct ath11k_base *ab);
diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c
index fc9ada2caa9f..4e0800205a71 100644
--- a/drivers/net/wireless/ath/ath11k/mac.c
+++ b/drivers/net/wireless/ath/ath11k/mac.c
@@ -1920,6 +1920,8 @@ static void ath11k_mac_op_bss_info_changed(struct ieee80211_hw *hw,
ath11k_wmi_send_twt_enable_cmd(ar, ar->pdev_idx);
else
ath11k_wmi_send_twt_disable_cmd(ar, ar->pdev_idx);
+ if (vif->type == NL80211_IFTYPE_AP)
+ ath11k_debugfs_twt(arvif, info->twt_requester);
}
if (changed & BSS_CHANGED_HE_OBSS_PD)
@@ -4217,6 +4219,8 @@ static void ath11k_mac_op_remove_interface(struct ieee80211_hw *hw,
/* TODO: recal traffic pause state based on the available vdevs */
+ debugfs_remove_recursive(arvif->debugfs_twt);
+ arvif->debugfs_twt = NULL;
mutex_unlock(&ar->conf_mutex);
}
--
2.20.1
_______________________________________________
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH V2 1/3] ath11k: rename ath11k_wmi_base instances from wmi_sc to wmi_ab
2019-11-20 19:28 [PATCH V2 1/3] ath11k: rename ath11k_wmi_base instances from wmi_sc to wmi_ab John Crispin
2019-11-20 19:28 ` [PATCH V2 2/3] ath11k: add WMI calls to manually add/del/pause/resume TWT dialogs John Crispin
2019-11-20 19:28 ` [PATCH V2 3/3] ath11k: add debugfs for TWT debug calls John Crispin
@ 2019-11-29 8:31 ` Kalle Valo
2 siblings, 0 replies; 4+ messages in thread
From: Kalle Valo @ 2019-11-29 8:31 UTC (permalink / raw)
To: John Crispin; +Cc: ath11k
John Crispin <john@phrozen.org> wrote:
> This makes the code consistent with the recent sc to ab rename.
>
> Signed-off-by: John Crispin <john@phrozen.org>
Failed to apply, please rebase.
error: patch failed: drivers/net/wireless/ath/ath11k/wmi.c:2479
error: drivers/net/wireless/ath/ath11k/wmi.c: patch does not apply
stg import: Diff does not apply cleanly
3 patches set to Changes Requested.
11254749 [V2,1/3] ath11k: rename ath11k_wmi_base instances from wmi_sc to wmi_ab
11254745 [V2,2/3] ath11k: add WMI calls to manually add/del/pause/resume TWT dialogs
11254743 [V2,3/3] ath11k: add debugfs for TWT debug calls
--
https://patchwork.kernel.org/patch/11254749/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
_______________________________________________
ath11k mailing list
ath11k@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/ath11k
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-11-29 8:31 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-20 19:28 [PATCH V2 1/3] ath11k: rename ath11k_wmi_base instances from wmi_sc to wmi_ab John Crispin
2019-11-20 19:28 ` [PATCH V2 2/3] ath11k: add WMI calls to manually add/del/pause/resume TWT dialogs John Crispin
2019-11-20 19:28 ` [PATCH V2 3/3] ath11k: add debugfs for TWT debug calls John Crispin
2019-11-29 8:31 ` [PATCH V2 1/3] ath11k: rename ath11k_wmi_base instances from wmi_sc to wmi_ab Kalle Valo
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.