mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-10 22:40:54 -04:00
qcacld-3.0: Reject TWT commands while scan is in progress
Reject the below TWT commands while scan is in progress: 1. TWT setup 2. TWT pause 3. TWT resume 4. TWT Nudge Also convert the wmi status code for scan in progress to vendor status. Change-Id: I2b5c2cdd23a3172913e122b5c8fd04f4bb5c3e1e CRs-Fixed: 2923282
This commit is contained in:
parent
7842e35770
commit
7ab4e8a172
1 changed files with 71 additions and 58 deletions
|
|
@ -694,6 +694,34 @@ fail:
|
|||
return qdf_status;
|
||||
}
|
||||
|
||||
static int hdd_is_twt_command_allowed(struct hdd_adapter *adapter)
|
||||
{
|
||||
struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
|
||||
struct hdd_station_ctx *hdd_sta_ctx;
|
||||
|
||||
if (adapter->device_mode != QDF_STA_MODE &&
|
||||
adapter->device_mode != QDF_P2P_CLIENT_MODE)
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
hdd_sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
|
||||
if (hdd_sta_ctx->conn_info.conn_state != eConnectionState_Associated) {
|
||||
hdd_err_rl("Invalid state, vdev %d mode %d state %d",
|
||||
adapter->vdev_id, adapter->device_mode,
|
||||
hdd_sta_ctx->conn_info.conn_state);
|
||||
return -EAGAIN;
|
||||
}
|
||||
|
||||
if (hdd_is_roaming_in_progress(hdd_ctx))
|
||||
return -EBUSY;
|
||||
|
||||
if (ucfg_scan_get_pdev_status(hdd_ctx->pdev)) {
|
||||
hdd_err_rl("Scan in progress");
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* hdd_send_inactive_session_reply - Send session state as inactive for
|
||||
* dialog ID for which setup is not done.
|
||||
|
|
@ -891,6 +919,10 @@ wmi_twt_resume_status_to_vendor_twt_status(enum WMI_HOST_RESUME_TWT_STATUS statu
|
|||
return QCA_WLAN_VENDOR_TWT_STATUS_UNKNOWN_ERROR;
|
||||
case WMI_HOST_RESUME_TWT_STATUS_CHAN_SW_IN_PROGRESS:
|
||||
return QCA_WLAN_VENDOR_TWT_STATUS_CHANNEL_SWITCH_IN_PROGRESS;
|
||||
case WMI_HOST_RESUME_TWT_STATUS_ROAM_IN_PROGRESS:
|
||||
return QCA_WLAN_VENDOR_TWT_STATUS_ROAMING_IN_PROGRESS;
|
||||
case WMI_HOST_RESUME_TWT_STATUS_SCAN_IN_PROGRESS:
|
||||
return QCA_WLAN_VENDOR_TWT_STATUS_SCAN_IN_PROGRESS;
|
||||
default:
|
||||
return QCA_WLAN_VENDOR_TWT_STATUS_UNKNOWN_ERROR;
|
||||
}
|
||||
|
|
@ -926,6 +958,8 @@ wmi_twt_pause_status_to_vendor_twt_status(enum WMI_HOST_PAUSE_TWT_STATUS status)
|
|||
return QCA_WLAN_VENDOR_TWT_STATUS_UNKNOWN_ERROR;
|
||||
case WMI_HOST_PAUSE_TWT_STATUS_CHAN_SW_IN_PROGRESS:
|
||||
return QCA_WLAN_VENDOR_TWT_STATUS_CHANNEL_SWITCH_IN_PROGRESS;
|
||||
case WMI_HOST_PAUSE_TWT_STATUS_ROAM_IN_PROGRESS:
|
||||
return QCA_WLAN_VENDOR_TWT_STATUS_SCAN_IN_PROGRESS;
|
||||
default:
|
||||
return QCA_WLAN_VENDOR_TWT_STATUS_UNKNOWN_ERROR;
|
||||
}
|
||||
|
|
@ -1023,6 +1057,8 @@ int wmi_twt_del_status_to_vendor_twt_status(enum WMI_HOST_DEL_TWT_STATUS status)
|
|||
return QCA_WLAN_VENDOR_TWT_STATUS_SCC_MCC_CONCURRENCY_TERMINATE;
|
||||
case WMI_HOST_DEL_TWT_STATUS_CHAN_SW_IN_PROGRESS:
|
||||
return QCA_WLAN_VENDOR_TWT_STATUS_CHANNEL_SWITCH_IN_PROGRESS;
|
||||
case WMI_HOST_DEL_TWT_STATUS_SCAN_IN_PROGRESS:
|
||||
return QCA_WLAN_VENDOR_TWT_STATUS_SCAN_IN_PROGRESS;
|
||||
default:
|
||||
return QCA_WLAN_VENDOR_TWT_STATUS_UNKNOWN_ERROR;
|
||||
}
|
||||
|
|
@ -1068,6 +1104,8 @@ wmi_twt_add_status_to_vendor_twt_status(enum WMI_HOST_ADD_TWT_STATUS status)
|
|||
return QCA_WLAN_VENDOR_TWT_STATUS_ROAMING_IN_PROGRESS;
|
||||
case WMI_HOST_ADD_TWT_STATUS_CHAN_SW_IN_PROGRESS:
|
||||
return QCA_WLAN_VENDOR_TWT_STATUS_CHANNEL_SWITCH_IN_PROGRESS;
|
||||
case WMI_HOST_ADD_TWT_STATUS_SCAN_IN_PROGRESS:
|
||||
return QCA_WLAN_VENDOR_TWT_STATUS_SCAN_IN_PROGRESS;
|
||||
default:
|
||||
return QCA_WLAN_VENDOR_TWT_STATUS_UNKNOWN_ERROR;
|
||||
}
|
||||
|
|
@ -1414,27 +1452,16 @@ static int hdd_twt_setup_session(struct hdd_adapter *adapter,
|
|||
struct nlattr *twt_param_attr)
|
||||
{
|
||||
struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
|
||||
struct hdd_station_ctx *hdd_sta_ctx = NULL;
|
||||
struct hdd_station_ctx *hdd_sta_ctx =
|
||||
WLAN_HDD_GET_STATION_CTX_PTR(adapter);
|
||||
struct wmi_twt_add_dialog_param params = {0};
|
||||
struct nlattr *tb2[QCA_WLAN_VENDOR_ATTR_TWT_SETUP_MAX + 1];
|
||||
uint32_t congestion_timeout = 0;
|
||||
int ret = 0;
|
||||
|
||||
if (adapter->device_mode != QDF_STA_MODE &&
|
||||
adapter->device_mode != QDF_P2P_CLIENT_MODE) {
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
hdd_sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
|
||||
if (hdd_sta_ctx->conn_info.conn_state != eConnectionState_Associated) {
|
||||
hdd_err_rl("Invalid state, vdev %d mode %d state %d",
|
||||
adapter->vdev_id, adapter->device_mode,
|
||||
hdd_sta_ctx->conn_info.conn_state);
|
||||
return -EAGAIN;
|
||||
}
|
||||
|
||||
if (hdd_is_roaming_in_progress(hdd_ctx))
|
||||
return -EBUSY;
|
||||
ret = hdd_is_twt_command_allowed(adapter);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
if (hdd_twt_setup_conc_allowed(hdd_ctx, adapter->vdev_id)) {
|
||||
hdd_err_rl("TWT setup reject: SCC or MCC concurrency exists");
|
||||
|
|
@ -1715,6 +1742,7 @@ static int hdd_twt_terminate_session(struct hdd_adapter *adapter,
|
|||
struct nlattr *twt_param_attr)
|
||||
{
|
||||
struct hdd_station_ctx *hdd_sta_ctx = NULL;
|
||||
struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
|
||||
struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_TWT_SETUP_MAX + 1];
|
||||
struct wmi_twt_del_dialog_param params = {0};
|
||||
QDF_STATUS status;
|
||||
|
|
@ -1722,22 +1750,30 @@ static int hdd_twt_terminate_session(struct hdd_adapter *adapter,
|
|||
int ret;
|
||||
|
||||
if (adapter->device_mode != QDF_STA_MODE &&
|
||||
adapter->device_mode != QDF_P2P_CLIENT_MODE) {
|
||||
adapter->device_mode != QDF_P2P_CLIENT_MODE)
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
hdd_sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
|
||||
if (hdd_sta_ctx->conn_info.conn_state != eConnectionState_Associated) {
|
||||
hdd_err_rl("Invalid state, vdev %d mode %d state %d",
|
||||
adapter->vdev_id, adapter->device_mode,
|
||||
hdd_sta_ctx->conn_info.conn_state);
|
||||
|
||||
/*
|
||||
* Return success, since STA is not associated and
|
||||
* there is no TWT session.
|
||||
* Return success, since STA is not associated and there is
|
||||
* no TWT session.
|
||||
*/
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (hdd_is_roaming_in_progress(hdd_ctx))
|
||||
return -EBUSY;
|
||||
|
||||
if (ucfg_scan_get_pdev_status(hdd_ctx->pdev)) {
|
||||
hdd_err_rl("Scan in progress");
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
qdf_mem_copy(params.peer_macaddr,
|
||||
hdd_sta_ctx->conn_info.bssid.bytes,
|
||||
QDF_MAC_ADDR_SIZE);
|
||||
|
|
@ -2046,25 +2082,17 @@ int hdd_send_twt_pause_dialog_cmd(struct hdd_context *hdd_ctx,
|
|||
static int hdd_twt_pause_session(struct hdd_adapter *adapter,
|
||||
struct nlattr *twt_param_attr)
|
||||
{
|
||||
struct hdd_station_ctx *hdd_sta_ctx;
|
||||
struct hdd_station_ctx *hdd_sta_ctx =
|
||||
WLAN_HDD_GET_STATION_CTX_PTR(adapter);
|
||||
struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_TWT_SETUP_MAX + 1];
|
||||
struct wmi_twt_pause_dialog_cmd_param params = {0};
|
||||
QDF_STATUS status;
|
||||
int id;
|
||||
int ret;
|
||||
|
||||
if (adapter->device_mode != QDF_STA_MODE &&
|
||||
adapter->device_mode != QDF_P2P_CLIENT_MODE) {
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
hdd_sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
|
||||
if (hdd_sta_ctx->conn_info.conn_state != eConnectionState_Associated) {
|
||||
hdd_err_rl("Invalid state, vdev %d mode %d state %d",
|
||||
adapter->vdev_id, adapter->device_mode,
|
||||
hdd_sta_ctx->conn_info.conn_state);
|
||||
return -EAGAIN;
|
||||
}
|
||||
ret = hdd_is_twt_command_allowed(adapter);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
qdf_mem_copy(params.peer_macaddr, hdd_sta_ctx->conn_info.bssid.bytes,
|
||||
QDF_MAC_ADDR_SIZE);
|
||||
|
|
@ -2142,7 +2170,8 @@ int hdd_send_twt_nudge_dialog_cmd(struct hdd_context *hdd_ctx,
|
|||
static int hdd_twt_nudge_session(struct hdd_adapter *adapter,
|
||||
struct nlattr *twt_param_attr)
|
||||
{
|
||||
struct hdd_station_ctx *hdd_sta_ctx;
|
||||
struct hdd_station_ctx *hdd_sta_ctx =
|
||||
WLAN_HDD_GET_STATION_CTX_PTR(adapter);
|
||||
struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_TWT_NUDGE_MAX + 1];
|
||||
struct wmi_twt_nudge_dialog_cmd_param params = {0};
|
||||
QDF_STATUS status;
|
||||
|
|
@ -2150,18 +2179,9 @@ static int hdd_twt_nudge_session(struct hdd_adapter *adapter,
|
|||
int ret;
|
||||
bool is_nudge_tgt_cap_enabled;
|
||||
|
||||
if (adapter->device_mode != QDF_STA_MODE &&
|
||||
adapter->device_mode != QDF_P2P_CLIENT_MODE) {
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
hdd_sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
|
||||
if (hdd_sta_ctx->conn_info.conn_state != eConnectionState_Associated) {
|
||||
hdd_err_rl("Invalid state, vdev %d mode %d state %d",
|
||||
adapter->vdev_id, adapter->device_mode,
|
||||
hdd_sta_ctx->conn_info.conn_state);
|
||||
return -EAGAIN;
|
||||
}
|
||||
ret = hdd_is_twt_command_allowed(adapter);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ucfg_mlme_get_twt_nudge_tgt_cap(adapter->hdd_ctx->psoc,
|
||||
&is_nudge_tgt_cap_enabled);
|
||||
|
|
@ -2522,25 +2542,18 @@ static int hdd_twt_get_capabilities(struct hdd_adapter *adapter,
|
|||
static int hdd_twt_resume_session(struct hdd_adapter *adapter,
|
||||
struct nlattr *twt_param_attr)
|
||||
{
|
||||
struct hdd_station_ctx *hdd_sta_ctx;
|
||||
struct hdd_station_ctx *hdd_sta_ctx =
|
||||
WLAN_HDD_GET_STATION_CTX_PTR(adapter);
|
||||
struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_TWT_RESUME_MAX + 1];
|
||||
struct wmi_twt_resume_dialog_cmd_param params = {0};
|
||||
QDF_STATUS status;
|
||||
int id, id2;
|
||||
int ret;
|
||||
|
||||
if (adapter->device_mode != QDF_STA_MODE &&
|
||||
adapter->device_mode != QDF_P2P_CLIENT_MODE) {
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
ret = hdd_is_twt_command_allowed(adapter);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
hdd_sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
|
||||
if (hdd_sta_ctx->conn_info.conn_state != eConnectionState_Associated) {
|
||||
hdd_err_rl("Invalid state, vdev %d mode %d state %d",
|
||||
adapter->vdev_id, adapter->device_mode,
|
||||
hdd_sta_ctx->conn_info.conn_state);
|
||||
return -EAGAIN;
|
||||
}
|
||||
qdf_mem_copy(params.peer_macaddr, hdd_sta_ctx->conn_info.bssid.bytes,
|
||||
QDF_MAC_ADDR_SIZE);
|
||||
params.vdev_id = adapter->vdev_id;
|
||||
|
|
|
|||
Loading…
Reference in a new issue