Bladeren bron

qcacmn: Add support for HW mode info vendor command

Add support for HW mode info vendor command which sends
mac id, band, interface id and frequency information for
each MAC provided by driver to userspace.

Change-Id: If1112d29b8781cf5ba0480c84feeb772142f2c0e
CRs-Fixed: 2185559
Yeshwanth Sriram Guntuka 7 jaren geleden
bovenliggende
commit
e8d9e209a8

+ 26 - 0
umac/cmn_services/policy_mgr/inc/wlan_policy_mgr_api.h

@@ -2270,4 +2270,30 @@ bool policy_mgr_is_sta_connected_2g(struct wlan_objmgr_psoc *psoc);
  */
 void policy_mgr_trim_acs_channel_list(struct wlan_objmgr_psoc *psoc,
 		uint8_t *org_ch_list, uint8_t *org_ch_list_count);
+/*
+ * policy_mgr_get_connection_info() - Get info of all active connections
+ * @info: Pointer to connection info
+ *
+ * Return: Connection count
+ */
+uint32_t policy_mgr_get_connection_info(struct wlan_objmgr_psoc *psoc,
+					struct connection_info *info);
+/**
+ * policy_mgr_register_mode_change_cb() - Register mode change callback with
+ * policy manager
+ * @callback: HDD callback to be registered
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS policy_mgr_register_mode_change_cb(struct wlan_objmgr_psoc *psoc,
+			send_mode_change_event_cb mode_change_cb);
+/**
+ * policy_mgr_deregister_mode_change_cb() - Deregister mode change callback with
+ * policy manager
+ * @callback: HDD callback to be registered
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS policy_mgr_deregister_mode_change_cb(struct wlan_objmgr_psoc *psoc);
+
 #endif /* __WLAN_POLICY_MGR_API_H */

+ 18 - 0
umac/cmn_services/policy_mgr/inc/wlan_policy_mgr_public_struct.h

@@ -66,6 +66,12 @@
 #define WEIGHT_OF_NON_PCL_CHANNELS 1
 #define WEIGHT_OF_DISALLOWED_CHANNELS 0
 
+#define MAX_MAC 2
+
+#define MAX_NUMBER_OF_CONC_CONNECTIONS 3
+
+typedef int (*send_mode_change_event_cb)(void);
+
 /**
  * enum hw_mode_ss_config - Possible spatial stream configuration
  * @HW_MODE_SS_0x0: Unused Tx and Rx of MAC
@@ -1030,4 +1036,16 @@ struct dbs_nss {
 	enum hw_mode_ss_config mac0_ss;
 	enum hw_mode_ss_config mac1_ss;
 };
+
+/**
+ * struct connection_info - connection information
+ * @mac_id: The HW mac it is running
+ * @vdev_id: vdev id
+ * @channel: channel of the connection
+ */
+struct connection_info {
+	uint8_t mac_id;
+	uint8_t vdev_id;
+	uint8_t channel;
+};
 #endif /* __WLAN_POLICY_MGR_PUBLIC_STRUCT_H */

+ 10 - 0
umac/cmn_services/policy_mgr/src/wlan_policy_mgr_action.c

