Quellcode durchsuchen

qcacld-3.0: Add connect disconnect call to osif for conection manager

Add connect and disconnect function call from hdd to osif for
connection manager to enable the connect and disconnect flow for the
connection manager.

Change-Id: I1504410cd431aedf04b58e93d9eeff34040b32a1
CRs-Fixed: 2804230
Ashish Kumar Dhanotiya vor 4 Jahren
Ursprung
Commit
f7bae329ed
2 geänderte Dateien mit 179 neuen und 0 gelöschten Zeilen
  1. 149 0
      core/hdd/src/wlan_hdd_cfg80211.c
  2. 30 0
      core/hdd/src/wlan_hdd_cfg80211.h

+ 149 - 0
core/hdd/src/wlan_hdd_cfg80211.c

@@ -167,6 +167,7 @@
 #endif
 #include "wlan_wfa_ucfg_api.h"
 #include <osif_cm_util.h>
+#include <osif_cm_req.h>
 
 #define g_mode_rates_size (12)
 #define a_mode_rates_size (8)
@@ -20838,6 +20839,112 @@ static int __wlan_hdd_cfg80211_connect(struct wiphy *wiphy,
 	return status;
 }
 
+#ifdef FEATURE_CM_ENABLE
+static void hdd_update_scan_ie_for_connect(struct hdd_adapter *adapter,
+					   struct osif_connect_params *params)
+{
+	if (adapter->device_mode == QDF_P2P_CLIENT_MODE) {
+		params->scan_ie.ptr =
+			&adapter->scan_info.scan_add_ie.addIEdata[0];
+		params->scan_ie.len = adapter->scan_info.scan_add_ie.length;
+	} else if (adapter->scan_info.default_scan_ies) {
+		params->scan_ie.ptr = adapter->scan_info.default_scan_ies;
+		params->scan_ie.len = adapter->scan_info.default_scan_ies_len;
+	} else if (adapter->scan_info.scan_add_ie.length) {
+		params->scan_ie.ptr = adapter->scan_info.scan_add_ie.addIEdata;
+		params->scan_ie.len = adapter->scan_info.scan_add_ie.length;
+	}
+}
+
+/**
+ * hdd_get_dot11mode_filter() - Get dot11 mode filter
+ * @hdd_ctx: HDD context
+ *
+ * This function is used to get the dot11 mode filter
+ *
+ * Context: Any Context.
+ * Return: dot11_mode_filter
+ */
+static enum dot11_mode_filter
+hdd_get_dot11mode_filter(struct hdd_context *hdd_ctx)
+{
+	struct hdd_config *config = hdd_ctx->config;
+
+	if (config->dot11Mode == eHDD_DOT11_MODE_11n_ONLY)
+		return ALLOW_11N_ONLY;
+	else if (config->dot11Mode == eHDD_DOT11_MODE_11ac_ONLY)
+		return ALLOW_11AC_ONLY;
+	else if (config->dot11Mode == eHDD_DOT11_MODE_11ax_ONLY)
+		return ALLOW_11AX_ONLY;
+	else
+		return ALLOW_ALL;
+}
+
+int wlan_hdd_cm_connect(struct wiphy *wiphy,
+			struct net_device *ndev,
+			struct cfg80211_connect_params *req)
+{
+	int status;
+	struct wlan_objmgr_vdev *vdev;
+	struct osif_connect_params params;
+	struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(ndev);
+	struct hdd_context *hdd_ctx;
+
+	hdd_enter();
+
+	if (QDF_GLOBAL_FTM_MODE == hdd_get_conparam()) {
+		hdd_err("Command not allowed in FTM mode");
+		return -EINVAL;
+	}
+
+	if (wlan_hdd_validate_vdev_id(adapter->vdev_id))
+		return -EINVAL;
+
+	qdf_mtrace(QDF_MODULE_ID_HDD, QDF_MODULE_ID_HDD,
+		   TRACE_CODE_HDD_CFG80211_CONNECT,
+		   adapter->vdev_id, adapter->device_mode);
+
+	if (adapter->device_mode != QDF_STA_MODE &&
+	    adapter->device_mode != QDF_P2P_CLIENT_MODE) {
+		hdd_err("Device_mode %s(%d) is not supported",
+			qdf_opmode_str(adapter->device_mode),
+			adapter->device_mode);
+		return -EINVAL;
+	}
+
+	hdd_ctx = WLAN_HDD_GET_CTX(adapter);
+
+	status = wlan_hdd_validate_context(hdd_ctx);
+	if (status)
+		return status;
+
+	vdev = hdd_objmgr_get_vdev(adapter);
+
+	ucfg_pmo_flush_gtk_offload_req(vdev);
+
+	qdf_runtime_pm_prevent_suspend(&hdd_ctx->runtime_context.connect);
+	hdd_prevent_suspend_timeout(HDD_WAKELOCK_CONNECT_COMPLETE,
+				    WIFI_POWER_EVENT_WAKELOCK_CONNECT);
+
+	params.force_rsne_override = hdd_ctx->force_rsne_override;
+	params.dot11mode_filter = hdd_get_dot11mode_filter(hdd_ctx);
+
+	hdd_update_scan_ie_for_connect(adapter, &params);
+
+	status = osif_cm_connect(ndev, vdev, req, &params);
+
+	if (status) {
+		hdd_err("Vdev %d connect failed status %d",
+			adapter->vdev_id, status);
+		qdf_runtime_pm_allow_suspend(&hdd_ctx->runtime_context.connect);
+		hdd_allow_suspend(WIFI_POWER_EVENT_WAKELOCK_CONNECT);
+	}
+
+	hdd_objmgr_put_vdev(vdev);
+	return status;
+}
+#endif
+
 /**
  * wlan_hdd_cfg80211_connect() - cfg80211 connect api
  * @wiphy: Pointer to wiphy
@@ -21190,6 +21297,48 @@ static int __wlan_hdd_cfg80211_disconnect(struct wiphy *wiphy,
 	return status;
 }
 
+#ifdef FEATURE_CM_ENABLE
+int wlan_hdd_cm_disconnect(struct wiphy *wiphy,
+			   struct net_device *dev, u16 reason)
+{
+	struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
+	int status;
+	struct wlan_objmgr_vdev *vdev;
+
+	if (QDF_GLOBAL_FTM_MODE == hdd_get_conparam()) {
+		hdd_err("Command not allowed in FTM mode");
+		return -EINVAL;
+	}
+
+	if (wlan_hdd_validate_vdev_id(adapter->vdev_id))
+		return -EINVAL;
+
+	vdev = hdd_objmgr_get_vdev(adapter);
+	if (!vdev)
+		return -EINVAL;
+
+	qdf_mtrace(QDF_MODULE_ID_HDD, QDF_MODULE_ID_HDD,
+		   TRACE_CODE_HDD_CFG80211_DISCONNECT,
+		   adapter->vdev_id, reason);
+
+	hdd_print_netdev_txq_status(dev);
+
+	if (reason == WLAN_REASON_DEAUTH_LEAVING)
+		qdf_dp_trace_dump_all(
+				WLAN_DEAUTH_DPTRACE_DUMP_COUNT,
+				QDF_TRACE_DEFAULT_PDEV_ID);
+
+	reset_mscs_params(adapter);
+	wlan_hdd_netif_queue_control(adapter,
+				     WLAN_STOP_ALL_NETIF_QUEUE_N_CARRIER,
+				     WLAN_CONTROL_PATH);
+	status = osif_cm_disconnect(dev, vdev, reason);
+	hdd_objmgr_put_vdev(vdev);
+
+	return status;
+}
+#endif
+
 /**
  * wlan_hdd_cfg80211_disconnect() - cfg80211 disconnect api
  * @wiphy: Pointer to wiphy

+ 30 - 0
core/hdd/src/wlan_hdd_cfg80211.h

@@ -864,4 +864,34 @@ static inline void hdd_send_update_owe_info_event(struct hdd_adapter *adapter,
  */
 bool hdd_is_legacy_connection(struct hdd_adapter *adapter);
 
+#ifdef FEATURE_CM_ENABLE
+/**
+ * wlan_hdd_cm_connect() - cfg80211 connect api
+ * @wiphy: Pointer to wiphy
+ * @dev: Pointer to network device
+ * @req: Pointer to cfg80211 connect request
+ *
+ * This function is used to issue connect request to connection manager
+ *
+ * Context: Any context.
+ * Return: 0 for success, non-zero for failure
+ */
+int wlan_hdd_cm_connect(struct wiphy *wiphy,
+			struct net_device *ndev,
+			struct cfg80211_connect_params *req);
+
+/**
+ * wlan_hdd_cm_disconnect() - cfg80211 disconnect api
+ * @wiphy: Pointer to wiphy
+ * @dev: Pointer to network device
+ * @reason: Disconnect reason code
+ *
+ * This function is used to issue disconnect request to conection manager
+ *
+ * Return: 0 for success, non-zero for failure
+ */
+int wlan_hdd_cm_disconnect(struct wiphy *wiphy,
+			   struct net_device *dev, u16 reason);
+#endif
+
 #endif