ath11k: resend pending patches
Subsystems (2)
cover ath11k: resend pending patches
Kalle merged ath11k into his next tree and then applied the huge backlog from patchwork. This is a resend of pending patches that no longer apply due to merge order conflicts.
John Crispin (9):
ath11k: add wmi helper for turning STA PS on/off
ath11k: disable PS for STA interfaces by default upon bringup
ath11k: drop memset when setting up a tx cmd desc
ath11k: rename ath11k_wmi_base instances from wmi_sc to wmi_ab
ath11k: add WMI calls to manually add/del/pause/resume TWT dialogs
ath11k: add debugfs for TWT debug calls
ath11k: move some tx_status parsing to debugfs code
ath11k: optimise ath11k_dp_tx_completion_handler
ath11k: optimize ath11k_hal_tx_status_parse
drivers/net/wireless/ath/ath11k/core.c | 4 +- drivers/net/wireless/ath/ath11k/core.h | 3 +- drivers/net/wireless/ath/ath11k/debug.c | 197 +++++++++ drivers/net/wireless/ath/ath11k/debug.h | 8 + drivers/net/wireless/ath/ath11k/debugfs_sta.c | 66 +-- drivers/net/wireless/ath/ath11k/dp.c | 16 +- drivers/net/wireless/ath/ath11k/dp.h | 11 +- drivers/net/wireless/ath/ath11k/dp_tx.c | 81 ++-- drivers/net/wireless/ath/ath11k/hal_tx.c | 74 +--- drivers/net/wireless/ath/ath11k/hal_tx.h | 13 +- drivers/net/wireless/ath/ath11k/htc.c | 2 +- drivers/net/wireless/ath/ath11k/mac.c | 15 +- drivers/net/wireless/ath/ath11k/testmode.c | 2 +- drivers/net/wireless/ath/ath11k/wmi.c | 388 ++++++++++++++---- drivers/net/wireless/ath/ath11k/wmi.h | 123 +++++- 15 files changed, 752 insertions(+), 251 deletions(-)
Signature · 1 line
2.20.1
PATCH RESEND 1/9 ath11k: add wmi helper for turning STA PS on/off
Add a WMI call helper to set the powersave mode of a STA interface.
--- drivers/net/wireless/ath/ath11k/wmi.c | 30 +++++++++++++++++++++++++++ drivers/net/wireless/ath/ath11k/wmi.h | 7 +++++++ 2 files changed, 37 insertions(+)
drivers/net/wireless/ath/ath11k/wmi.c +30 -0
@@ -1178,6 +1178,36 @@ int ath11k_wmi_pdev_set_param(struct ath11k *ar, u32 param_id,return ret; } +int ath11k_wmi_pdev_set_ps_mode (struct ath11k *ar,int vdev_id,u32 enable) +{ +struct ath11k_pdev_wmi *wmi = ar->wmi; +struct wmi_pdev_set_ps_mode_cmd *cmd; +struct sk_buff *skb; +int ret; + + skb =ath11k_wmi_alloc_skb (wmi->wmi_sc,sizeof (*cmd)); +if (!skb) +return -ENOMEM ; + + cmd = (struct wmi_pdev_set_ps_mode_cmd *)skb->data; + cmd->tlv_header =FIELD_PREP (WMI_TLV_TAG ,WMI_TAG_STA_POWERSAVE_MODE_CMD ) | +FIELD_PREP (WMI_TLV_LEN ,sizeof (*cmd) -TLV_HDR_SIZE ); + cmd->vdev_id = vdev_id; + cmd->sta_ps_mode = enable; + + ret =ath11k_wmi_cmd_send (wmi, skb,WMI_STA_POWERSAVE_MODE_CMDID ); +if (ret) { +ath11k_warn (ar->ab,"failed to send WMI_PDEV_SET_PARAM cmd\n" ); +dev_kfree_skb (skb); + } + +ath11k_dbg (ar->ab,ATH11K_DBG_WMI , +"WMI vdev set psmode %d vdev id %d\n" , + enable, vdev_id); + +return ret; +} +int ath11k_wmi_pdev_suspend (struct ath11k *ar,u32 suspend_opt,u32 pdev_id) {
drivers/net/wireless/ath/ath11k/wmi.h +7 -0
@@ -2827,6 +2827,12 @@ struct wmi_pdev_set_param_cmd {u32 param_value; } __packed; +struct wmi_pdev_set_ps_mode_cmd { +u32 tlv_header; +u32 vdev_id; +u32 sta_ps_mode; +} __packed; +struct wmi_pdev_suspend_cmd {u32 tlv_header;u32 pdev_id;
@@ -4682,6 +4688,7 @@ int ath11k_wmi_set_peer_param(struct ath11k *ar, const u8 *peer_addr, u32 vdev_id, u32 param_id, u32 param_val);int ath11k_wmi_pdev_set_param (struct ath11k *ar,u32 param_id,u32 param_value,u8 pdev_id); +int ath11k_wmi_pdev_set_ps_mode (struct ath11k *ar,int vdev_id,u32 enable);int ath11k_wmi_wait_for_unified_ready (struct ath11k_base *ab);int ath11k_wmi_cmd_init (struct ath11k_base *ab);int ath11k_wmi_wait_for_service_ready (struct ath11k_base *ab);
Signature · 1 line
2.20.1
Re: [RESEND 1/9] ath11k: add wmi helper for turning STA PS on/off
Quoted 4 lines · John Crispin
Add a WMI call helper to set the powersave mode of a STA interface.
Signed-off-by John Crispin <[email protected]>Signed-off-by Kalle Valo <[email protected]>
There were few new warnings:
drivers/net/wireless/ath/ath11k/debugfs_sta.c: In function 'ath11k_update_per_peer_stats_from_txcompl':drivers/net/wireless/ath/ath11k/debugfs_sta.c:138:6: warning: variable 'num_tones_in_ru' set but not used [-Wunused-but-set-variable] drivers/net/wireless/ath/ath11k/debug.c:122: line over 90 characters drivers/net/wireless/ath/ath11k/dp_tx.c:472: line over 90 characters drivers/net/wireless/ath/ath11k/wmi.c:5669: char * array declaration might be better as static const
Signature · 3 lines
https://patchwork.kernel.org/patch/11272115/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
Re: [RESEND 1/9] ath11k: add wmi helper for turning STA PS on/off
In reply to John CrispinQuoted 4 lines · John Crispin
Add a WMI call helper to set the powersave mode of a STA interface.
Signed-off-by John Crispin <[email protected]>Signed-off-by Kalle Valo <[email protected]>
There were few new warnings:
drivers/net/wireless/ath/ath11k/debugfs_sta.c: In function 'ath11k_update_per_peer_stats_from_txcompl':drivers/net/wireless/ath/ath11k/debugfs_sta.c:138:6: warning: variable 'num_tones_in_ru' set but not used [-Wunused-but-set-variable] drivers/net/wireless/ath/ath11k/debug.c:122: line over 90 characters drivers/net/wireless/ath/ath11k/dp_tx.c:472: line over 90 characters drivers/net/wireless/ath/ath11k/wmi.c:5669: char * array declaration might be better as static const
Signature · 9 lines
https://patchwork.kernel.org/patch/11272115/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches _______________________________________________ ath11k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath11k
PATCH RESEND 2/9 ath11k: disable PS for STA interfaces by default upon bringup
In reply to John CrispinAfter applying this setting the TX performance issue of STA interfaces is gone and we can see TX performance go up to ~900mbit on HE80.
--- drivers/net/wireless/ath/ath11k/mac.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/net/wireless/ath/ath11k/mac.c +7 -0
@@ -4097,6 +4097,13 @@ static int ath11k_mac_op_add_interface(struct ieee80211_hw *hw, arvif->vdev_id, ret); goto err_peer_del; } + + ret =ath11k_wmi_pdev_set_ps_mode (ar, arvif->vdev_id, false); +if (ret) { +ath11k_warn (ar->ab,"failed to disable vdev %d ps mode: %d\n" , + arvif->vdev_id, ret); + goto err_peer_del; + }break ;default :break ;
Signature · 1 line
2.20.1
PATCH RESEND 3/9 ath11k: drop memset when setting up a tx cmd desc
In reply to John CrispinThere is no point in zero'ing out the structure if we set all values in the following line.
--- drivers/net/wireless/ath/ath11k/dp_tx.c | 2 -- drivers/net/wireless/ath/ath11k/hal_tx.c | 1 + 2 files changed, 1 insertion(+), 2 deletions(-)
drivers/net/wireless/ath/ath11k/dp_tx.c +0 -2
@@ -167,8 +167,6 @@ int ath11k_dp_tx(struct ath11k *ar, struct ath11k_vif *arvif, skb_cb->vif = arvif->vif; skb_cb->ar = ar; -memset (cached_desc,0 ,HAL_TCL_DESC_LEN ); -ath11k_hal_tx_cmd_desc_setup (ab, cached_desc, &ti); hal_ring_id = tx_ring->tcl_data_ring.ring_id;
drivers/net/wireless/ath/ath11k/hal_tx.c +1 -0
@@ -71,6 +71,7 @@ void ath11k_hal_tx_cmd_desc_setup(struct ath11k_base *ab, void *cmd, ti->dscp_tid_tbl_idx) |FIELD_PREP (HAL_TCL_DATA_CMD_INFO3_SEARCH_INDEX , ti->bss_ast_hash); + tcl_cmd->info4 =0 ; }/* Commit the descriptor to hardware */
Signature · 1 line
2.20.1
PATCH RESEND 4/9 ath11k: rename ath11k_wmi_base instances from wmi_sc to wmi_ab
In reply to John CrispinThis makes the code consistent with the recent sc to ab rename.
--- 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(-)
drivers/net/wireless/ath/ath11k/core.c +2 -2
@@ -651,7 +651,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);
@@ -761,7 +761,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;
drivers/net/wireless/ath/ath11k/core.h +1 -1
@@ -578,7 +578,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;
drivers/net/wireless/ath/ath11k/htc.c +1 -1
@@ -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 ;
drivers/net/wireless/ath/ath11k/mac.c +2 -2
@@ -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 ;
@@ -5763,7 +5763,7 @@ int ath11k_mac_allocate(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? */
drivers/net/wireless/ath/ath11k/testmode.c +1 -1
@@ -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;
drivers/net/wireless/ath/ath11k/wmi.c +73 -73
541 lines not on this page · raw message
drivers/net/wireless/ath/ath11k/wmi.h +1 -1
@@ -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;
Signature · 1 line
2.20.1
PATCH RESEND 5/9 ath11k: add WMI calls to manually add/del/pause/resume TWT dialogs
In reply to John CrispinThese calls are used for debugging and will be required for WFA certification tests.
--- drivers/net/wireless/ath/ath11k/wmi.c | 218 ++++++++++++++++++++++++-- drivers/net/wireless/ath/ath11k/wmi.h | 114 ++++++++++++++ 2 files changed, 318 insertions(+), 14 deletions(-)
drivers/net/wireless/ath/ath11k/wmi.c +204 -14
@@ -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_bufint 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 *skreturn 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_buffkfree (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 ;
drivers/net/wireless/ath/ath11k/wmi.h +114 -0
126 lines not on this page · raw message
Signature · 1 line
2.20.1
Re: [RESEND 5/9] ath11k: add WMI calls to manually add/del/pause/resume TWT dialogs
Quoted 83 lines · John Crispin
These calls are used for debugging and will be required for WFA certification tests.
Signed-off-by John Crispin <[email protected]>--- drivers/net/wireless/ath/ath11k/wmi.c | 218 ++++++++++++++++++++++++-- drivers/net/wireless/ath/ath11k/wmi.h | 114 ++++++++++++++ 2 files changed, 318 insertions(+), 14 deletions(-)drivers/net/wireless/ath/ath11k/wmi.c +2
-0@@ -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_)\drivers/net/wireless/ath/ath11k/wmi.c +0
-0@@ -234,22 +236,22 @@ static int ath11k_wmi_cmd_send_nowait(struct
ath11k_pdev_wmi*wmi, structsk_buf
int ath11k_wmi_cmd_send(structath11k_pdev_wmi*wmi, structsk_buff
*skb,drivers/net/wireless/ath/ath11k/wmi.c +2
-3u32 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))drivers/net/wireless/ath/ath11k/wmi.c +1
-0+ if (ret && test_bit(ATH11K_FLAG_CRASH_FLUSH,
&wmi_ab->ab->dev_flags))drivers/net/wireless/ath/ath11k/wmi.c +1
-1ret = -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, structsk_buff*skdrivers/net/wireless/ath/ath11k/wmi.c +0
-1return 0 ; } -struct sk_buff *ath11k_wmi_alloc_skb(struct ath11k_wmi_base *wmi_sc,u32 len)
+structsk_buff*ath11k_wmi_alloc_skb(structath11k_wmi_base*wmi_ab, u32 len)
{drivers/net/wireless/ath/ath11k/wmi.c +8
-1struct 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;
drivers/net/wireless/ath/ath11k/wmi.c ath11k_wmi_send_twt_disable_cmd(struct ath11k · line 2602
Quoted 10 lines
drivers/net/wireless/ath/ath11k/wmi.c +10
-0+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;
Better to avoid void * conversion, instead it can probably be convert to the actual structure.
Quoted 17 lines
drivers/net/wireless/ath/ath11k/wmi.c +17
-0+ 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)
drivers/net/wireless/ath/ath11k/wmi.c ath11k_wmi_send_twt_disable_cmd(struct ath11k *ar, u32 pdev_id) · line 2628
Quoted 10 lines
drivers/net/wireless/ath/ath11k/wmi.c +10
-0+ 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); + }
Adding WMI debug log with all the parameters passed in this command will be helpful for debugging.
Same comments for the other WMI command handlers as well.
Quoted 237 lines
drivers/net/wireless/ath/ath11k/wmi.c +107
-0+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,drivers/net/wireless/ath/ath11k/wmi.c +8
-8struct 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, structsk_buffdrivers/net/wireless/ath/ath11k/wmi.c +1
-0kfree (tb); } +static void ath11k_wmi_twt_add_dialog_event(struct ath11k_base *ab,struct
sk_buff*skb)drivers/net/wireless/ath/ath11k/wmi.c +24
-0+{ +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",
drivers/net/wireless/ath/ath11k/wmi.c +6
-0+ 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)
{drivers/net/wireless/ath/ath11k/wmi.c +6
-0struct 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);drivers/net/wireless/ath/ath11k/wmi.c +0
-0break ;drivers/net/wireless/ath/ath11k/wmi.h +17
-0@@ -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 {
drivers/net/wireless/ath/ath11k/wmi.h struct wmi_twt_disable_params_cmd { · line 4598
Quoted 10 lines
drivers/net/wireless/ath/ath11k/wmi.h +10
-0+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; +};
Better to be marked with __packed attribute for the structures which are used in host-firmware communication. Same for other wmi command and event structures in this patch.
Vasanth
_______________________________________________
ath11k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath11k
Re: [RESEND 5/9] ath11k: add WMI calls to manually add/del/pause/resume TWT dialogs
In reply to John CrispinQuoted 83 lines · John Crispin
These calls are used for debugging and will be required for WFA certification tests.
Signed-off-by John Crispin <[email protected]>--- drivers/net/wireless/ath/ath11k/wmi.c | 218 ++++++++++++++++++++++++-- drivers/net/wireless/ath/ath11k/wmi.h | 114 ++++++++++++++ 2 files changed, 318 insertions(+), 14 deletions(-)drivers/net/wireless/ath/ath11k/wmi.c +2
-0@@ -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_)\drivers/net/wireless/ath/ath11k/wmi.c +0
-0@@ -234,22 +236,22 @@ static int ath11k_wmi_cmd_send_nowait(struct
ath11k_pdev_wmi*wmi, structsk_buf
int ath11k_wmi_cmd_send(structath11k_pdev_wmi*wmi, structsk_buff
*skb,drivers/net/wireless/ath/ath11k/wmi.c +2
-3u32 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))drivers/net/wireless/ath/ath11k/wmi.c +1
-0+ if (ret && test_bit(ATH11K_FLAG_CRASH_FLUSH,
&wmi_ab->ab->dev_flags))drivers/net/wireless/ath/ath11k/wmi.c +1
-1ret = -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, structsk_buff*skdrivers/net/wireless/ath/ath11k/wmi.c +0
-1return 0 ; } -struct sk_buff *ath11k_wmi_alloc_skb(struct ath11k_wmi_base *wmi_sc,u32 len)
+structsk_buff*ath11k_wmi_alloc_skb(structath11k_wmi_base*wmi_ab, u32 len)
{drivers/net/wireless/ath/ath11k/wmi.c +8
-1struct 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;
drivers/net/wireless/ath/ath11k/wmi.c ath11k_wmi_send_twt_disable_cmd(struct ath11k · line 2602
Quoted 10 lines
drivers/net/wireless/ath/ath11k/wmi.c +10
-0+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;
Better to avoid void * conversion, instead it can probably be convert to the actual structure.
Quoted 17 lines
drivers/net/wireless/ath/ath11k/wmi.c +17
-0+ 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)
drivers/net/wireless/ath/ath11k/wmi.c ath11k_wmi_send_twt_disable_cmd(struct ath11k *ar, u32 pdev_id) · line 2628
Quoted 10 lines
drivers/net/wireless/ath/ath11k/wmi.c +10
-0+ 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); + }
Adding WMI debug log with all the parameters passed in this command will be helpful for debugging.
Same comments for the other WMI command handlers as well.
Quoted 237 lines
drivers/net/wireless/ath/ath11k/wmi.c +107
-0+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,drivers/net/wireless/ath/ath11k/wmi.c +8
-8struct 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, structsk_buffdrivers/net/wireless/ath/ath11k/wmi.c +1
-0kfree (tb); } +static void ath11k_wmi_twt_add_dialog_event(struct ath11k_base *ab,struct
sk_buff*skb)drivers/net/wireless/ath/ath11k/wmi.c +24
-0+{ +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",
drivers/net/wireless/ath/ath11k/wmi.c +6
-0+ 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)
{drivers/net/wireless/ath/ath11k/wmi.c +6
-0struct 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);drivers/net/wireless/ath/ath11k/wmi.c +0
-0break ;drivers/net/wireless/ath/ath11k/wmi.h +17
-0@@ -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 {
drivers/net/wireless/ath/ath11k/wmi.h struct wmi_twt_disable_params_cmd { · line 4598
Quoted 10 lines
drivers/net/wireless/ath/ath11k/wmi.h +10
-0+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; +};
Better to be marked with __packed attribute for the structures which are used in host-firmware communication. Same for other wmi command and event structures in this patch.
Vasanth
PATCH RESEND 6/9 ath11k: add debugfs for TWT debug calls
In reply to John CrispinThese new debugfs files allow us to manually add/del/pause/resume TWT dialogs for test/debug purposes.
--- 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(+)
drivers/net/wireless/ath/ath11k/core.h +1 -0
@@ -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 {
drivers/net/wireless/ath/ath11k/debug.c +197 -0
203 lines not on this page · raw message
drivers/net/wireless/ath/ath11k/debug.h +8 -0
@@ -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);
drivers/net/wireless/ath/ath11k/mac.c +4 -0
@@ -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); }
Signature · 1 line
2.20.1
Re: [RESEND 6/9] ath11k: add debugfs for TWT debug calls
Quoted 3 lines · John Crispin
These new debugfs files allow us to manually add/del/pause/resume TWT dialogs for test/debug purposes.
Information such as how these debugfs entries are supposed to be used could be helpful.
Vasanth
_______________________________________________
ath11k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath11k
Re: [RESEND 6/9] ath11k: add debugfs for TWT debug calls
Quoted 7 lines · [email protected] writes:
Quoted 3 lines · John Crispin
These new debugfs files allow us to manually add/del/pause/resume TWT dialogs for test/debug purposes.
Information such as how these debugfs entries are supposed to be used could be helpful.
Yes, please always add instructions how the debugfs file is supposed to be used. Not only it helps the users but makes the review easier as well.
Signature · 6 lines
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches _______________________________________________ ath11k mailing list [email protected] http://lists.infradead.org/mailman/listinfo/ath11k
Re: [RESEND 6/9] ath11k: add debugfs for TWT debug calls
Quoted 7 lines · Kalle Valo
Quoted 5 lines · [email protected] writes:
Quoted 3 lines · John Crispin
These new debugfs files allow us to manually add/del/pause/resume TWT dialogs for test/debug purposes.
Quoted 7 lines
Quoted 2 lines
Information such as how these debugfs entries are supposed to be used could be helpful.
Yes, please always add instructions how the debugfs file is supposed to be used. Not only it helps the users but makes the review easier as well.
I did in the V3 series --> https://patchwork.kernel.org/patch/11290751/
John
Re: [RESEND 6/9] ath11k: add debugfs for TWT debug calls
In reply to John CrispinQuoted 3 lines · John Crispin
These new debugfs files allow us to manually add/del/pause/resume TWT dialogs for test/debug purposes.
Information such as how these debugfs entries are supposed to be used could be helpful.
Vasanth
PATCH RESEND 7/9 ath11k: move some tx_status parsing to debugfs code
In reply to John CrispinSome of the fields are only used by debugfs. Move the parsing of these from the data hot path to the debugfs code.
--- drivers/net/wireless/ath/ath11k/debugfs_sta.c | 66 +++++++++++-------- drivers/net/wireless/ath/ath11k/hal_tx.c | 19 +----- drivers/net/wireless/ath/ath11k/hal_tx.h | 7 +- 3 files changed, 39 insertions(+), 53 deletions(-)
drivers/net/wireless/ath/ath11k/debugfs_sta.c +37 -29
@@ -129,12 +129,17 @@ void ath11k_update_per_peer_stats_from_txcompl(struct ath11k *ar, {struct ath11k_base *ab = ar->ab;struct ath11k_per_peer_tx_stats *peer_stats = &ar->cached_stats; +enum hal_tx_rate_stats_pkt_type pkt_type; +enum hal_tx_rate_stats_sgi sgi; +enum hal_tx_rate_stats_bw bw;struct ath11k_peer *peer;struct ath11k_sta *arsta;struct ieee80211_sta *sta; +u16 num_tones_in_ru;u16 rate;u8 rate_idx;int ret; +u8 mcs;rcu_read_lock ();spin_lock_bh (&ab->base_lock);
@@ -150,51 +155,54 @@ void ath11k_update_per_peer_stats_from_txcompl(struct ath11k *ar, arsta = (struct ath11k_sta *)sta->drv_priv;memset (&arsta->txrate,0 ,sizeof (arsta->txrate)); - -if (ts->pkt_type ==HAL_TX_RATE_STATS_PKT_TYPE_11A || - ts->pkt_type ==HAL_TX_RATE_STATS_PKT_TYPE_11B ) { - ret =ath11k_mac_hw_ratecode_to_legacy_rate (ts->mcs, - ts->pkt_type, + pkt_type =FIELD_GET (HAL_TX_RATE_STATS_INFO0_PKT_TYPE , + ts->rate_stats); + mcs =FIELD_GET (HAL_TX_RATE_STATS_INFO0_MCS , + ts->rate_stats); + sgi =FIELD_GET (HAL_TX_RATE_STATS_INFO0_SGI , + ts->rate_stats); + num_tones_in_ru =FIELD_GET (HAL_TX_RATE_STATS_INFO0_TONES_IN_RU , + ts->rate_stats); + bw =FIELD_GET (HAL_TX_RATE_STATS_INFO0_BW , ts->rate_stats); + +if (pkt_type ==HAL_TX_RATE_STATS_PKT_TYPE_11A || + pkt_type ==HAL_TX_RATE_STATS_PKT_TYPE_11B ) { + ret =ath11k_mac_hw_ratecode_to_legacy_rate (mcs, + pkt_type, &rate_idx, &rate); -if (ret <0 ) { -spin_unlock_bh (&ab->base_lock); -rcu_read_unlock (); -return ; - } +if (ret <0 ) + goto err_out; arsta->txrate.legacy = rate; - }else if (ts->pkt_type ==HAL_TX_RATE_STATS_PKT_TYPE_11N ) { -if (ts->mcs >7 ) { -ath11k_warn (ab,"Invalid HT mcs index %d\n" , ts->mcs); -spin_unlock_bh (&ab->base_lock); -rcu_read_unlock (); -return ; + }else if (pkt_type ==HAL_TX_RATE_STATS_PKT_TYPE_11N ) { +if (mcs >7 ) { +ath11k_warn (ab,"Invalid HT mcs index %d\n" , mcs); + goto err_out; } - arsta->txrate.mcs = ts->mcs +8 * (arsta->last_txrate.nss -1 ); + arsta->txrate.mcs = mcs +8 * (arsta->last_txrate.nss -1 ); arsta->txrate.flags =RATE_INFO_FLAGS_MCS ; -if (ts->sgi) +if (sgi) arsta->txrate.flags |=RATE_INFO_FLAGS_SHORT_GI ; - }else if (ts->pkt_type ==HAL_TX_RATE_STATS_PKT_TYPE_11AC ) { -if (ts->mcs >9 ) { -ath11k_warn (ab,"Invalid VHT mcs index %d\n" , ts->mcs); -spin_unlock_bh (&ab->base_lock); -rcu_read_unlock (); -return ; + }else if (pkt_type ==HAL_TX_RATE_STATS_PKT_TYPE_11AC ) { +if (mcs >9 ) { +ath11k_warn (ab,"Invalid VHT mcs index %d\n" , mcs); + goto err_out; } - arsta->txrate.mcs = ts->mcs; + arsta->txrate.mcs = mcs; arsta->txrate.flags =RATE_INFO_FLAGS_VHT_MCS ; -if (ts->sgi) +if (sgi) arsta->txrate.flags |=RATE_INFO_FLAGS_SHORT_GI ; - }else { -/*TODO: update HE rates */ + }else if (pkt_type ==HAL_TX_RATE_STATS_PKT_TYPE_11AX ) { +/* TODO */ } arsta->txrate.nss = arsta->last_txrate.nss; - arsta->txrate.bw =ath11k_mac_bw_to_mac80211_bw (ts->bw); + arsta->txrate.bw =ath11k_mac_bw_to_mac80211_bw (bw);ath11k_accumulate_per_peer_tx_stats (arsta, peer_stats, rate_idx); +err_out:spin_unlock_bh (&ab->base_lock);rcu_read_unlock (); }
drivers/net/wireless/ath/ath11k/hal_tx.c +1 -18
@@ -127,24 +127,7 @@ void ath11k_hal_tx_status_parse(struct ath11k_base *ab,if (!(desc->rate_stats.info0 &HAL_TX_RATE_STATS_INFO0_VALID ))return ; - ts->flags |=HAL_TX_STATUS_FLAGS_RATE_STATS_VALID ; - ts->tsf = desc->rate_stats.tsf; - ts->bw =FIELD_GET (HAL_TX_RATE_STATS_INFO0_BW , desc->rate_stats.info0); - ts->pkt_type =FIELD_GET (HAL_TX_RATE_STATS_INFO0_PKT_TYPE , - desc->rate_stats.info0); -if (desc->rate_stats.info0 &HAL_TX_RATE_STATS_INFO0_STBC ) - ts->flags |=HAL_TX_STATUS_FLAGS_RATE_STBC ; -if (desc->rate_stats.info0 &HAL_TX_RATE_STATS_INFO0_LDPC ) - ts->flags |=HAL_TX_STATUS_FLAGS_RATE_LDPC ; -if (desc->rate_stats.info0 &HAL_TX_RATE_STATS_INFO0_OFDMA_TX ) - ts->flags |=HAL_TX_STATUS_FLAGS_OFDMA ; - - ts->sgi =FIELD_GET (HAL_TX_RATE_STATS_INFO0_SGI , - desc->rate_stats.info0); - ts->mcs =FIELD_GET (HAL_TX_RATE_STATS_INFO0_MCS , - desc->rate_stats.info0); - ts->num_tones_in_ru =FIELD_GET (HAL_TX_RATE_STATS_INFO0_TONES_IN_RU , - desc->rate_stats.info0); + ts->rate_stats = desc->rate_stats.info0; }void ath11k_hal_tx_set_dscp_tid_map (struct ath11k_base *ab,int id)
drivers/net/wireless/ath/ath11k/hal_tx.h +1 -6
@@ -51,17 +51,12 @@ struct hal_tx_status {u32 desc_id;enum hal_wbm_tqm_rel_reason status;u8 ack_rssi; -enum hal_tx_rate_stats_bw bw; -enum hal_tx_rate_stats_pkt_type pkt_type; -enum hal_tx_rate_stats_sgi sgi; -u8 mcs; -u16 num_tones_in_ru;u32 flags;/* %HAL_TX_STATUS_FLAGS_ */ -u32 tsf;u32 ppdu_id;u8 try_cnt;u8 tid;u16 peer_id; +u32 rate_stats; }; void ath11k_hal_tx_cmd_desc_setup(struct ath11k_base *ab, void *cmd,
Signature · 1 line
2.20.1
PATCH RESEND 8/9 ath11k: optimise ath11k_dp_tx_completion_handler
In reply to John Crispinthe current code does 4 memcpys for each completion frame.
1) duplicate the desc
2 + 3) inside kfifo insertion
4) kfifo remove
The code simply drops the kfifo and uses a trivial ring buffer. This requires a single memcpy for insertion. There is no removal needed as we can simply use the inserted data for processing. As the code runs inside the NAPI context it is atomic and there is no need for most of the locking.
--- drivers/net/wireless/ath/ath11k/dp.c | 16 ++++----- drivers/net/wireless/ath/ath11k/dp.h | 11 +++---- drivers/net/wireless/ath/ath11k/dp_tx.c | 41 +++++++++--------------- drivers/net/wireless/ath/ath11k/hal_tx.c | 13 -------- drivers/net/wireless/ath/ath11k/hal_tx.h | 2 -- 5 files changed, 27 insertions(+), 56 deletions(-)
drivers/net/wireless/ath/ath11k/dp.c +6 -10
@@ -3,7 +3,6 @@* Copyright (c) 2018-2019 The Linux Foundation. All rights reserved. */ -#include <linux/kfifo.h> #include "core.h" #include "dp_tx.h" #include "hal_tx.h"
@@ -828,10 +827,7 @@ void ath11k_dp_free(struct ath11k_base *ab) ath11k_dp_tx_pending_cleanup, ab);idr_destroy (&dp->tx_ring[i].txbuf_idr);spin_unlock_bh (&dp->tx_ring[i].tx_idr_lock); - -spin_lock_bh (&dp->tx_ring[i].tx_status_lock); -kfifo_free (&dp->tx_ring[i].tx_status_fifo); -spin_unlock_bh (&dp->tx_ring[i].tx_status_lock); +kfree (&dp->tx_ring[i].tx_status); }/* Deinit any SOC level resource */
@@ -871,17 +867,17 @@ int ath11k_dp_alloc(struct ath11k_base *ab)if (ret) goto fail_link_desc_cleanup; - size =roundup_pow_of_two (DP_TX_COMP_RING_SIZE ); + size =sizeof (struct hal_wbm_release_ring ) *DP_TX_COMP_RING_SIZE ;for (i =0 ; i <DP_TCL_NUM_RING_MAX ; i++) {idr_init (&dp->tx_ring[i].txbuf_idr);spin_lock_init (&dp->tx_ring[i].tx_idr_lock); dp->tx_ring[i].tcl_data_ring_id = i; -spin_lock_init (&dp->tx_ring[i].tx_status_lock); - ret =kfifo_alloc (&dp->tx_ring[i].tx_status_fifo, size, -GFP_KERNEL ); -if (ret) + dp->tx_ring[i].tx_status_head =0 ; + dp->tx_ring[i].tx_status_tail =DP_TX_COMP_RING_SIZE -1 ; + dp->tx_ring[i].tx_status =kmalloc (size,GFP_KERNEL ); +if (!dp->tx_ring[i].tx_status) goto fail_cmn_srng_cleanup; }
drivers/net/wireless/ath/ath11k/dp.h +5 -6
@@ -6,7 +6,6 @@#ifndef ATH11K_DP_H #define ATH11K_DP_H -#include <linux/kfifo.h> #include "hal_rx.h" struct ath11k_base ;
@@ -58,6 +57,8 @@ struct dp_rxdma_ring {int bufs_max; }; +#define ATH11K_TX_COMPL_NEXT (x) ((x + 1) % DP_TX_COMP_RING_SIZE) +struct dp_tx_ring {u8 tcl_data_ring_id;struct dp_srng tcl_data_ring;
@@ -65,11 +66,9 @@ struct dp_tx_ring {struct idr txbuf_idr;/* Protects txbuf_idr and num_pending */ spinlock_t tx_idr_lock; - DECLARE_KFIFO_PTR(tx_status_fifo, struct hal_wbm_release_ring); -/* lock to protect tx_status_fifo because tx_status_fifo can be -* accessed concurrently. -*/ -spinlock_t tx_status_lock; +struct hal_wbm_release_ring *tx_status; +int tx_status_head; +int tx_status_tail; };struct ath11k_pdev_mon_stats {
drivers/net/wireless/ath/ath11k/dp_tx.c +16 -25
97 lines not on this page · raw message
drivers/net/wireless/ath/ath11k/hal_tx.c +0 -13
@@ -74,19 +74,6 @@ void ath11k_hal_tx_cmd_desc_setup(struct ath11k_base *ab, void *cmd, tcl_cmd->info4 =0 ; } -/* Commit the descriptor to hardware */ -void ath11k_hal_tx_desc_sync (void *tx_desc_cached,void *hw_desc) -{ -memcpy (hw_desc +sizeof (struct hal_tlv_hdr ), tx_desc_cached, -sizeof (struct hal_tcl_data_cmd )); -} - -/* Get the descriptor status from hardware */ -void ath11k_hal_tx_status_desc_sync (void *hw_desc,void *local_desc) -{ -memcpy (local_desc, hw_desc,HAL_TX_STATUS_DESC_LEN ); -} -void ath11k_hal_tx_status_parse (struct ath11k_base *ab,struct hal_wbm_release_ring *desc,struct hal_tx_status *ts)
drivers/net/wireless/ath/ath11k/hal_tx.h +0 -2
@@ -61,11 +61,9 @@ struct hal_tx_status {void ath11k_hal_tx_cmd_desc_setup (struct ath11k_base *ab,void *cmd,struct hal_tx_info *ti); -void ath11k_hal_tx_desc_sync (void *tx_desc_cached,void *hw_desc);void ath11k_hal_tx_status_parse (struct ath11k_base *ab,struct hal_wbm_release_ring *desc,struct hal_tx_status *ts); -void ath11k_hal_tx_status_desc_sync (void *hw_desc,void *local_desc);void ath11k_hal_tx_set_dscp_tid_map (struct ath11k_base *ab,int id); int ath11k_hal_reo_cmd_send(struct ath11k_base *ab, struct hal_srng *srng, enum hal_reo_cmd_type type,
Signature · 1 line
2.20.1
PATCH RESEND 9/9 ath11k: optimize ath11k_hal_tx_status_parse
In reply to John CrispinMoving the function into dp_tx.c allows gcc to optimize the code better and also avoid chace invalidates and context switches.
--- drivers/net/wireless/ath/ath11k/dp.h | 2 +- drivers/net/wireless/ath/ath11k/dp_tx.c | 38 +++++++++++++++++++-- drivers/net/wireless/ath/ath11k/hal_tx.c | 43 ------------------------ drivers/net/wireless/ath/ath11k/hal_tx.h | 4 --- 4 files changed, 37 insertions(+), 50 deletions(-)
drivers/net/wireless/ath/ath11k/dp.h +1 -1
@@ -57,7 +57,7 @@ struct dp_rxdma_ring {int bufs_max; }; -#define ATH11K_TX_COMPL_NEXT (x) ((x + 1) % DP_TX_COMP_RING_SIZE) +#define ATH11K_TX_COMPL_NEXT (x) (((x) + 1) % DP_TX_COMP_RING_SIZE)struct dp_tx_ring {u8 tcl_data_ring_id;
drivers/net/wireless/ath/ath11k/dp_tx.c +36 -2
@@ -423,6 +423,37 @@ static void ath11k_dp_tx_complete_msdu(struct ath11k *ar,rcu_read_unlock (); } +static inline void ath11k_hal_tx_status_parse (struct ath11k_base *ab, +struct hal_wbm_release_ring *desc, +struct hal_tx_status *ts) +{ + ts->buf_rel_source = +FIELD_GET (HAL_WBM_RELEASE_INFO0_REL_SRC_MODULE , desc->info0); +if (ts->buf_rel_source !=HAL_WBM_REL_SRC_MODULE_FW && + ts->buf_rel_source !=HAL_WBM_REL_SRC_MODULE_TQM ) +return ; + +if (ts->buf_rel_source ==HAL_WBM_REL_SRC_MODULE_FW ) +return ; + + ts->status =FIELD_GET (HAL_WBM_RELEASE_INFO0_TQM_RELEASE_REASON , + desc->info0); + ts->ppdu_id =FIELD_GET (HAL_WBM_RELEASE_INFO1_TQM_STATUS_NUMBER , + desc->info1); + ts->try_cnt =FIELD_GET (HAL_WBM_RELEASE_INFO1_TRANSMIT_COUNT , + desc->info1); + ts->ack_rssi =FIELD_GET (HAL_WBM_RELEASE_INFO2_ACK_FRAME_RSSI , + desc->info2); +if (desc->info2 &HAL_WBM_RELEASE_INFO2_FIRST_MSDU ) + ts->flags |=HAL_TX_STATUS_FLAGS_FIRST_MSDU ; + ts->peer_id =FIELD_GET (HAL_WBM_RELEASE_INFO3_PEER_ID , desc->info3); + ts->tid =FIELD_GET (HAL_WBM_RELEASE_INFO3_TID , desc->info3); +if (desc->rate_stats.info0 &HAL_TX_RATE_STATS_INFO0_VALID ) + ts->rate_stats = desc->rate_stats.info0; +else + ts->rate_stats =0 ; +} +void ath11k_dp_tx_completion_handler (struct ath11k_base *ab,int ring_id) {struct ath11k *ar;
@@ -456,14 +487,17 @@ void ath11k_dp_tx_completion_handler(struct ath11k_base *ab, int ring_id)while (ATH11K_TX_COMPL_NEXT (tx_ring->tx_status_tail) != tx_ring->tx_status_head) {struct hal_wbm_release_ring *tx_status; +u32 desc_id; tx_ring->tx_status_tail =ATH11K_TX_COMPL_NEXT (tx_ring->tx_status_tail); tx_status = &tx_ring->tx_status[tx_ring->tx_status_tail];ath11k_hal_tx_status_parse (ab, tx_status, &ts); - mac_id =FIELD_GET (DP_TX_DESC_ID_MAC_ID , ts.desc_id); - msdu_id =FIELD_GET (DP_TX_DESC_ID_MSDU_ID , ts.desc_id); + desc_id =FIELD_GET (BUFFER_ADDR_INFO1_SW_COOKIE , + tx_status->buf_addr_info.info1); + mac_id =FIELD_GET (DP_TX_DESC_ID_MAC_ID , desc_id); + msdu_id =FIELD_GET (DP_TX_DESC_ID_MSDU_ID , desc_id);if (ts.buf_rel_source ==HAL_WBM_REL_SRC_MODULE_FW ) { ath11k_dp_tx_process_htt_tx_complete(ab,
drivers/net/wireless/ath/ath11k/hal_tx.c +0 -43
49 lines not on this page · raw message
drivers/net/wireless/ath/ath11k/hal_tx.h +0 -4
@@ -48,7 +48,6 @@ struct hal_tx_info {/* Tx status parsed from srng desc */ struct hal_tx_status {enum hal_wbm_rel_src_module buf_rel_source; -u32 desc_id;enum hal_wbm_tqm_rel_reason status;u8 ack_rssi;u32 flags;/* %HAL_TX_STATUS_FLAGS_ */
@@ -61,9 +60,6 @@ struct hal_tx_status {void ath11k_hal_tx_cmd_desc_setup (struct ath11k_base *ab,void *cmd,struct hal_tx_info *ti); -void ath11k_hal_tx_status_parse (struct ath11k_base *ab, -struct hal_wbm_release_ring *desc, -struct hal_tx_status *ts);void ath11k_hal_tx_set_dscp_tid_map (struct ath11k_base *ab,int id); int ath11k_hal_reo_cmd_send(struct ath11k_base *ab, struct hal_srng *srng, enum hal_reo_cmd_type type,
Signature · 1 line
2.20.1
Re: [RESEND 9/9] ath11k: optimize ath11k_hal_tx_status_parse
Quoted 31 lines · John Crispin
Moving the function into
dp_tx.callows gcc to optimize the code better and also avoid chace invalidates and context switches.Signed-off-by John Crispin <[email protected]>--- drivers/net/wireless/ath/ath11k/dp.h | 2 +- drivers/net/wireless/ath/ath11k/dp_tx.c | 38 +++++++++++++++++++-- drivers/net/wireless/ath/ath11k/hal_tx.c | 43 ------------------------ drivers/net/wireless/ath/ath11k/hal_tx.h | 4 --- 4 files changed, 37 insertions(+), 50 deletions(-)drivers/net/wireless/ath/ath11k/dp.h +1
-1@@ -57,7 +57,7 @@ struct dp_rxdma_ring {int bufs_max; }; -#define ATH11K_TX_COMPL_NEXT (x) ((x + 1) % DP_TX_COMP_RING_SIZE) +#define ATH11K_TX_COMPL_NEXT (x) (((x) + 1) % DP_TX_COMP_RING_SIZE)struct dp_tx_ring {u8 tcl_data_ring_id;drivers/net/wireless/ath/ath11k/dp_tx.c +0
-0
drivers/net/wireless/ath/ath11k/dp_tx.c static void ath11k_dp_tx_complete_msdu(struct · line 429
Quoted 7 lines
drivers/net/wireless/ath/ath11k/dp_tx.c +3
-0@@ -423,6 +423,37 @@ static void ath11k_dp_tx_complete_msdu(structath11k *ar,rcu_read_unlock (); } +static inline void ath11k_hal_tx_status_parse (struct ath11k_base *ab, +struct hal_wbm_release_ring *desc, +struct hal_tx_status *ts)
The function naming may need to be changed to be consistent with the other functions in the file.
Vasanth
_______________________________________________
ath11k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath11k
Re: [RESEND 9/9] ath11k: optimize ath11k_hal_tx_status_parse
In reply to John CrispinQuoted 31 lines · John Crispin
Moving the function into
dp_tx.callows gcc to optimize the code better and also avoid chace invalidates and context switches.Signed-off-by John Crispin <[email protected]>--- drivers/net/wireless/ath/ath11k/dp.h | 2 +- drivers/net/wireless/ath/ath11k/dp_tx.c | 38 +++++++++++++++++++-- drivers/net/wireless/ath/ath11k/hal_tx.c | 43 ------------------------ drivers/net/wireless/ath/ath11k/hal_tx.h | 4 --- 4 files changed, 37 insertions(+), 50 deletions(-)drivers/net/wireless/ath/ath11k/dp.h +1
-1@@ -57,7 +57,7 @@ struct dp_rxdma_ring {int bufs_max; }; -#define ATH11K_TX_COMPL_NEXT (x) ((x + 1) % DP_TX_COMP_RING_SIZE) +#define ATH11K_TX_COMPL_NEXT (x) (((x) + 1) % DP_TX_COMP_RING_SIZE)struct dp_tx_ring {u8 tcl_data_ring_id;drivers/net/wireless/ath/ath11k/dp_tx.c +0
-0
drivers/net/wireless/ath/ath11k/dp_tx.c static void ath11k_dp_tx_complete_msdu(struct · line 429
Quoted 7 lines
drivers/net/wireless/ath/ath11k/dp_tx.c +3
-0@@ -423,6 +423,37 @@ static void ath11k_dp_tx_complete_msdu(structath11k *ar,rcu_read_unlock (); } +static inline void ath11k_hal_tx_status_parse (struct ath11k_base *ab, +struct hal_wbm_release_ring *desc, +struct hal_tx_status *ts)
The function naming may need to be changed to be consistent with the other functions in the file.
Vasanth