Kaynağa Gözat

qcacld-3.0: Update DTIM value in WMA for modulated DTIM

Update DTIM value in WMA interface for modulated DTIM
calculation

Change-Id: I090cb2f33427202edb4e4272e6ac79686fec9cf8
CRs-Fixed: 2171810
Kiran Kumar Lokere 7 yıl önce
ebeveyn
işleme
6d3a30dd48

+ 1 - 0
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. */

+ 37 - 0
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

+ 2 - 0
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,

+ 5 - 0
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,

+ 1 - 0
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);

+ 1 - 0
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

+ 1 - 0
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");
 

+ 26 - 0
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;