Bläddra i källkod

qcacld-3.0: delete pe_session for monitor mode when iface down

Delete pe_session for monitor mode when do interface down operation.

Change-Id: I18f58906a3cff3af68558a37c2f4b3f67a8cdd22
CRs-Fixed: 2471736
Jinwei Chen 5 år sedan
förälder
incheckning
bdd977f0c2

+ 1 - 0
core/hdd/src/wlan_hdd_main.c

@@ -5596,6 +5596,7 @@ QDF_STATUS hdd_stop_adapter(struct hdd_context *hdd_ctx,
 		wlan_hdd_scan_abort(adapter);
 		hdd_deregister_hl_netdev_fc_timer(adapter);
 		hdd_deregister_tx_flow_control(adapter);
+		sme_delete_mon_session(mac_handle, adapter->vdev_id);
 		hdd_vdev_destroy(adapter);
 		break;
 

+ 12 - 0
core/mac/inc/sir_api.h

@@ -1893,6 +1893,18 @@ struct sir_create_session {
 	struct qdf_mac_addr bss_id;
 };
 
+/**
+ * struct sir_delete_session - Used for deleting session in monitor mode
+ * @type: SME host message type.
+ * @msg_len: Length of the message.
+ * @vdev_id: vdev id.
+ */
+struct sir_delete_session {
+	uint16_t type;
+	uint16_t msg_len;
+	uint8_t vdev_id;
+};
+
 /* Beacon Interval */
 struct change_bi_params {
 	uint16_t messageType;

+ 2 - 1
core/mac/inc/wni_api.h

@@ -239,7 +239,8 @@ enum eWniMsgTypes {
 	eWNI_SME_STA_CSA_CONTINUE_REQ = SIR_SME_MSG_TYPES_BEGIN + 153,
 	WNI_SME_REGISTER_BCN_REPORT_SEND_CB = SIR_SME_MSG_TYPES_BEGIN + 154,
 	eWNI_SME_ANTENNA_ISOLATION_RSP = SIR_SME_MSG_TYPES_BEGIN + 155,
-	eWNI_SME_MSG_TYPES_END = SIR_SME_MSG_TYPES_BEGIN + 156
+	eWNI_SME_MON_DEINIT_SESSION = SIR_SME_MSG_TYPES_BEGIN + 156,
+	eWNI_SME_MSG_TYPES_END = SIR_SME_MSG_TYPES_BEGIN + 157
 };
 
 typedef struct sAniCfgTxRateCtrs {

+ 10 - 0
core/mac/src/pe/include/lim_api.h

@@ -333,6 +333,16 @@ void lim_update_lost_link_info(struct mac_context *mac, struct pe_session *sessi
 void lim_mon_init_session(struct mac_context *mac_ptr,
 			  struct sir_create_session *msg);
 
+/**
+ * lim_mon_deinit_session() - delete PE session for monitor mode operation
+ * @mac_ptr: mac pointer
+ * @msg: Pointer to struct sir_delete_session type.
+ *
+ * Return: NONE
+ */
+void lim_mon_deinit_session(struct mac_context *mac_ptr,
+			    struct sir_delete_session *msg);
+
 #define limGetQosMode(pe_session, pVal) (*(pVal) = (pe_session)->limQosEnabled)
 #define limGetWmeMode(pe_session, pVal) (*(pVal) = (pe_session)->limWmeEnabled)
 #define limGetWsmMode(pe_session, pVal) (*(pVal) = (pe_session)->limWsmEnabled)

+ 11 - 0
core/mac/src/pe/lim/lim_api.c

@@ -2738,6 +2738,17 @@ void lim_mon_init_session(struct mac_context *mac_ptr,
 	psession_entry->vhtCapability = 1;
 }
 
+void lim_mon_deinit_session(struct mac_context *mac_ptr,
+			    struct sir_delete_session *msg)
+{
+	struct pe_session *session;
+
+	session = pe_find_session_by_session_id(mac_ptr, msg->vdev_id);
+
+	if (session && session->bssType == eSIR_MONITOR_MODE)
+		pe_delete_session(mac_ptr, session);
+}
+
 /**
  * lim_update_ext_cap_ie() - Update Extended capabilities IE(if present)
  *          with capabilities of Fine Time measurements(FTM) if set in driver

+ 5 - 0
core/mac/src/pe/lim/lim_process_message_queue.c

@@ -1746,6 +1746,11 @@ static void lim_process_messages(struct mac_context *mac_ctx,
 		qdf_mem_free(msg->bodyptr);
 		msg->bodyptr = NULL;
 		break;
+	case eWNI_SME_MON_DEINIT_SESSION:
+		lim_mon_deinit_session(mac_ctx, msg->bodyptr);
+		qdf_mem_free(msg->bodyptr);
+		msg->bodyptr = NULL;
+		break;
 	case SIR_HAL_P2P_NOA_ATTR_IND:
 		session_entry = &mac_ctx->lim.gpSession[0];
 		pe_debug("Received message Noa_ATTR %x",

+ 1 - 0
core/mac/src/sys/legacy/src/utils/src/mac_trace.c

@@ -352,6 +352,7 @@ uint8_t *mac_trace_get_sme_msg_string(uint16_t sme_msg)
 		CASE_RETURN_STRING(eWNI_SME_SET_ANTENNA_MODE_RESP);
 		CASE_RETURN_STRING(eWNI_SME_TSF_EVENT);
 		CASE_RETURN_STRING(eWNI_SME_MON_INIT_SESSION);
+		CASE_RETURN_STRING(eWNI_SME_MON_DEINIT_SESSION);
 		CASE_RETURN_STRING(eWNI_SME_PDEV_SET_HT_VHT_IE);
 		CASE_RETURN_STRING(eWNI_SME_SET_VDEV_IES_PER_BAND);
 		CASE_RETURN_STRING(eWNI_SME_SEND_DISASSOC_FRAME);

+ 10 - 0
core/sme/inc/sme_api.h

@@ -1713,6 +1713,16 @@ uint32_t sme_get_wni_dot11_mode(mac_handle_t mac_handle);
 QDF_STATUS sme_create_mon_session(mac_handle_t mac_handle, uint8_t *bssid,
 				  uint8_t vdev_id);
 
+/**
+ * sme_delete_mon_session() - post message to delete PE session for mon_mode
+ * operation
+ * @mac_handle: Opaque handle to the global MAC context
+ * @vdev_id: sme session id
+ *
+ * Return: QDF_STATUS_SUCCESS on success, non-zero error code on failure.
+ */
+QDF_STATUS sme_delete_mon_session(mac_handle_t mac_handle, uint8_t vdev_id);
+
 void sme_set_vdev_ies_per_band(mac_handle_t mac_handle, uint8_t vdev_id);
 void sme_set_pdev_ht_vht_ies(mac_handle_t mac_handle, bool enable2x2);
 

+ 16 - 0
core/sme/src/common/sme_api.c

@@ -12995,6 +12995,22 @@ QDF_STATUS sme_create_mon_session(mac_handle_t mac_handle, tSirMacAddr bss_id,
 	return status;
 }
 
+QDF_STATUS sme_delete_mon_session(mac_handle_t mac_handle, uint8_t vdev_id)
+{
+	QDF_STATUS status = QDF_STATUS_E_FAILURE;
+	struct sir_delete_session *msg;
+
+	msg = qdf_mem_malloc(sizeof(*msg));
+	if (msg) {
+		msg->type = eWNI_SME_MON_DEINIT_SESSION;
+		msg->vdev_id = vdev_id;
+		msg->msg_len = sizeof(*msg);
+		status = umac_send_mb_message_to_mac(msg);
+	}
+
+	return status;
+}
+
 void sme_set_chan_info_callback(mac_handle_t mac_handle,
 			void (*callback)(struct scan_chan_info *chan_info))
 {