@@ -53,6 +53,13 @@ void policy_mgr_hw_mode_transition_cb(uint32_t old_hw_mode_index,
 	QDF_STATUS status;
 	struct policy_mgr_hw_mode_params hw_mode;
 	uint32_t i;
+	struct policy_mgr_psoc_priv_obj *pm_ctx;
+
+	pm_ctx = policy_mgr_get_context(context);
+	if (!pm_ctx) {
+		policy_mgr_err("Invalid context");
+		return;
+	}
 
 	if (!vdev_mac_map) {
 		policy_mgr_err("vdev_mac_map is NULL");
@@ -86,6 +93,9 @@ void policy_mgr_hw_mode_transition_cb(uint32_t old_hw_mode_index,
 					  vdev_mac_map,
 					  hw_mode);
 
+	if (pm_ctx->mode_change_cb)
+		pm_ctx->mode_change_cb();
+
 	return;
 }
 

+ 12 - 0
umac/cmn_services/policy_mgr/src/wlan_policy_mgr_core.c

@@ -573,6 +573,9 @@ void policy_mgr_update_conc_list(struct wlan_objmgr_psoc *psoc,
 	pm_conc_connection_list[conn_index].vdev_id = vdev_id;
 	pm_conc_connection_list[conn_index].in_use = in_use;
 
+	if (pm_ctx->mode_change_cb)
+		pm_ctx->mode_change_cb();
+
 	policy_mgr_dump_connection_status_info(psoc);
 	if (pm_ctx->cdp_cbacks.cdp_update_mac_id)
 		pm_ctx->cdp_cbacks.cdp_update_mac_id(psoc, vdev_id, mac);
@@ -764,6 +767,13 @@ void policy_mgr_pdev_set_hw_mode_cb(uint32_t status,
 	QDF_STATUS ret;
 	struct policy_mgr_hw_mode_params hw_mode;
 	uint32_t i;
+	struct policy_mgr_psoc_priv_obj *pm_ctx;
+
+	pm_ctx = policy_mgr_get_context(context);
+	if (!pm_ctx) {
+		policy_mgr_err("Invalid Context");
+		return;
+	}
 
 	policy_mgr_set_hw_mode_change_in_progress(context,
 		POLICY_MGR_HW_MODE_NOT_IN_PROGRESS);
@@ -803,6 +813,8 @@ void policy_mgr_pdev_set_hw_mode_cb(uint32_t status,
 	policy_mgr_update_hw_mode_conn_info(context, num_vdev_mac_entries,
 			vdev_mac_map,
 			hw_mode);
+	if (pm_ctx->mode_change_cb)
+		pm_ctx->mode_change_cb();
 
 	ret = policy_mgr_set_connection_update(context);
 	if (!QDF_IS_STATUS_SUCCESS(ret))

+ 28 - 0
umac/cmn_services/policy_mgr/src/wlan_policy_mgr_get_set_utils.c

@@ -2910,3 +2910,31 @@ void policy_mgr_trim_acs_channel_list(struct wlan_objmgr_psoc *psoc,
 			org_ch_list[i] = ch_list[i];
 	}
 }
+
+uint32_t policy_mgr_get_connection_info(struct wlan_objmgr_psoc *psoc,
+					struct connection_info *info)
+{
+	struct policy_mgr_psoc_priv_obj *pm_ctx;
+	uint32_t conn_index, count = 0;
+
+	pm_ctx = policy_mgr_get_context(psoc);
+	if (!pm_ctx) {
+		policy_mgr_err("Invalid Context");
+		return count;
+	}
+
+	for (conn_index = 0; conn_index < MAX_NUMBER_OF_CONC_CONNECTIONS;
+	     conn_index++) {
+		if (PM_CONC_CONNECTION_LIST_VALID_INDEX(conn_index)) {
+			info[count].vdev_id =
+				pm_conc_connection_list[conn_index].vdev_id;
+			info[count].mac_id =
+				pm_conc_connection_list[conn_index].mac;
+			info[count].channel =
+				pm_conc_connection_list[conn_index].chan;
+			count++;
+		}
+	}
+
+	return count;
+}

+ 2 - 2
umac/cmn_services/policy_mgr/src/wlan_policy_mgr_i.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2017 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2018 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -35,7 +35,6 @@
 #include "qdf_defer.h"
 #include "wlan_reg_services_api.h"
 
-#define MAX_NUMBER_OF_CONC_CONNECTIONS 3
 #define DBS_OPPORTUNISTIC_TIME    10
 #ifdef QCA_WIFI_3_0_EMU
 #define CONNECTION_UPDATE_TIMEOUT 3000
@@ -275,6 +274,7 @@ struct policy_mgr_psoc_priv_obj {
 	uint8_t cur_conc_system_pref;
 	uint8_t sta_sap_scc_on_dfs_chan_allowed;
 	qdf_event_t opportunistic_update_done_evt;
+	send_mode_change_event_cb mode_change_cb;
 };
 
 /**

+ 31 - 0
umac/cmn_services/policy_mgr/src/wlan_policy_mgr_init_deinit.c

@@ -671,3 +671,34 @@ QDF_STATUS policy_mgr_register_tdls_cb(struct wlan_objmgr_psoc *psoc,
 
 	return QDF_STATUS_SUCCESS;
 }
+
+QDF_STATUS policy_mgr_register_mode_change_cb(struct wlan_objmgr_psoc *psoc,
+	send_mode_change_event_cb mode_change_cb)
+{
+	struct policy_mgr_psoc_priv_obj *pm_ctx;
+
+	pm_ctx = policy_mgr_get_context(psoc);
+	if (!pm_ctx) {
+		policy_mgr_err("Invalid Context");
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	pm_ctx->mode_change_cb = mode_change_cb;
+
+	return QDF_STATUS_SUCCESS;
+}
+
+QDF_STATUS policy_mgr_deregister_mode_change_cb(struct wlan_objmgr_psoc *psoc)
+{
+	struct policy_mgr_psoc_priv_obj *pm_ctx;
+
+	pm_ctx = policy_mgr_get_context(psoc);
+	if (!pm_ctx) {
+		policy_mgr_err("Invalid Context");
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	pm_ctx->mode_change_cb = NULL;
+
+	return QDF_STATUS_SUCCESS;
+}