qcacld-3.0: Enhance mlme_twt_is_command_in_progress() to return active_cmd

Currently, mlme_twt_is_command_in_progress() function checks if the given
command is in progress or not. For inputs like WLAN_TWT_ANY, if this function
returns true then from the current logs, its not known which
active command in progress.

Hence for better debugging, enhance this function to return active command.

Change-Id: Ibc5c5babb042408b0e8988fe229d344ed98bfff3
CRs-Fixed: 2920494
This commit is contained in:
Srinivas Girigowda 2021-04-09 14:57:28 -07:00 • committed by snandini
commit 22d2deb4ab
5 changed files with 57 additions and 33 deletions

View file

@ -189,18 +189,20 @@ QDF_STATUS mlme_set_twt_command_in_progress(struct wlan_objmgr_psoc *psoc,
enum wlan_twt_commands cmd);
/**
* mlme_twt_is_command_in_progress() - Get TWT command in progress.
* mlme_twt_is_command_in_progress() - Check if given command is in progress
* @psoc: Pointer to psoc object
* @peer_mac: Pointer to peer mac address
* @dialog_id: Dialog id
* @cmd: TWT command
* @active_cmd: Fill the active command in this output parameter
*
* Return: True if given command is in progress.
*/
bool mlme_twt_is_command_in_progress(struct wlan_objmgr_psoc *psoc,
struct qdf_mac_addr *peer_mac,
uint8_t dialog_id,
enum wlan_twt_commands cmd);
enum wlan_twt_commands cmd,
enum wlan_twt_commands *active_cmd);
/**
* mlme_is_24ghz_twt_enabled() - Get if TWT is enabled on 2.4Ghz

View file

@ -476,7 +476,8 @@ bool mlme_is_twt_notify_in_progress(struct wlan_objmgr_psoc *psoc,
bool mlme_twt_is_command_in_progress(struct wlan_objmgr_psoc *psoc,
struct qdf_mac_addr *peer_mac,
uint8_t dialog_id,
enum wlan_twt_commands cmd)
enum wlan_twt_commands cmd,
enum wlan_twt_commands *pactive_cmd)
{
struct wlan_objmgr_peer *peer;
struct peer_mlme_priv_obj *peer_priv;
@ -501,6 +502,10 @@ bool mlme_twt_is_command_in_progress(struct wlan_objmgr_psoc *psoc,
for (i = 0; i < peer_priv->twt_ctx.num_twt_sessions; i++) {
active_cmd = peer_priv->twt_ctx.session_info[i].active_cmd;
if (pactive_cmd)
*pactive_cmd = active_cmd;
if (peer_priv->twt_ctx.session_info[i].dialog_id == dialog_id ||
dialog_id == WLAN_ALL_SESSIONS_DIALOG_ID) {
if (cmd == WLAN_TWT_ANY) {

View file

@ -217,11 +217,13 @@ ucfg_mlme_is_twt_setup_in_progress(struct wlan_objmgr_psoc *psoc,
}
/**
* ucfg_mlme_twt_is_command_in_progress() - Get TWT command in progress
* ucfg_mlme_twt_is_command_in_progress() - Check if given command is in
* progress
* @psoc: Pointer to global PSOC object
* @peer_mac: Global peer mac address
* @dialog_id: TWT session dialog id
* @cmd: TWT command
* @active_cmd: Fill active command in this output parameter
*
* Return: True if given command is in progress
*/
@ -230,9 +232,11 @@ static inline bool
ucfg_mlme_twt_is_command_in_progress(struct wlan_objmgr_psoc *psoc,
struct qdf_mac_addr *peer_mac,
uint8_t dialog_id,
enum wlan_twt_commands cmd)
enum wlan_twt_commands cmd,
enum wlan_twt_commands *active_cmd)
{
return mlme_twt_is_command_in_progress(psoc, peer_mac, dialog_id, cmd);
return mlme_twt_is_command_in_progress(psoc, peer_mac, dialog_id,
cmd, active_cmd);
}
static inline QDF_STATUS
@ -520,7 +524,8 @@ static inline bool
ucfg_mlme_twt_is_command_in_progress(struct wlan_objmgr_psoc *psoc,
struct qdf_mac_addr *peer_mac,
uint8_t dialog_id,
enum wlan_twt_commands cmd)
enum wlan_twt_commands cmd,
enum wlan_twt_commands *active_cmd)
{
return false;
}

View file

