From 4f849e503222abb0d9f56eee1fd95a4d39d16c74 Mon Sep 17 00:00:00 2001 From: Varun Reddy Yeturu Date: Fri, 15 Jun 2018 18:08:37 -0700 Subject: [PATCH] qcacld-3.0: Send Peer TWT caps in PEER ASSOC Parse the association response frame to read the peer TWT extended capabilities and fill them in the WMI PEER ASSOC command and send it to the firmware. Change-Id: I07f21010abbdaa20e212abae127009dd11e6ab7d CRs-Fixed: 2264690 --- core/mac/src/include/parser_api.h | 6 +++--- core/mac/src/pe/include/lim_session.h | 4 ++++ core/mac/src/pe/lim/lim_assoc_utils.c | 21 +++++++++++++++++++ .../src/pe/lim/lim_process_assoc_rsp_frame.c | 1 + .../src/pe/lim/lim_send_management_frames.c | 8 +++++++ core/mac/src/pe/lim/lim_utils.c | 12 +++++++++++ core/mac/src/pe/lim/lim_utils.h | 9 ++++++++ .../src/sys/legacy/src/utils/src/parser_api.c | 11 +++++----- core/wma/inc/wma_if.h | 4 ++++ core/wma/inc/wma_twt.h | 15 +++++++++++++ core/wma/src/wma_mgmt.c | 2 ++ core/wma/src/wma_twt.c | 8 +++++++ 12 files changed, 93 insertions(+), 8 deletions(-) diff --git a/core/mac/src/include/parser_api.h b/core/mac/src/include/parser_api.h index d26c17f7d7bb..5722c7e2a0a8 100644 --- a/core/mac/src/include/parser_api.h +++ b/core/mac/src/include/parser_api.h @@ -1215,7 +1215,7 @@ static inline QDF_STATUS populate_dot11f_he_bss_color_change( * populate_dot11f_twt_extended_caps() - populate TWT extended capabilities * @mac_ctx: Global MAC context. * @pe_session: Pointer to the PE session. - * @p_ext_cap: Pointer to the extended capabilities of the session. + * @dot11f: Pointer to the extended capabilities of the session. * * Populate the TWT extended capabilities based on the target and INI support. * @@ -1223,12 +1223,12 @@ static inline QDF_STATUS populate_dot11f_he_bss_color_change( */ tSirRetStatus populate_dot11f_twt_extended_caps(tpAniSirGlobal mac_ctx, tpPESession pe_session, - struct s_ext_cap *p_ext_cap); + tDot11fIEExtCap *dot11f); #else static inline tSirRetStatus populate_dot11f_twt_extended_caps(tpAniSirGlobal mac_ctx, tpPESession pe_session, - struct s_ext_cap *p_ext_cap) + tDot11fIEExtCap *dot11f) { return QDF_STATUS_SUCCESS; } diff --git a/core/mac/src/pe/include/lim_session.h b/core/mac/src/pe/include/lim_session.h index fd6b6fdfec8a..eb224a403075 100644 --- a/core/mac/src/pe/include/lim_session.h +++ b/core/mac/src/pe/include/lim_session.h @@ -555,6 +555,10 @@ typedef struct sPESession /* Added to Support BT-AMP */ enum wmi_obss_color_collision_evt_type obss_color_collision_dec_evt; bool is_session_obss_color_collision_det_enabled; int8_t def_max_tx_pwr; +#ifdef WLAN_SUPPORT_TWT + uint8_t peer_twt_requestor; + uint8_t peer_twt_responder; +#endif } tPESession, *tpPESession; /*------------------------------------------------------------------------- diff --git a/core/mac/src/pe/lim/lim_assoc_utils.c b/core/mac/src/pe/lim/lim_assoc_utils.c index 76e93c403169..e0cd9435c8df 100644 --- a/core/mac/src/pe/lim/lim_assoc_utils.c +++ b/core/mac/src/pe/lim/lim_assoc_utils.c @@ -3554,6 +3554,26 @@ static void lim_update_vht_oper_assoc_resp(tpAniSirGlobal mac_ctx, pe_debug("Updating VHT Operation in assoc Response"); } +#ifdef WLAN_SUPPORT_TWT +/** + * lim_set_sta_ctx_twt() - Save the TWT settings in STA context + * @sta_ctx: Pointer to Station Context + * @session: Pointer to PE session + * + * Return: None + */ +static void lim_set_sta_ctx_twt(tAddStaParams *sta_ctx, tpPESession session) +{ + sta_ctx->twt_requestor = session->peer_twt_requestor; + sta_ctx->twt_responder = session->peer_twt_responder; +} +#else +static inline void lim_set_sta_ctx_twt(tAddStaParams *sta_ctx, + tpPESession session) +{ +} +#endif + /** * limSendAddBss() * @@ -4098,6 +4118,7 @@ tSirRetStatus lim_sta_send_add_bss(tpAniSirGlobal pMac, tpSirAssocRsp pAssocRsp, pAddBssParams->ch_width = CH_WIDTH_10MHZ; pAddBssParams->staContext.ch_width = CH_WIDTH_10MHZ; } + lim_set_sta_ctx_twt(&pAddBssParams->staContext, psessionEntry); msgQ.type = WMA_ADD_BSS_REQ; /** @ToDo : Update the Global counter to keeptrack of the PE <--> HAL messages*/ diff --git a/core/mac/src/pe/lim/lim_process_assoc_rsp_frame.c b/core/mac/src/pe/lim/lim_process_assoc_rsp_frame.c index dae9a66dfe8b..9d6e894939c6 100644 --- a/core/mac/src/pe/lim/lim_process_assoc_rsp_frame.c +++ b/core/mac/src/pe/lim/lim_process_assoc_rsp_frame.c @@ -454,6 +454,7 @@ static void lim_update_stads_ext_cap(tpAniSirGlobal mac_ctx, ext_cap->tdls_prohibited, ext_cap->tdls_chan_swit_prohibited); #endif + lim_set_peer_twt_cap(session_entry, ext_cap); } /** diff --git a/core/mac/src/pe/lim/lim_send_management_frames.c b/core/mac/src/pe/lim/lim_send_management_frames.c index 3cd30294f81b..47daa8a5850f 100644 --- a/core/mac/src/pe/lim/lim_send_management_frames.c +++ b/core/mac/src/pe/lim/lim_send_management_frames.c @@ -1955,6 +1955,14 @@ lim_send_assoc_req_mgmt_frame(tpAniSirGlobal mac_ctx, lim_merge_extcap_struct(&frm->ExtCap, &bcn_ext_cap, false); } + /* + * TWT extended capabilities should be populated after the + * intersection of beacon caps and self caps is done because + * the bits for TWT are unique to STA and AP and cannot be + * intersected. + */ + populate_dot11f_twt_extended_caps(mac_ctx, pe_session, + &frm->ExtCap); } if (eSIR_SUCCESS != lim_strip_supp_op_class_update_struct(mac_ctx, diff --git a/core/mac/src/pe/lim/lim_utils.c b/core/mac/src/pe/lim/lim_utils.c index 977c42f4f646..34829f7d629e 100644 --- a/core/mac/src/pe/lim/lim_utils.c +++ b/core/mac/src/pe/lim/lim_utils.c @@ -6308,6 +6308,18 @@ void lim_set_stads_rtt_cap(tpDphHashNode sta_ds, struct s_ext_cap *ext_cap, ext_cap->fine_time_meas_responder); } +#ifdef WLAN_SUPPORT_TWT +void lim_set_peer_twt_cap(tpPESession session, struct s_ext_cap *ext_cap) +{ + session->peer_twt_requestor = ext_cap->twt_requestor_support; + session->peer_twt_responder = ext_cap->twt_responder_support; + + pe_debug("Ext Cap peer TWT requestor: %d, responder: %d", + ext_cap->twt_requestor_support, + ext_cap->twt_responder_support); +} +#endif + /** * lim_send_ie() - sends IE to wma * @mac_ctx: global MAC context diff --git a/core/mac/src/pe/lim/lim_utils.h b/core/mac/src/pe/lim/lim_utils.h index f6ae41974bc3..471d4dc9164d 100644 --- a/core/mac/src/pe/lim/lim_utils.h +++ b/core/mac/src/pe/lim/lim_utils.h @@ -1413,4 +1413,13 @@ QDF_STATUS lim_obss_generate_detection_config(tpAniSirGlobal mac_ctx, void lim_enable_obss_detection_config(tpAniSirGlobal mac_ctx, tpPESession session); +#ifdef WLAN_SUPPORT_TWT +void lim_set_peer_twt_cap(tpPESession session, struct s_ext_cap *ext_cap); +#else +static inline void lim_set_peer_twt_cap(tpPESession session, + struct s_ext_cap *ext_cap) +{ +} +#endif + #endif /* __LIM_UTILS_H */ diff --git a/core/mac/src/sys/legacy/src/utils/src/parser_api.c b/core/mac/src/sys/legacy/src/utils/src/parser_api.c index 2418dcc49374..07a3253a6ed4 100644 --- a/core/mac/src/sys/legacy/src/utils/src/parser_api.c +++ b/core/mac/src/sys/legacy/src/utils/src/parser_api.c @@ -1215,10 +1215,6 @@ populate_dot11f_ext_cap(tpAniSirGlobal pMac, if (psessionEntry && psessionEntry->enable_bcast_probe_rsp) p_ext_cap->fils_capability = 1; - if (psessionEntry) - populate_dot11f_twt_extended_caps(pMac, psessionEntry, - p_ext_cap); - /* Need to calculate the num_bytes based on bits set */ if (pDot11f->present) pDot11f->num_bytes = lim_compute_ext_cap_ie_length(pDot11f); @@ -6411,10 +6407,14 @@ QDF_STATUS populate_dot11f_he_bss_color_change(tpAniSirGlobal mac_ctx, #ifdef WLAN_SUPPORT_TWT tSirRetStatus populate_dot11f_twt_extended_caps(tpAniSirGlobal mac_ctx, tpPESession pe_session, - struct s_ext_cap *p_ext_cap) + tDot11fIEExtCap *dot11f) { uint32_t value = 0; tSirRetStatus status; + struct s_ext_cap *p_ext_cap; + + dot11f->num_bytes = DOT11F_IE_EXTCAP_MAX_LEN; + p_ext_cap = (struct s_ext_cap *)dot11f->bytes; if (pe_session->pePersona == QDF_STA_MODE) { CFG_GET_INT(status, mac_ctx, WNI_CFG_TWT_REQUESTOR, value); @@ -6424,6 +6424,7 @@ tSirRetStatus populate_dot11f_twt_extended_caps(tpAniSirGlobal mac_ctx, CFG_GET_INT(status, mac_ctx, WNI_CFG_TWT_RESPONDER, value); p_ext_cap->twt_responder_support = value; } + dot11f->num_bytes = lim_compute_ext_cap_ie_length(dot11f); return status; } diff --git a/core/wma/inc/wma_if.h b/core/wma/inc/wma_if.h index 95951ef8f39f..add632b40298 100644 --- a/core/wma/inc/wma_if.h +++ b/core/wma/inc/wma_if.h @@ -309,6 +309,10 @@ typedef struct { #endif uint8_t stbc_capable; uint8_t max_amsdu_num; +#ifdef WLAN_SUPPORT_TWT + uint8_t twt_requestor; + uint8_t twt_responder; +#endif } tAddStaParams, *tpAddStaParams; /** diff --git a/core/wma/inc/wma_twt.h b/core/wma/inc/wma_twt.h index 0f5d6a825684..8efec5baa5c0 100644 --- a/core/wma/inc/wma_twt.h +++ b/core/wma/inc/wma_twt.h @@ -30,12 +30,27 @@ * Return: None */ void wma_send_twt_enable_cmd(uint32_t pdev_id, uint32_t congestion_timeout); + +/** + * wma_set_twt_peer_caps() - Fill the peer TWT capabilities + * @params: STA context params which will store the capabilities + * @cmd: Command in which the capabilities should be populated + * + * Return: None + */ +void wma_set_twt_peer_caps(tpAddStaParams params, + struct peer_assoc_params *cmd); #else static inline void wma_send_twt_enable_cmd(uint32_t pdev_id, uint32_t congestion_timeout) { WMA_LOGD(FL("TWT not supported as WLAN_SUPPORT_TWT is disabled")); } + +static inline void wma_set_twt_peer_caps(tpAddStaParams params, + struct peer_assoc_params *cmd) +{ +} #endif #endif /* __WMA_HE_H */ diff --git a/core/wma/src/wma_mgmt.c b/core/wma/src/wma_mgmt.c index eb63e828630e..437e01d25fff 100644 --- a/core/wma/src/wma_mgmt.c +++ b/core/wma/src/wma_mgmt.c @@ -71,6 +71,7 @@ #include #include "wma_he.h" #include +#include "wma_twt.h" /** * wma_send_bcn_buf_ll() - prepare and send beacon buffer to fw for LL @@ -1373,6 +1374,7 @@ QDF_STATUS wma_send_peer_assoc(tp_wma_handle wma, break; } + wma_set_twt_peer_caps(params, cmd); #ifdef FEATURE_WLAN_TDLS if (STA_ENTRY_TDLS_PEER == params->staType) cmd->peer_flags |= WMI_PEER_AUTH; diff --git a/core/wma/src/wma_twt.c b/core/wma/src/wma_twt.c index 5aa9b69e21a5..88b81814c242 100644 --- a/core/wma/src/wma_twt.c +++ b/core/wma/src/wma_twt.c @@ -72,3 +72,11 @@ int wma_twt_en_complete_event_handler(void *handle, return status; } +void wma_set_twt_peer_caps(tpAddStaParams params, struct peer_assoc_params *cmd) +{ + if (params->twt_requestor) + cmd->peer_flags |= WMI_PEER_TWT_REQ; + if (params->twt_responder) + cmd->peer_flags |= WMI_PEER_TWT_RESP; +} +