|
@@ -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, ¶ms);
|
|
|
+
|
|
|
+ status = osif_cm_connect(ndev, vdev, req, ¶ms);
|
|
|
+
|
|
|
+ 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
|