@ -2769,11 +2769,12 @@ static int hdd_twt_clear_session_traffic_stats(struct hdd_adapter *adapter,
if (ucfg_mlme_twt_is_command_in_progress(adapter->hdd_ctx->psoc,
&hdd_sta_ctx->conn_info.bssid,
WLAN_ALL_SESSIONS_DIALOG_ID,
WLAN_TWT_STATISTICS) ||
WLAN_TWT_STATISTICS, NULL) ||
ucfg_mlme_twt_is_command_in_progress(adapter->hdd_ctx->psoc,
&hdd_sta_ctx->conn_info.bssid,
WLAN_ALL_SESSIONS_DIALOG_ID,
WLAN_TWT_CLEAR_STATISTICS)) {
WLAN_TWT_CLEAR_STATISTICS,
NULL)) {
hdd_warn("Already TWT statistics or clear statistics exists");
return -EALREADY;
}
@ -2884,11 +2885,12 @@ static int hdd_twt_get_session_traffic_stats(struct hdd_adapter *adapter,
if (ucfg_mlme_twt_is_command_in_progress(adapter->hdd_ctx->psoc,
&hdd_sta_ctx->conn_info.bssid,
WLAN_ALL_SESSIONS_DIALOG_ID,
WLAN_TWT_STATISTICS) ||
WLAN_TWT_STATISTICS, NULL) ||
ucfg_mlme_twt_is_command_in_progress(adapter->hdd_ctx->psoc,
&hdd_sta_ctx->conn_info.bssid,
WLAN_ALL_SESSIONS_DIALOG_ID,
WLAN_TWT_CLEAR_STATISTICS)) {
WLAN_TWT_CLEAR_STATISTICS,
NULL)) {
hdd_warn("Already TWT statistics or clear statistics exists");
return -EALREADY;
}

View file

