qcacld-3.0: Reject TWT setup if there exists another TWT session
Add support to reject the TWT setup request if there exists another TWT session with different dialog id. Change-Id: I59c0ba4279581bad14bec886d22c0ac65838ec17 CRs-Fixed: 2920494
This commit is contained in:

committed by
snandini

parent
8703e09f92
commit
1bc852f685
@@ -204,6 +204,25 @@ bool mlme_twt_is_command_in_progress(struct wlan_objmgr_psoc *psoc,
|
||||
enum wlan_twt_commands cmd,
|
||||
enum wlan_twt_commands *active_cmd);
|
||||
|
||||
/**
|
||||
* mlme_is_max_twt_sessions_reached() - Check if the maximum number of
|
||||
* TWT sessions reached or not excluding the given dialog_id
|
||||
* @psoc: Pointer to global PSOC object
|
||||
* @peer_mac: Global peer mac address
|
||||
* @dialog_id: dialog id
|
||||
*
|
||||
* Check if the number of active TWT sessions is equal to the maximum number
|
||||
* of TWT sessions supported. Only count the TWT session slot if it not
|
||||
* WLAN_ALL_SESSIONS_DIALOG_ID and dialog id is different from input dialog_id,
|
||||
* because if same dialog_id already exists in the TWT sessions, we should
|
||||
* return false since re-negotiation is supported on existing dialog_id.
|
||||
*
|
||||
* Return: True if slot is available for dialog_id, false otherwise
|
||||
*/
|
||||
bool mlme_is_max_twt_sessions_reached(struct wlan_objmgr_psoc *psoc,
|
||||
struct qdf_mac_addr *peer_mac,
|
||||
uint8_t dialog_id);
|
||||
|
||||
/**
|
||||
* mlme_is_24ghz_twt_enabled() - Get if TWT is enabled on 2.4Ghz
|
||||
* @psoc: Pointer to psoc object
|
||||
|
@@ -26,6 +26,46 @@
|
||||
#include "wlan_mlme_api.h"
|
||||
#include "wlan_mlme_twt_api.h"
|
||||
|
||||
bool mlme_is_max_twt_sessions_reached(struct wlan_objmgr_psoc *psoc,
|
||||
struct qdf_mac_addr *peer_mac,
|
||||
uint8_t dialog_id)
|
||||
{
|
||||
struct peer_mlme_priv_obj *peer_priv;
|
||||
struct wlan_objmgr_peer *peer;
|
||||
uint8_t i;
|
||||
uint8_t num_twt_sessions = 0, max_twt_sessions;
|
||||
|
||||
peer = wlan_objmgr_get_peer_by_mac(psoc, peer_mac->bytes,
|
||||
WLAN_MLME_NB_ID);
|
||||
if (!peer) {
|
||||
mlme_legacy_err("Peer object not found");
|
||||
return true;
|
||||
}
|
||||
|
||||
peer_priv = wlan_objmgr_peer_get_comp_private_obj(peer,
|
||||
WLAN_UMAC_COMP_MLME);
|
||||
if (!peer_priv) {
|
||||
wlan_objmgr_peer_release_ref(peer, WLAN_MLME_NB_ID);
|
||||
mlme_legacy_err("peer mlme component object is NULL");
|
||||
return true;
|
||||
}
|
||||
|
||||
max_twt_sessions = peer_priv->twt_ctx.num_twt_sessions;
|
||||
for (i = 0; i < max_twt_sessions; i++) {
|
||||
uint8_t existing_session_dialog_id =
|
||||
peer_priv->twt_ctx.session_info[i].dialog_id;
|
||||
|
||||
if (existing_session_dialog_id != WLAN_ALL_SESSIONS_DIALOG_ID &&
|
||||
existing_session_dialog_id != dialog_id)
|
||||
num_twt_sessions++;
|
||||
}
|
||||
wlan_objmgr_peer_release_ref(peer, WLAN_MLME_NB_ID);
|
||||
|
||||
mlme_legacy_debug("num_twt_sessions:%d max_twt_sessions:%d",
|
||||
num_twt_sessions, max_twt_sessions);
|
||||
return num_twt_sessions == max_twt_sessions;
|
||||
}
|
||||
|
||||
bool mlme_is_twt_setup_in_progress(struct wlan_objmgr_psoc *psoc,
|
||||
struct qdf_mac_addr *peer_mac,
|
||||
uint8_t dialog_id)
|
||||
|
@@ -216,6 +216,29 @@ ucfg_mlme_is_twt_setup_in_progress(struct wlan_objmgr_psoc *psoc,
|
||||
return mlme_is_twt_setup_in_progress(psoc, peer_mac, dialog_id);
|
||||
}
|
||||
|
||||
/**
|
||||
* ucfg_mlme_is_max_twt_sessions_reached() - Check if the maximum number of
|
||||
* TWT sessions reached or not excluding the given dialog_id
|
||||
* @psoc: Pointer to global PSOC object
|
||||
* @peer_mac: Global peer mac address
|
||||
* @dialog_id: dialog id
|
||||
*
|
||||
* Check if the number of active TWT sessions is equal to the maximum number
|
||||
* of TWT sessions supported. Only count the TWT session slot if it not
|
||||
* WLAN_ALL_SESSIONS_DIALOG_ID and dialog id is different from input dialog_id,
|
||||
* because if same dialog_id already exists in the TWT sessions, we should
|
||||
* return false since re-negotiation is supported on existing dialog_id.
|
||||
*
|
||||
* Return: True if slot is available for dialog_id, false otherwise
|
||||
*/
|
||||
static inline bool
|
||||
ucfg_mlme_is_max_twt_sessions_reached(struct wlan_objmgr_psoc *psoc,
|
||||
struct qdf_mac_addr *peer_mac,
|
||||
uint8_t dialog_id)
|
||||
{
|
||||
return mlme_is_max_twt_sessions_reached(psoc, peer_mac, dialog_id);
|
||||
}
|
||||
|
||||
/**
|
||||
* ucfg_mlme_twt_is_command_in_progress() - Check if given command is in
|
||||
* progress
|
||||
@@ -227,7 +250,6 @@ ucfg_mlme_is_twt_setup_in_progress(struct wlan_objmgr_psoc *psoc,
|
||||
*
|
||||
* Return: True if given command is in progress
|
||||
*/
|
||||
|
||||
static inline bool
|
||||
ucfg_mlme_twt_is_command_in_progress(struct wlan_objmgr_psoc *psoc,
|
||||
struct qdf_mac_addr *peer_mac,
|
||||
@@ -511,6 +533,14 @@ ucfg_mlme_is_twt_setup_in_progress(struct wlan_objmgr_psoc *psoc,
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline bool
|
||||
ucfg_mlme_is_max_twt_sessions_reached(struct wlan_objmgr_psoc *psoc,
|
||||
struct qdf_mac_addr *peer_mac,
|
||||
uint8_t dialog_id)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline QDF_STATUS
|
||||
ucfg_mlme_set_twt_command_in_progress(struct wlan_objmgr_psoc *psoc,
|
||||
struct qdf_mac_addr *peer_mac,
|
||||
|
@@ -1447,6 +1447,14 @@ static int hdd_twt_setup_session(struct hdd_adapter *adapter,
|
||||
hdd_send_twt_enable_cmd(adapter->hdd_ctx);
|
||||
}
|
||||
|
||||
if (ucfg_mlme_is_max_twt_sessions_reached(adapter->hdd_ctx->psoc,
|
||||
&hdd_sta_ctx->conn_info.bssid,
|
||||
params.dialog_id)) {
|
||||
hdd_err_rl("TWT add failed(dialog_id:%d), another TWT already exists (max reached)",
|
||||
params.dialog_id);
|
||||
return -EAGAIN;
|
||||
}
|
||||
|
||||
if (ucfg_mlme_is_twt_setup_in_progress(adapter->hdd_ctx->psoc,
|
||||
&hdd_sta_ctx->conn_info.bssid,
|
||||
params.dialog_id)) {
|
||||
|
Reference in New Issue
Block a user