Эх сурвалжийг харах

qcacld-3.0: Set the correct DTIM period to FW

DTIM period is configured during add_bss and is taken from scan
cache bss descriptor.Scan cache can have both probe response and
beacon frames, but the TIM IE is present only in beacon frames.
If scan cache has the probe response frame then DTIM values is
configured as 0.
Get the DTIM period value from beacon and configure it to FW.

Change-Id: I2b92e5e133a70d33987a50b6113681142bc4896a
CRs-Fixed: 1067558
Kiran Kumar Lokere 8 жил өмнө
parent
commit
92fe759c38

+ 1 - 0
core/mac/src/include/sir_params.h

@@ -631,6 +631,7 @@ typedef struct sSirMbMsgP2p {
 #define SIR_HAL_UPDATE_WEP_DEFAULT_KEY      (SIR_HAL_ITC_MSG_TYPES_BEGIN + 358)
 
 #define SIR_HAL_POWER_DBG_CMD               (SIR_HAL_ITC_MSG_TYPES_BEGIN + 362)
+#define SIR_HAL_SET_DTIM_PERIOD             (SIR_HAL_ITC_MSG_TYPES_BEGIN + 363)
 
 #define SIR_HAL_MSG_TYPES_END                (SIR_HAL_MSG_TYPES_BEGIN + 0x1FF)
 

+ 2 - 5
core/mac/src/pe/lim/lim_process_beacon_frame.c

@@ -120,16 +120,13 @@ lim_process_beacon_frame(tpAniSirGlobal mac_ctx, uint8_t *rx_pkt_info,
 	 * beacon/Pr belongs to one of the session, fill up the
 	 * following, TBD - HB couter
 	 */
-	if ((!session->lastBeaconDtimPeriod) &&
-	    (sir_compare_mac_addr(session->bssId,
-				bcn_ptr->bssid))) {
+	if (sir_compare_mac_addr(session->bssId,
+				bcn_ptr->bssid)) {
 		qdf_mem_copy((uint8_t *)&session->lastBeaconTimeStamp,
 			(uint8_t *) bcn_ptr->timeStamp,
 			sizeof(uint64_t));
 		session->lastBeaconDtimCount =
 				bcn_ptr->tim.dtimCount;
-		session->lastBeaconDtimPeriod =
-				bcn_ptr->tim.dtimPeriod;
 		session->currentBssBeaconCnt++;
 	}
 	MTRACE(mac_trace(mac_ctx,

+ 38 - 0
core/mac/src/pe/lim/lim_utils.c

@@ -7182,3 +7182,41 @@ void lim_update_caps_info_for_bss(tpAniSirGlobal mac_ctx,
 		lim_log(mac_ctx, LOG1, FL("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;
+	tSirMsgQ msg;
+
+	if (session == NULL) {
+		lim_log(mac_ctx, LOGE, FL("Inavalid parameters"));
+		return;
+	}
+	dtim_params = qdf_mem_malloc(sizeof(*dtim_params));
+	if (NULL == dtim_params) {
+		lim_log(mac_ctx, LOGP,
+			FL("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;
+	lim_log(mac_ctx, LOG1, FL("Post WMA_SET_DTIM_PERIOD to WMA"));
+	ret = wma_post_ctrl_msg(mac_ctx, &msg);
+	if (eSIR_SUCCESS != ret) {
+		lim_log(mac_ctx, LOGE, FL("wma_post_ctrl_msg() failed"));
+		qdf_mem_free(dtim_params);
+	}
+}

+ 2 - 0
core/mac/src/pe/lim/lim_utils.h

@@ -621,4 +621,6 @@ QDF_STATUS lim_p2p_action_cnf(tpAniSirGlobal mac_ctx,
 			uint32_t tx_complete_success);
 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);
 #endif /* __LIM_UTILS_H */

+ 5 - 2
core/mac/src/pe/sch/sch_beacon_process.c

@@ -393,9 +393,12 @@ sch_bcn_process_sta(tpAniSirGlobal mac_ctx,
 	qdf_mem_copy((uint8_t *) &session->lastBeaconTimeStamp,
 			(uint8_t *) bcn->timeStamp, sizeof(uint64_t));
 	session->lastBeaconDtimCount = bcn->tim.dtimCount;
-	session->lastBeaconDtimPeriod = bcn->tim.dtimPeriod;
 	session->currentBssBeaconCnt++;
-
+	if (session->lastBeaconDtimPeriod != bcn->tim.dtimPeriod) {
+		session->lastBeaconDtimPeriod = 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,

+ 10 - 0
core/wma/inc/wma_if.h

@@ -1171,6 +1171,16 @@ struct set_ie_param {
 	uint8_t *ie_ptr;
 };
 
+/**
+ * struct set_dtim_params - dtim params
+ * @session_id: SME Session ID
+ * @dtim_period: dtim period
+ */
+struct set_dtim_params {
+	uint8_t session_id;
+	uint8_t dtim_period;
+};
+
 #define DOT11_HT_IE     1
 #define DOT11_VHT_IE    2
 

+ 1 - 0
core/wma/inc/wma_types.h

@@ -231,6 +231,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_TX_POWER_REQ           SIR_HAL_SET_TX_POWER_REQ
+#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

+ 0 - 1
core/wma/src/wma_dev_if.c

@@ -3088,7 +3088,6 @@ static void wma_add_bss_sta_mode(tp_wma_handle wma, tpAddBssParams add_bss)
 		/* Save parameters later needed by WMA_ADD_STA_REQ */
 		iface->rmfEnabled = add_bss->rmfEnabled;
 		iface->beaconInterval = add_bss->beaconInterval;
-		iface->dtimPeriod = add_bss->dtimPeriod;
 		iface->llbCoexist = add_bss->llbCoexist;
 		iface->shortSlotTimeSupported = add_bss->shortSlotTimeSupported;
 		iface->nwType = add_bss->nwType;

+ 31 - 0
core/wma/src/wma_main.c

@@ -755,6 +755,32 @@ 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
+ */
+void wma_set_dtim_period(tp_wma_handle wma,
+			    struct set_dtim_params *dtim_params)
+{
+	QDF_STATUS ret;
+	uint8_t vdev_id = dtim_params->session_id;
+	struct wma_txrx_node *iface =
+		&wma->interfaces[vdev_id];
+
+	WMA_LOGI("%s: set dtim_period %d", __func__,
+			dtim_params->dtim_period);
+	iface->dtimPeriod = dtim_params->dtim_period;
+	ret = wma_vdev_set_param(wma->wmi_handle,
+			vdev_id,
+			WMI_VDEV_PARAM_LISTEN_INTERVAL,
+			dtim_params->dtim_period);
+	if (QDF_IS_STATUS_ERROR(ret))
+		WMA_LOGW("Failed to set listen interval");
+
+}
 /**
  * wma_set_modulated_dtim() - function to configure modulated dtim
  * @wma: wma handle
@@ -5614,6 +5640,11 @@ QDF_STATUS wma_mc_process_msg(void *cds_context, cds_msg_t *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;

+ 0 - 1
core/wma/src/wma_power.c

@@ -931,7 +931,6 @@ void wma_enable_sta_ps_mode(tp_wma_handle wma, tpEnablePsParams ps_req)
 			return;
 		}
 	}
-	iface->dtimPeriod = ps_req->bcnDtimPeriod;
 }
 
 /**