@ -2134,23 +2134,24 @@ sme_process_twt_add_dialog_event(struct mac_context *mac,
{
bool is_evt_allowed;
bool setup_done;
enum WMI_HOST_ADD_TWT_STATUS status;
enum WMI_HOST_ADD_TWT_STATUS status = add_dialog_event->params.status;
enum wlan_twt_commands active_cmd = WLAN_TWT_NONE;
is_evt_allowed = mlme_twt_is_command_in_progress(
mac->psoc,
(struct qdf_mac_addr *)add_dialog_event->params.peer_macaddr,
add_dialog_event->params.dialog_id, WLAN_TWT_SETUP);
add_dialog_event->params.dialog_id, WLAN_TWT_SETUP,
&active_cmd);
if (!is_evt_allowed) {
sme_debug("add dialog event dropped for id:%d",
add_dialog_event->params.dialog_id);
sme_debug("Drop TWT add dialog event for dialog_id:%d status:%d active_cmd:%d",
add_dialog_event->params.dialog_id, status, active_cmd);
return;
}
setup_done = ucfg_mlme_is_twt_setup_done(mac->psoc,
(struct qdf_mac_addr *)add_dialog_event->params.peer_macaddr,
add_dialog_event->params.dialog_id);
status = add_dialog_event->params.status;
sme_debug("setup_done: %d status: %d", setup_done, status);
sme_debug("setup_done:%d status:%d", setup_done, status);
if (setup_done && status) {
/* This is re-negotiation failure case */
@ -2192,17 +2193,18 @@ sme_process_twt_del_dialog_event(struct mac_context *mac,
{
twt_del_dialog_cb callback;
bool is_evt_allowed;
enum wlan_twt_commands active_cmd = WLAN_TWT_NONE;
is_evt_allowed = mlme_twt_is_command_in_progress(
mac->psoc, (struct qdf_mac_addr *)param->peer_macaddr,
param->dialog_id, WLAN_TWT_TERMINATE);
param->dialog_id, WLAN_TWT_TERMINATE, &active_cmd);
if (!is_evt_allowed &&
param->dialog_id != WLAN_ALL_SESSIONS_DIALOG_ID &&
param->status != WMI_HOST_DEL_TWT_STATUS_ROAMING &&
param->status != WMI_HOST_DEL_TWT_STATUS_PEER_INIT_TEARDOWN &&
param->status != WMI_HOST_DEL_TWT_STATUS_CONCURRENCY) {
sme_debug("Del dialog event dropped for id:%d status:%d",
param->dialog_id, param->status);
sme_debug("Drop TWT Del dialog event for dialog_id:%d status:%d active_cmd:%d",
param->dialog_id, param->status, active_cmd);
return;
}
@ -2278,13 +2280,14 @@ sme_process_twt_nudge_dialog_event(struct mac_context *mac,
{
twt_nudge_dialog_cb callback;
bool is_evt_allowed;
enum wlan_twt_commands active_cmd = WLAN_TWT_NONE;
is_evt_allowed = mlme_twt_is_command_in_progress(
mac->psoc, (struct qdf_mac_addr *)param->peer_macaddr,
param->dialog_id, WLAN_TWT_NUDGE);
param->dialog_id, WLAN_TWT_NUDGE, &active_cmd);
if (!is_evt_allowed &&
param->dialog_id != WLAN_ALL_SESSIONS_DIALOG_ID) {
sme_debug("Nudge event dropped");
sme_debug("Nudge event dropped active_cmd:%d", active_cmd);
return;
}
@ -14504,6 +14507,7 @@ QDF_STATUS sme_add_dialog_cmd(mac_handle_t mac_handle,
QDF_STATUS status;
void *wma_handle;
struct wmi_twt_add_dialog_param *cmd_params;
enum wlan_twt_commands active_cmd = WLAN_TWT_NONE;
SME_ENTER();
@ -14518,9 +14522,9 @@ QDF_STATUS sme_add_dialog_cmd(mac_handle_t mac_handle,
is_twt_cmd_in_progress = mlme_twt_is_command_in_progress(
mac->psoc,
(struct qdf_mac_addr *)twt_params->peer_macaddr,
twt_params->dialog_id, WLAN_TWT_ANY);
twt_params->dialog_id, WLAN_TWT_ANY, &active_cmd);
if (is_twt_cmd_in_progress) {
sme_debug("Already TWT command is in progress");
sme_debug("Already TWT command:%d is in progress", active_cmd);
return QDF_STATUS_E_PENDING;
}
@ -14592,6 +14596,7 @@ QDF_STATUS sme_del_dialog_cmd(mac_handle_t mac_handle,
QDF_STATUS status;
void *wma_handle;
struct wmi_twt_del_dialog_param *cmd_params;
enum wlan_twt_commands active_cmd = WLAN_TWT_NONE;
SME_ENTER();
@ -14599,13 +14604,14 @@ QDF_STATUS sme_del_dialog_cmd(mac_handle_t mac_handle,
mlme_twt_is_command_in_progress(
mac->psoc,
(struct qdf_mac_addr *)twt_params->peer_macaddr,
twt_params->dialog_id, WLAN_TWT_SETUP) ||
twt_params->dialog_id, WLAN_TWT_SETUP, &active_cmd) ||
mlme_twt_is_command_in_progress(
mac->psoc,
(struct qdf_mac_addr *)twt_params->peer_macaddr,
twt_params->dialog_id, WLAN_TWT_TERMINATE);
twt_params->dialog_id, WLAN_TWT_TERMINATE,
&active_cmd);
if (is_twt_cmd_in_progress) {
sme_debug("Already TWT command is in progress");
sme_debug("Already TWT command:%d is in progress", active_cmd);
return QDF_STATUS_E_PENDING;
}
@ -14667,15 +14673,16 @@ sme_pause_dialog_cmd(mac_handle_t mac_handle,
bool is_twt_cmd_in_progress;
QDF_STATUS status;
void *wma_handle;
enum wlan_twt_commands active_cmd = WLAN_TWT_NONE;
SME_ENTER();
is_twt_cmd_in_progress = mlme_twt_is_command_in_progress(
mac->psoc,
(struct qdf_mac_addr *)twt_params->peer_macaddr,
twt_params->dialog_id, WLAN_TWT_ANY);
twt_params->dialog_id, WLAN_TWT_ANY, &active_cmd);
if (is_twt_cmd_in_progress) {
sme_debug("Already TWT command is in progress");
sme_debug("Already TWT command:%d is in progress", active_cmd);
return QDF_STATUS_E_PENDING;
}
@ -14736,17 +14743,19 @@ sme_nudge_dialog_cmd(mac_handle_t mac_handle,
bool is_twt_cmd_in_progress;
QDF_STATUS status;
void *wma_handle;
enum wlan_twt_commands active_cmd = WLAN_TWT_NONE;
SME_ENTER();
is_twt_cmd_in_progress = mlme_twt_is_command_in_progress(
mac->psoc,
(struct qdf_mac_addr *)twt_params->peer_macaddr,
twt_params->dialog_id, WLAN_TWT_ANY);
twt_params->dialog_id, WLAN_TWT_ANY, &active_cmd);
if (is_twt_cmd_in_progress) {
sme_debug("Already TWT command is in progress");
sme_debug("Already TWT command:%d is in progress", active_cmd);
return QDF_STATUS_E_PENDING;
}
wma_handle = cds_get_context(QDF_MODULE_ID_WMA);
if (!wma_handle) {
sme_err("wma_handle is NULL");
@ -14804,15 +14813,16 @@ sme_resume_dialog_cmd(mac_handle_t mac_handle,
bool is_twt_cmd_in_progress;
QDF_STATUS status;
void *wma_handle;
enum wlan_twt_commands active_cmd = WLAN_TWT_NONE;
SME_ENTER();
is_twt_cmd_in_progress = mlme_twt_is_command_in_progress(
mac->psoc,
(struct qdf_mac_addr *)twt_params->peer_macaddr,
twt_params->dialog_id, WLAN_TWT_ANY);
twt_params->dialog_id, WLAN_TWT_ANY, &active_cmd);
if (is_twt_cmd_in_progress) {
sme_debug("Already TWT command is in progress");
sme_debug("Already TWT command:%d is in progress", active_cmd);
return QDF_STATUS_E_PENDING;
}