diff --git a/core/mac/src/pe/include/lim_session.h b/core/mac/src/pe/include/lim_session.h index 6f79b35a57c7..9626154ef6cf 100644 --- a/core/mac/src/pe/include/lim_session.h +++ b/core/mac/src/pe/include/lim_session.h @@ -219,6 +219,7 @@ typedef struct sPESession /* Added to Support BT-AMP */ uint64_t lastBeaconTimeStamp; /* RX Beacon count for the current BSS to which STA is connected. */ uint32_t currentBssBeaconCnt; + uint8_t bcon_dtim_period; uint32_t bcnLen; uint8_t *beacon; /* Used to store last beacon / probe response before assoc. */ diff --git a/core/mac/src/pe/lim/lim_utils.c b/core/mac/src/pe/lim/lim_utils.c index f622f111eb15..3ccff9e6974c 100644 --- a/core/mac/src/pe/lim/lim_utils.c +++ b/core/mac/src/pe/lim/lim_utils.c @@ -7056,6 +7056,43 @@ void lim_update_caps_info_for_bss(tpAniSirGlobal mac_ctx, pe_debug("Clearing Immed Blk Ack:no AP support"); } } +/** + * lim_send_set_dtim_period(): Send SIR_HAL_SET_DTIM_PERIOD message + * to set dtim period. + * + * @sesssion: LIM session + * @dtim_period: dtim value + * @mac_ctx: Mac context + * @return None + */ +void lim_send_set_dtim_period(tpAniSirGlobal mac_ctx, uint8_t dtim_period, + tpPESession session) +{ + struct set_dtim_params *dtim_params = NULL; + tSirRetStatus ret = eSIR_SUCCESS; + struct scheduler_msg msg = {0}; + + if (!session) { + pe_err("Inavalid parameters"); + return; + } + dtim_params = qdf_mem_malloc(sizeof(*dtim_params)); + if (!dtim_params) { + pe_err("Unable to allocate memory"); + return; + } + dtim_params->dtim_period = dtim_period; + dtim_params->session_id = session->smeSessionId; + msg.type = WMA_SET_DTIM_PERIOD; + msg.bodyptr = dtim_params; + msg.bodyval = 0; + pe_debug("Post WMA_SET_DTIM_PERIOD to WMA"); + ret = wma_post_ctrl_msg(mac_ctx, &msg); + if (eSIR_SUCCESS != ret) { + pe_err("wma_post_ctrl_msg() failed"); + qdf_mem_free(dtim_params); + } +} /** * lim_is_valid_frame(): validate RX frame using last processed frame details diff --git a/core/mac/src/pe/lim/lim_utils.h b/core/mac/src/pe/lim/lim_utils.h index 33217f7d28d6..9e2102235e11 100644 --- a/core/mac/src/pe/lim/lim_utils.h +++ b/core/mac/src/pe/lim/lim_utils.h @@ -810,6 +810,8 @@ QDF_STATUS lim_p2p_action_cnf(void *mac_ctx, qdf_nbuf_t buf, uint32_t tx_complete_success, void *params); void lim_update_caps_info_for_bss(tpAniSirGlobal mac_ctx, uint16_t *caps, uint16_t bss_caps); +void lim_send_set_dtim_period(tpAniSirGlobal mac_ctx, uint8_t dtim_period, + tpPESession session); tSirRetStatus lim_strip_ie(tpAniSirGlobal mac_ctx, uint8_t *addn_ie, uint16_t *addn_ielen, diff --git a/core/mac/src/pe/sch/sch_beacon_process.c b/core/mac/src/pe/sch/sch_beacon_process.c index 933926620b55..ae62a4e4618c 100644 --- a/core/mac/src/pe/sch/sch_beacon_process.c +++ b/core/mac/src/pe/sch/sch_beacon_process.c @@ -383,6 +383,11 @@ sch_bcn_process_sta(tpAniSirGlobal mac_ctx, qdf_mem_copy((uint8_t *) &session->lastBeaconTimeStamp, (uint8_t *) bcn->timeStamp, sizeof(uint64_t)); session->currentBssBeaconCnt++; + if (session->bcon_dtim_period != bcn->tim.dtimPeriod) { + session->bcon_dtim_period = bcn->tim.dtimPeriod; + lim_send_set_dtim_period(mac_ctx, bcn->tim.dtimPeriod, + session); + } MTRACE(mac_trace(mac_ctx, TRACE_CODE_RX_MGMT_TSF, session->peSessionId, bcn->timeStamp[0]);) MTRACE(mac_trace(mac_ctx, TRACE_CODE_RX_MGMT_TSF, diff --git a/core/mac/src/sys/legacy/src/utils/src/mac_trace.c b/core/mac/src/sys/legacy/src/utils/src/mac_trace.c index eb2870ce2201..4187bbe8c806 100644 --- a/core/mac/src/sys/legacy/src/utils/src/mac_trace.c +++ b/core/mac/src/sys/legacy/src/utils/src/mac_trace.c @@ -600,6 +600,7 @@ uint8_t *mac_trace_get_wma_msg_string(uint16_t wma_msg) CASE_RETURN_STRING(WMA_WOWL_ENTER_RSP); CASE_RETURN_STRING(WMA_WOWL_EXIT_RSP); CASE_RETURN_STRING(WMA_SET_MAX_TX_POWER_RSP); + CASE_RETURN_STRING(WMA_SET_DTIM_PERIOD); CASE_RETURN_STRING(WMA_SET_MAX_TX_POWER_PER_BAND_REQ); #ifdef FEATURE_WLAN_TDLS CASE_RETURN_STRING(WMA_SET_TDLS_LINK_ESTABLISH_REQ); diff --git a/core/wma/inc/wma_types.h b/core/wma/inc/wma_types.h index 7ad966510437..58aed37f97a6 100644 --- a/core/wma/inc/wma_types.h +++ b/core/wma/inc/wma_types.h @@ -238,6 +238,7 @@ #define WMA_SET_MAX_TX_POWER_REQ SIR_HAL_SET_MAX_TX_POWER_REQ #define WMA_SET_MAX_TX_POWER_RSP SIR_HAL_SET_MAX_TX_POWER_RSP +#define WMA_SET_DTIM_PERIOD SIR_HAL_SET_DTIM_PERIOD #define WMA_SET_MAX_TX_POWER_PER_BAND_REQ \ SIR_HAL_SET_MAX_TX_POWER_PER_BAND_REQ diff --git a/core/wma/src/wma_dev_if.c b/core/wma/src/wma_dev_if.c index bb66bbc8fc89..cec559a2b33e 100644 --- a/core/wma/src/wma_dev_if.c +++ b/core/wma/src/wma_dev_if.c @@ -3534,6 +3534,7 @@ wma_vdev_set_bss_params(tp_wma_handle wma, int vdev_id, ret = wma_vdev_set_param(wma->wmi_handle, vdev_id, WMI_VDEV_PARAM_DTIM_PERIOD, dtimPeriod); + intr[vdev_id].dtimPeriod = dtimPeriod; if (QDF_IS_STATUS_ERROR(ret)) WMA_LOGE("failed to set WMI_VDEV_PARAM_DTIM_PERIOD"); diff --git a/core/wma/src/wma_main.c b/core/wma/src/wma_main.c index 92007dd12fc5..c42a94875897 100644 --- a/core/wma/src/wma_main.c +++ b/core/wma/src/wma_main.c @@ -920,6 +920,27 @@ static int32_t wma_set_priv_cfg(tp_wma_handle wma_handle, return ret; } +/** + * wma_set_dtim_period() - set dtim period to FW + * @wma: wma handle + * @dtim_params: dtim params + * + * Return: none + */ +static void wma_set_dtim_period(tp_wma_handle wma, + struct set_dtim_params *dtim_params) +{ + struct wma_txrx_node *iface = + &wma->interfaces[dtim_params->session_id]; + if (!wma_is_vdev_valid(dtim_params->session_id)) { + WMA_LOGE("%s: invalid VDEV", __func__); + return; + } + WMA_LOGD("%s: set dtim_period %d", __func__, + dtim_params->dtim_period); + iface->dtimPeriod = dtim_params->dtim_period; + +} /** * wma_set_modulated_dtim() - function to configure modulated dtim * @wma: wma handle @@ -7552,6 +7573,11 @@ static QDF_STATUS wma_mc_process_msg(struct scheduler_msg *msg) (tpDisableUapsdParams) msg->bodyptr); qdf_mem_free(msg->bodyptr); break; + case WMA_SET_DTIM_PERIOD: + wma_set_dtim_period(wma_handle, + (struct set_dtim_params *)msg->bodyptr); + qdf_mem_free(msg->bodyptr); + break; case WMA_SET_TX_POWER_REQ: wma_set_tx_power(wma_handle, (tpMaxTxPowerParams) msg->bodyptr); break;