From 64476bcd6c86d978f9f9d81981846de90768c079 Mon Sep 17 00:00:00 2001 From: Ashish Kumar Dhanotiya Date: Wed, 1 Jul 2020 15:03:04 +0530 Subject: [PATCH 1/5] qcacmn: Add connect infra for connection manager Add connect functions to convert kernel specific connect request to connection manager specific connection request for connection manager infrastructure. Along with the above functions, add the file structure for connect, disconnect and roam functions for connection manager infrastructure. Change-Id: Id4e389d06cea6e39327faef0c119275741574785 CRs-Fixed: 2739318 --- os_if/linux/mlme/inc/wlan_cfg80211_cm_req.h | 57 +++ os_if/linux/mlme/inc/wlan_cfg80211_cm_rsp.h | 27 ++ os_if/linux/mlme/inc/wlan_cfg80211_cm_util.h | 27 ++ .../mlme/src/wlan_cfg80211_cm_connect_rsp.c | 21 + .../src/wlan_cfg80211_cm_disconnect_rsp.c | 22 + os_if/linux/mlme/src/wlan_cfg80211_cm_req.c | 431 ++++++++++++++++++ .../mlme/src/wlan_cfg80211_cm_roam_rsp.c | 21 + os_if/linux/mlme/src/wlan_cfg80211_cm_util.c | 22 + .../src/{wlan_cm_cmn.c => wlan_cm_util.c} | 2 +- .../dispatcher/inc/cfg_mlme_cm.h | 24 + .../dispatcher/inc/wlan_cm_api.h | 51 +++ .../dispatcher/inc/wlan_cm_public_struct.h | 24 +- .../dispatcher/inc/wlan_cm_ucfg_api.h | 61 +++ .../dispatcher/src/wlan_cm_api.c | 36 ++ .../dispatcher/src/wlan_cm_ucfg_api.c | 21 + 15 files changed, 833 insertions(+), 14 deletions(-) create mode 100644 os_if/linux/mlme/inc/wlan_cfg80211_cm_req.h create mode 100644 os_if/linux/mlme/inc/wlan_cfg80211_cm_rsp.h create mode 100644 os_if/linux/mlme/inc/wlan_cfg80211_cm_util.h create mode 100644 os_if/linux/mlme/src/wlan_cfg80211_cm_connect_rsp.c create mode 100644 os_if/linux/mlme/src/wlan_cfg80211_cm_disconnect_rsp.c create mode 100644 os_if/linux/mlme/src/wlan_cfg80211_cm_req.c create mode 100644 os_if/linux/mlme/src/wlan_cfg80211_cm_roam_rsp.c create mode 100644 os_if/linux/mlme/src/wlan_cfg80211_cm_util.c rename umac/mlme/connection_mgr/core/src/{wlan_cm_cmn.c => wlan_cm_util.c} (93%) create mode 100644 umac/mlme/connection_mgr/dispatcher/inc/cfg_mlme_cm.h create mode 100644 umac/mlme/connection_mgr/dispatcher/inc/wlan_cm_api.h create mode 100644 umac/mlme/connection_mgr/dispatcher/inc/wlan_cm_ucfg_api.h create mode 100644 umac/mlme/connection_mgr/dispatcher/src/wlan_cm_api.c create mode 100644 umac/mlme/connection_mgr/dispatcher/src/wlan_cm_ucfg_api.c diff --git a/os_if/linux/mlme/inc/wlan_cfg80211_cm_req.h b/os_if/linux/mlme/inc/wlan_cfg80211_cm_req.h new file mode 100644 index 000000000000..19676685122e --- /dev/null +++ b/os_if/linux/mlme/inc/wlan_cfg80211_cm_req.h @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2012-2015, 2020 The Linux Foundation. All rights reserved. + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +/** + * DOC: wlan_cfg80211_cm_req.h + * + * This header file maintains declarations of connect, disconnect, roam + * request apis. + */ + +#ifndef __WLAN_CFG80211_CM_REQ_H +#define __WLAN_CFG80211_CM_REQ_H + +#ifdef FEATURE_CM_ENABLE +#include "qdf_status.h" +#include "wlan_cm_public_struct.h" +#include +#include "wlan_objmgr_vdev_obj.h" + +/** + * wlan_osif_cfg80211_connect() - Connect start request + * @dev: net dev + * @vdev: vdev pointer + * @req: connect req + * + * Return: int + */ +int wlan_osif_cfg80211_connect(struct net_device *dev, + struct wlan_objmgr_vdev *vdev, + struct cfg80211_connect_params *req); + +/** + * wlan_osif_cfg80211_disconnect() - Disconnect start request + * @dev: net dev + * @vdev: vdev pointer + * @reason: disconnect reason + * + * Return: int + */ +int wlan_osif_cfg80211_disconnect(struct net_device *dev, + struct wlan_objmgr_vdev *vdev, + uint16_t reason); +#endif +#endif /* __WLAN_CFG80211_CM_REQ_H */ diff --git a/os_if/linux/mlme/inc/wlan_cfg80211_cm_rsp.h b/os_if/linux/mlme/inc/wlan_cfg80211_cm_rsp.h new file mode 100644 index 000000000000..59f47e1694e8 --- /dev/null +++ b/os_if/linux/mlme/inc/wlan_cfg80211_cm_rsp.h @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2012-2015, 2020 The Linux Foundation. All rights reserved. + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +/** + * DOC: wlan_cfg80211_cm_rsp.h + * + * This header file maintains declarations of connect, disconnect, roam + * response apis. + */ + +#ifndef __WLAN_CFG80211_CM_RSP_H +#define __WLAN_CFG80211_CM_RSP_H + +#endif /* __WLAN_CFG80211_CM_RSP_H */ diff --git a/os_if/linux/mlme/inc/wlan_cfg80211_cm_util.h b/os_if/linux/mlme/inc/wlan_cfg80211_cm_util.h new file mode 100644 index 000000000000..077bf6bdf445 --- /dev/null +++ b/os_if/linux/mlme/inc/wlan_cfg80211_cm_util.h @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2012-2015, 2020 The Linux Foundation. All rights reserved. + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +/** + * DOC: wlan_cfg80211_cm_util.h + * + * This header file maintains declarations of connect, disconnect, roam + * common apis. + */ + +#ifndef __WLAN_CFG80211_CM_UTIL_H +#define __WLAN_CFG80211_CM_UTIL_H + +#endif /* __WLAN_CFG80211_CM_UTIL_H */ diff --git a/os_if/linux/mlme/src/wlan_cfg80211_cm_connect_rsp.c b/os_if/linux/mlme/src/wlan_cfg80211_cm_connect_rsp.c new file mode 100644 index 000000000000..d392b8fd8205 --- /dev/null +++ b/os_if/linux/mlme/src/wlan_cfg80211_cm_connect_rsp.c @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2012-2015, 2020 The Linux Foundation. All rights reserved. + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +/** + * DOC: wlan_cfg80211_cm_connect_rsp.c + * + * This file maintains definitaions of connect response apis. + */ diff --git a/os_if/linux/mlme/src/wlan_cfg80211_cm_disconnect_rsp.c b/os_if/linux/mlme/src/wlan_cfg80211_cm_disconnect_rsp.c new file mode 100644 index 000000000000..17b99cb34407 --- /dev/null +++ b/os_if/linux/mlme/src/wlan_cfg80211_cm_disconnect_rsp.c @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2012-2015, 2020 The Linux Foundation. All rights reserved. + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +/** + * DOC: wlan_cfg80211_cm_disconnect_rsp.c + * + * This file maintains definitaions of disconnect response + * fucntions. + */ diff --git a/os_if/linux/mlme/src/wlan_cfg80211_cm_req.c b/os_if/linux/mlme/src/wlan_cfg80211_cm_req.c new file mode 100644 index 000000000000..9c2222a780af --- /dev/null +++ b/os_if/linux/mlme/src/wlan_cfg80211_cm_req.c @@ -0,0 +1,431 @@ +/* + * Copyright (c) 2012-2015, 2020 The Linux Foundation. All rights reserved. + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +/** + * DOC: wlan_cfg80211_cm_req.c + * + * This file maintains definitaions of connect, disconnect, roam + * request apis. + */ + +#include "wlan_cfg80211_cm_req.h" +#include "wlan_cm_ucfg_api.h" +#include "wlan_nl_to_crypto_params.h" +#include + +static void wlan_osif_free_wep_key_params( + struct wlan_cm_connect_req *connect_req) +{ + if (connect_req->crypto.wep_keys.key) { + qdf_mem_free(connect_req->crypto.wep_keys.key); + connect_req->crypto.wep_keys.key = NULL; + } + if (connect_req->crypto.wep_keys.seq) { + qdf_mem_free(connect_req->crypto.wep_keys.seq); + connect_req->crypto.wep_keys.seq = NULL; + } +} + +static QDF_STATUS wlan_osif_set_wep_key_params( + struct wlan_cm_connect_req *connect_req, + struct cfg80211_connect_params *req) +{ + if (!req->key_len) + return QDF_STATUS_SUCCESS; + + connect_req->crypto.wep_keys.key_len = req->key_len; + connect_req->crypto.wep_keys.key_idx = req->key_idx; + + connect_req->crypto.wep_keys.key = + qdf_mem_malloc(connect_req->crypto.wep_keys.key_len); + if (!connect_req->crypto.wep_keys.key) + return QDF_STATUS_E_NOMEM; + + qdf_mem_copy(connect_req->crypto.wep_keys.key, req->key, + connect_req->crypto.wep_keys.key_len); + + if (req->crypto.wep_keys->seq_len) { + connect_req->crypto.wep_keys.seq_len = + req->crypto.wep_keys->seq_len; + connect_req->crypto.wep_keys.seq = + qdf_mem_malloc(connect_req->crypto.wep_keys.seq_len); + if (!connect_req->crypto.wep_keys.seq) { + qdf_mem_free(connect_req->crypto.wep_keys.key); + connect_req->crypto.wep_keys.key = NULL; + return QDF_STATUS_E_NOMEM; + } + qdf_mem_copy(connect_req->crypto.wep_keys.seq, + req->crypto.wep_keys->seq, + connect_req->crypto.wep_keys.seq_len); + } + + return QDF_STATUS_SUCCESS; +} + +static void wlan_osif_set_auth_type(struct wlan_cm_connect_req *connect_req, + struct cfg80211_connect_params *req) +{ + wlan_crypto_auth_mode crypto_auth_type = + osif_nl_to_crypto_auth_type(req->auth_type); + + /* For auto check wpa version to decide WPA or RSNA */ + if (crypto_auth_type == WLAN_CRYPTO_AUTH_AUTO && + req->crypto.wpa_versions) { + if (req->crypto.wpa_versions & NL80211_WPA_VERSION_1) + crypto_auth_type = WLAN_CRYPTO_AUTH_WPA; + else + crypto_auth_type = WLAN_CRYPTO_AUTH_RSNA; + } else if (!req->crypto.wpa_versions) { + crypto_auth_type = WLAN_CRYPTO_AUTH_OPEN; + } + + QDF_SET_PARAM(connect_req->crypto.auth_type, crypto_auth_type); +} + +static +QDF_STATUS wlan_osif_set_crypto_params(struct wlan_cm_connect_req *connect_req, + struct cfg80211_connect_params *req) +{ + uint32_t i = 0; + QDF_STATUS status; + wlan_crypto_cipher_type cipher; + wlan_crypto_key_mgmt akm; + + connect_req->crypto.wpa_versions = req->crypto.wpa_versions; + + wlan_osif_set_auth_type(connect_req, req); + + if (req->crypto.cipher_group) + cipher = osif_nl_to_crypto_cipher_type(cipher); + else + cipher = WLAN_CRYPTO_CIPHER_NONE; + + QDF_SET_PARAM(connect_req->crypto.group_cipher, cipher); + + /* Fill Pairwise ciphers */ + if (req->crypto.n_ciphers_pairwise > NL80211_MAX_NR_CIPHER_SUITES) + connect_req->crypto.n_ciphers_pairwise = + NL80211_MAX_NR_CIPHER_SUITES; + else + connect_req->crypto.n_ciphers_pairwise = + req->crypto.n_ciphers_pairwise; + + if (connect_req->crypto.n_ciphers_pairwise) { + for (i = 0; i < connect_req->crypto.n_ciphers_pairwise ; i++) { + cipher = osif_nl_to_crypto_cipher_type( + req->crypto.ciphers_pairwise[i]); + QDF_SET_PARAM(connect_req->crypto.ciphers_pairwise, + cipher); + } + } else { + connect_req->crypto.n_ciphers_pairwise = 1; + QDF_SET_PARAM(connect_req->crypto.ciphers_pairwise, + WLAN_CRYPTO_CIPHER_NONE); + } + + /* Fill AKM suites */ + if (req->crypto.n_akm_suites > NL80211_MAX_NR_AKM_SUITES) + connect_req->crypto.n_akm_suites = NL80211_MAX_NR_AKM_SUITES; + else + connect_req->crypto.n_akm_suites = req->crypto.n_akm_suites; + + if (connect_req->crypto.n_akm_suites) { + for (i = 0; i < connect_req->crypto.n_akm_suites; i++) { + akm = osif_nl_to_crypto_akm_type( + req->crypto.akm_suites[i]); + QDF_SET_PARAM(connect_req->crypto.akm_suites, akm); + } + } else { + connect_req->crypto.n_akm_suites = 1; + QDF_SET_PARAM(connect_req->crypto.akm_suites, + WLAN_CRYPTO_KEY_MGMT_NONE); + } + + /* Fill WEP Key information */ + status = wlan_osif_set_wep_key_params(connect_req, req); + if (QDF_IS_STATUS_ERROR(status)) + osif_err("set wep key params failed"); + + return status; +} + +#ifdef WLAN_FEATURE_FILS_SK +static bool wlan_osif_is_fils_auth_type(enum nl80211_auth_type auth_type) +{ + switch (auth_type) { + case NL80211_AUTHTYPE_FILS_SK: + case NL80211_AUTHTYPE_FILS_SK_PFS: + case NL80211_AUTHTYPE_FILS_PK: + return true; + default: + return false; + } +} + +static bool wlan_osif_is_akm_suite_fils(uint32_t key_mgmt) +{ + switch (key_mgmt) { + case WLAN_AKM_SUITE_FILS_SHA256: + case WLAN_AKM_SUITE_FILS_SHA384: + case WLAN_AKM_SUITE_FT_FILS_SHA256: + case WLAN_AKM_SUITE_FT_FILS_SHA384: + return true; + default: + return false; + } +} + +static bool wlan_osif_is_conn_type_fils(struct cfg80211_connect_params *req) +{ + int num_akm_suites = req->crypto.n_akm_suites; + uint32_t key_mgmt = req->crypto.akm_suites[0]; + bool is_fils_auth_type = + wlan_osif_is_fils_auth_type(req->auth_type); + + if (num_akm_suites <= 0) + return false; + + /* + * Auth type will be either be OPEN or FILS type for a FILS connection + */ + if (!is_fils_auth_type && + req->auth_type != NL80211_AUTHTYPE_OPEN_SYSTEM) + return false; + + if (!wlan_osif_is_akm_suite_fils(key_mgmt)) + return false; + + osif_debug("Fils Auth %d AKM %d", req->auth_type, key_mgmt); + + return true; +} + +static QDF_STATUS wlan_osif_set_fils_info( + struct wlan_cm_connect_req *connect_req, + struct cfg80211_connect_params *req) +{ + connect_req->fils_info.is_fils_connection = + wlan_osif_is_conn_type_fils(req); + connect_req->fils_info.username_len = req->fils_erp_username_len; + + if (connect_req->fils_info.username_len > + WLAN_CM_FILS_MAX_KEYNAME_NAI_LENGTH) { + osif_err("Invalid fils username len"); + return QDF_STATUS_E_INVAL; + } + qdf_mem_zero(connect_req->fils_info.username, + WLAN_CM_FILS_MAX_KEYNAME_NAI_LENGTH); + qdf_mem_copy(connect_req->fils_info.username, req->fils_erp_username, + connect_req->fils_info.username_len); + + connect_req->fils_info.realm_len = req->fils_erp_username_len; + + if (connect_req->fils_info.realm_len > WLAN_CM_FILS_MAX_REALM_LEN) { + osif_err("Invalid fils realm len"); + return QDF_STATUS_E_INVAL; + } + qdf_mem_zero(connect_req->fils_info.realm, WLAN_CM_FILS_MAX_REALM_LEN); + qdf_mem_copy(connect_req->fils_info.realm, req->fils_erp_realm, + connect_req->fils_info.realm_len); + + connect_req->fils_info.next_seq_num = req->fils_erp_next_seq_num; + + connect_req->fils_info.rrk_len = req->fils_erp_rrk_len; + + if (connect_req->fils_info.rrk_len > WLAN_CM_FILS_MAX_RRK_LENGTH) { + osif_err("Invalid fils rrk len"); + return QDF_STATUS_E_INVAL; + } + qdf_mem_zero(connect_req->fils_info.rrk, WLAN_CM_FILS_MAX_RRK_LENGTH); + qdf_mem_copy(connect_req->fils_info.rrk, req->fils_erp_rrk, + connect_req->fils_info.rrk_len); + + return QDF_STATUS_SUCCESS; +} +#else +static inline QDF_STATUS wlan_osif_set_fils_info( + struct wlan_cm_connect_req *connect_req, + struct cfg80211_connect_params *req) +{ + return QDF_STATUS_SUCCESS; +} +#endif + +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0)) +static inline void wlan_osif_set_prev_bssid( + struct wlan_cm_connect_req *connect_req, + struct cfg80211_connect_params *req) +{ + qdf_mem_copy(connect_req->prev_bssid.bytes, req->prev_bssid, + QDF_MAC_ADDR_SIZE); +} + +static inline void osif_dump_prev_bssid(struct cfg80211_connect_params *req) +{ + if (req->prev_bssid) + osif_nofl_debug("prev BSSID %pM", req->prev_bssid); +} + +#else +static inline void wlan_osif_set_prev_bssid( + struct wlan_cm_connect_req *connect_req, + struct cfg80211_connect_params *req); + +static inline void osif_dump_prev_bssid(struct cfg80211_connect_params *req) +{ +} + +#endif + +static inline void osif_dump_connect_req(struct net_device *dev, + uint8_t vdev_id, + struct cfg80211_connect_params *req) +{ + uint32_t i; + + osif_nofl_debug("connect req for %s(vdevid-%d) freq %d SSID %.*s auth type %d WPA ver %d n_akm %d n_cipher %d grp_cipher %x mfp %d freq hint %d", + dev->name, vdev_id, + req->channel ? req->channel->center_freq : 0, + (int)req->ssid_len, req->ssid, req->auth_type, + req->crypto.wpa_versions, + req->crypto.n_akm_suites, + req->crypto.n_ciphers_pairwise, + req->crypto.cipher_group, req->mfp, + req->channel_hint ? req->channel_hint->center_freq : 0); + if (req->bssid) + osif_nofl_debug("BSSID %pM", req->bssid); + if (req->bssid_hint) + osif_nofl_debug("BSSID hint %pM", req->bssid_hint); + osif_dump_prev_bssid(req); + + for (i = 0; i < req->crypto.n_akm_suites; i++) + osif_nofl_debug("akm[%d] = %x", i, req->crypto.akm_suites[i]); + + for (i = 0; i < req->crypto.n_ciphers_pairwise; i++) + osif_nofl_debug("cipher_pairwise[%d] = %x", i, + req->crypto.ciphers_pairwise[i]); +} + +int wlan_osif_cfg80211_connect(struct net_device *dev, + struct wlan_objmgr_vdev *vdev, + struct cfg80211_connect_params *req) +{ + struct wlan_cm_connect_req *connect_req; + const u8 *bssid_hint = req->bssid_hint; + uint8_t vdev_id = vdev->vdev_objmgr.vdev_id; + QDF_STATUS status; + + osif_dump_connect_req(dev, vdev_id, req); + + connect_req = qdf_mem_malloc(sizeof(*connect_req)); + if (!connect_req) + return -ENOMEM; + + connect_req->vdev_id = vdev_id; + connect_req->source = CM_OSIF_CONENCT_REQ; + if (req->bssid) + qdf_mem_copy(connect_req->bssid.bytes, req->bssid, + QDF_MAC_ADDR_SIZE); + else if (bssid_hint) + qdf_mem_copy(connect_req->bssid.bytes, req->bssid_hint, + QDF_MAC_ADDR_SIZE); + + wlan_osif_set_prev_bssid(connect_req, req); + + connect_req->ssid.length = req->ssid_len; + if (connect_req->ssid.length > WLAN_SSID_MAX_LEN) { + osif_err("Invalid ssid len %d", req->ssid_len); + return -EINVAL; + } + + qdf_mem_copy(connect_req->ssid.ssid, req->ssid, + connect_req->ssid.length); + + qdf_mem_copy(connect_req->bssid_hint.bytes, bssid_hint, + QDF_MAC_ADDR_SIZE); + + if (req->channel) + connect_req->chan_freq = req->channel->center_freq; + else + connect_req->chan_freq = 0; + + status = wlan_osif_set_crypto_params(connect_req, req); + if (QDF_IS_STATUS_ERROR(status)) + goto connect_start_fail; + + connect_req->ht_caps = req->ht_capa.cap_info; + connect_req->ht_caps_mask = req->ht_capa_mask.cap_info; + connect_req->vht_caps = req->vht_capa.vht_cap_info; + connect_req->vht_caps_mask = req->vht_capa_mask.vht_cap_info; + + /* Copy complete ie */ + connect_req->assoc_ie.len = req->ie_len; + connect_req->assoc_ie.ptr = qdf_mem_malloc(req->ie_len); + if (!connect_req->assoc_ie.ptr) { + connect_req->assoc_ie.len = 0; + status = QDF_STATUS_E_NOMEM; + goto connect_start_fail; + } + qdf_mem_copy(connect_req->assoc_ie.ptr, req->ie, + connect_req->assoc_ie.len); + + status = wlan_osif_set_fils_info(connect_req, req); + if (QDF_IS_STATUS_ERROR(status)) + goto connect_start_fail; + + status = ucfg_wlan_cm_start_connect(vdev, connect_req); + if (QDF_IS_STATUS_ERROR(status)) + goto connect_start_fail; + + return qdf_status_to_os_return(status); + +connect_start_fail: + if (connect_req->assoc_ie.ptr) { + qdf_mem_free(connect_req->assoc_ie.ptr); + connect_req->assoc_ie.ptr = NULL; + } + wlan_osif_free_wep_key_params(connect_req); + qdf_mem_free(connect_req); + + return qdf_status_to_os_return(status); +} + +int wlan_osif_cfg80211_disconnect(struct net_device *dev, + struct wlan_objmgr_vdev *vdev, + uint16_t reason) +{ + struct wlan_cm_disconnect_req *req; + uint8_t vdev_id = vdev->vdev_objmgr.vdev_id; + QDF_STATUS status; + + req = qdf_mem_malloc(sizeof(*req)); + if (!req) + return -ENOMEM; + + /* TODO print reason in string */ + osif_info("%s(vdevid-%d): Received Disconnect reason:%d", + dev->name, vdev_id, reason); + + req->vdev_id = vdev_id; + req->source = CM_OSIF_DISCONNECT; + req->reason_code = reason; + status = ucfg_wlan_cm_start_disconnect(vdev, req); + if (QDF_IS_STATUS_ERROR(status)) + qdf_mem_free(req); + + return qdf_status_to_os_return(status); +} + diff --git a/os_if/linux/mlme/src/wlan_cfg80211_cm_roam_rsp.c b/os_if/linux/mlme/src/wlan_cfg80211_cm_roam_rsp.c new file mode 100644 index 000000000000..d00e27194244 --- /dev/null +++ b/os_if/linux/mlme/src/wlan_cfg80211_cm_roam_rsp.c @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2012-2015, 2020, The Linux Foundation. All rights reserved. + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +/** + * DOC: wlan_cfg80211_cm_roam_rsp.c + * + * This file maintains definitaions of roam response apis. + */ diff --git a/os_if/linux/mlme/src/wlan_cfg80211_cm_util.c b/os_if/linux/mlme/src/wlan_cfg80211_cm_util.c new file mode 100644 index 000000000000..2ba573ba92a2 --- /dev/null +++ b/os_if/linux/mlme/src/wlan_cfg80211_cm_util.c @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2012-2015, 2020 The Linux Foundation. All rights reserved. + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +/** + * DOC: wlan_cfg80211_cm_util.c + * + * This file maintains definitaions of connect, disconnect, roam + * common apis. + */ diff --git a/umac/mlme/connection_mgr/core/src/wlan_cm_cmn.c b/umac/mlme/connection_mgr/core/src/wlan_cm_util.c similarity index 93% rename from umac/mlme/connection_mgr/core/src/wlan_cm_cmn.c rename to umac/mlme/connection_mgr/core/src/wlan_cm_util.c index 8a819d0ec712..66fce7700772 100644 --- a/umac/mlme/connection_mgr/core/src/wlan_cm_cmn.c +++ b/umac/mlme/connection_mgr/core/src/wlan_cm_util.c @@ -15,5 +15,5 @@ */ /** - * DOC: Implements general apis of connection manager + * DOC: Implements general util apis of connection manager */ diff --git a/umac/mlme/connection_mgr/dispatcher/inc/cfg_mlme_cm.h b/umac/mlme/connection_mgr/dispatcher/inc/cfg_mlme_cm.h new file mode 100644 index 000000000000..b3ec9064b423 --- /dev/null +++ b/umac/mlme/connection_mgr/dispatcher/inc/cfg_mlme_cm.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2012-2015, 2020, The Linux Foundation. All rights reserved. + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +/** + * DOC: This file contains connection manager related CFG/INI Items. + */ + +#ifndef __CFG_MLME_CM_H +#define __CFG_MLME_CM_H + +#endif /* __CFG_MLME_CM_H */ diff --git a/umac/mlme/connection_mgr/dispatcher/inc/wlan_cm_api.h b/umac/mlme/connection_mgr/dispatcher/inc/wlan_cm_api.h new file mode 100644 index 000000000000..22e1472a3a0d --- /dev/null +++ b/umac/mlme/connection_mgr/dispatcher/inc/wlan_cm_api.h @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2020 The Linux Foundation. All rights reserved. + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +/** + * DOC: wlan_cm_api.h + * + * This file maintains declarations of public apis + */ + +#ifndef __WLAN_CM_API_H +#define __WLAN_CM_API_H + +#ifdef FEATURE_CM_ENABLE +#include "wlan_cm_public_struct.h" + +/** + * wlan_cm_start_connect() - connect start request + * @vdev: vdev pointer + * @req: connect req + * + * Return: QDF_STATUS + */ +QDF_STATUS wlan_cm_start_connect(struct wlan_objmgr_vdev *vdev, + struct wlan_cm_connect_req *req); + +/** + * wlan_cm_start_disconnect() - disconnect start request + * @vdev: vdev pointer + * @req: disconnect req + * + * Return: QDF_STATUS + */ +QDF_STATUS wlan_cm_start_disconnect(struct wlan_objmgr_vdev *vdev, + struct wlan_cm_disconnect_req *req); + +#endif +#endif /* __WLAN_CM_UCFG_API_H */ + diff --git a/umac/mlme/connection_mgr/dispatcher/inc/wlan_cm_public_struct.h b/umac/mlme/connection_mgr/dispatcher/inc/wlan_cm_public_struct.h index 1e1f573a9e08..e8b4dd32f358 100644 --- a/umac/mlme/connection_mgr/dispatcher/inc/wlan_cm_public_struct.h +++ b/umac/mlme/connection_mgr/dispatcher/inc/wlan_cm_public_struct.h @@ -25,6 +25,7 @@ #ifdef FEATURE_CM_ENABLE #include +#include "wlan_crypto_global_def.h" typedef uint32_t wlan_cm_id; @@ -44,35 +45,32 @@ struct wlan_cm_wep_key_params { uint8_t key_idx; }; -#define WLAN_CM_MAX_NR_CIPHER_SUITES 5 -#define WLAN_CM_MAX_NR_AKM_SUITES 2 - /** * struct wlan_cm_connect_crypto_info - Crypto settings * @wpa_versions: indicates which, if any, WPA versions are enabled * (from enum nl80211_wpa_versions) - * @auth_type: Auth mode type - * @group_cipher: group key cipher suite (or 0 if unset) + * @auth_type: Auth mode type bitmask + * @group_cipher: group key cipher suite bitmask * @n_ciphers_pairwise: number of AP supported unicast ciphers - * @ciphers_pairwise: unicast key cipher suites + * @ciphers_pairwise: unicast key cipher suites bitmask * @n_akm_suites: number of AKM suites - * @akm_suites: AKM suites + * @akm_suites: AKM suites bitmask * @wep_keys: static WEP keys, if not NULL points to an array of * MAX_WEP_KEYS WEP keys * @pmf_cap: Pmf capability - * @mgmt_ciphers: mgmt cipher + * @mgmt_ciphers: mgmt cipher bitmask */ struct wlan_cm_connect_crypto_info { uint32_t wpa_versions; - wlan_crypto_auth_mode auth_type; - wlan_crypto_cipher_type group_cipher; + uint32_t auth_type; + uint32_t group_cipher; uint32_t n_ciphers_pairwise; - wlan_crypto_cipher_type ciphers_pairwise[WLAN_CM_MAX_NR_CIPHER_SUITES]; + uint32_t ciphers_pairwise; uint32_t n_akm_suites; - wlan_crypto_key_mgmt akm_suites[WLAN_CM_MAX_NR_AKM_SUITES]; + uint32_t akm_suites; struct wlan_cm_wep_key_params wep_keys; enum wlan_pmf_cap pmf_cap; - wlan_crypto_cipher_type mgmt_ciphers; + uint32_t mgmt_ciphers; }; #ifdef WLAN_FEATURE_FILS_SK diff --git a/umac/mlme/connection_mgr/dispatcher/inc/wlan_cm_ucfg_api.h b/umac/mlme/connection_mgr/dispatcher/inc/wlan_cm_ucfg_api.h new file mode 100644 index 000000000000..f8b78ccf360c --- /dev/null +++ b/umac/mlme/connection_mgr/dispatcher/inc/wlan_cm_ucfg_api.h @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2020 The Linux Foundation. All rights reserved. + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +/** + * DOC: wlan_cm_ucfg_api.h + * + * This file maintains declarations of public ucfg apis + */ + +#ifndef __WLAN_CM_UCFG_API_H +#define __WLAN_CM_UCFG_API_H + +#ifdef FEATURE_CM_ENABLE + +#include + +/** + * ucfg_wlan_cm_start_connect() - connect start request + * @vdev: vdev pointer + * @req: connect req + * + * Return: QDF_STATUS + */ +static inline +QDF_STATUS ucfg_wlan_cm_start_connect(struct wlan_objmgr_vdev *vdev, + struct wlan_cm_connect_req *req) +{ + return wlan_cm_start_connect(vdev, req); +} + + +/** + * ucfg_wlan_cm_start_disconnect() - disconnect start request + * @vdev: vdev pointer + * @req: disconnect req + * + * Return: QDF_STATUS + */ +static inline +QDF_STATUS ucfg_wlan_cm_start_disconnect(struct wlan_objmgr_vdev *vdev, + struct wlan_cm_disconnect_req *req) +{ + return wlan_cm_start_disconnect(vdev, req); +} + +#endif +#endif /* __WLAN_CM_UCFG_API_H */ + diff --git a/umac/mlme/connection_mgr/dispatcher/src/wlan_cm_api.c b/umac/mlme/connection_mgr/dispatcher/src/wlan_cm_api.c new file mode 100644 index 000000000000..71bc74d7eb06 --- /dev/null +++ b/umac/mlme/connection_mgr/dispatcher/src/wlan_cm_api.c @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2012-2015, 2020, The Linux Foundation. All rights reserved. + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +/** + * DOC: wlan_cm_api.c + * + * This file maintains definitaions public apis. + */ + +#include + +QDF_STATUS wlan_cm_start_connect(struct wlan_objmgr_vdev *vdev, + struct wlan_cm_connect_req *req) +{ + return QDF_STATUS_SUCCESS; +} + +QDF_STATUS wlan_cm_start_disconnect(struct wlan_objmgr_vdev *vdev, + struct wlan_cm_disconnect_req *req) +{ + return QDF_STATUS_SUCCESS; +} + diff --git a/umac/mlme/connection_mgr/dispatcher/src/wlan_cm_ucfg_api.c b/umac/mlme/connection_mgr/dispatcher/src/wlan_cm_ucfg_api.c new file mode 100644 index 000000000000..579c71306e3d --- /dev/null +++ b/umac/mlme/connection_mgr/dispatcher/src/wlan_cm_ucfg_api.c @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2012-2015, 2020, The Linux Foundation. All rights reserved. + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +/** + * DOC: wlan_cm_ucfg_api.c + * + * This file maintains definitaions public ucfg apis. + */ From 2bd4ec3c090911375a59c7dda702806f63295ea0 Mon Sep 17 00:00:00 2001 From: Rakshith Suresh Patkar Date: Wed, 5 Aug 2020 13:46:44 +0530 Subject: [PATCH 2/5] qcacmn: Add debug log to trap unsuccessful dbr vaddr lookup In direct buf rx, if physical address is not intact or is corrupt, the dbr lookup for vaddr will fail and result in vaddr being NULL. There is no validation for this vaddr in the caller and hence results in NULL access in the callstack. Add debug log and return error status when dbr vaddr lookup fails, which indicates that there is corruption in paddr received and avoid NULL access. Change-Id: I76ee300ce3e686765dd5c4ee73fa71d1735c163a CRs-Fixed: 2748529 --- target_if/direct_buf_rx/src/target_if_direct_buf_rx_main.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/target_if/direct_buf_rx/src/target_if_direct_buf_rx_main.c b/target_if/direct_buf_rx/src/target_if_direct_buf_rx_main.c index dc0f3d772cde..b2e99da459e2 100644 --- a/target_if/direct_buf_rx/src/target_if_direct_buf_rx_main.c +++ b/target_if/direct_buf_rx/src/target_if_direct_buf_rx_main.c @@ -1620,6 +1620,12 @@ static QDF_STATUS target_if_get_dbr_data(struct wlan_objmgr_pdev *pdev, *cookie = WMI_HOST_DBR_DATA_ADDR_HI_HOST_DATA_GET( dbr_rsp->dbr_entries[idx].paddr_hi); dbr_data->vaddr = target_if_dbr_vaddr_lookup(mod_param, paddr, *cookie); + + if (!dbr_data->vaddr) { + direct_buf_rx_err("dbr vaddr lookup failed, vaddr NULL"); + return QDF_STATUS_E_FAILURE; + } + dbr_data->cookie = *cookie; dbr_data->paddr = paddr; direct_buf_rx_debug("Cookie = %d Vaddr look up = %pK", From 30a3c984d0d6d7d6fc14705475183591179be3ab Mon Sep 17 00:00:00 2001 From: Rajeev Kumar Date: Wed, 15 Jul 2020 15:15:39 -0700 Subject: [PATCH 3/5] qcacmn: log wmi cmd id in hex when cmd is sent over qmi WMI commands are logged in hex in FW and hence log WMI CMD ID in hex when stats request is send over QMI to assist in debugging. Change-Id: I9ce63db30b491f26b9d6ac7ae3c98e6177452d7c CRs-Fixed: 2733208 --- wmi/src/wmi_unified.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wmi/src/wmi_unified.c b/wmi/src/wmi_unified.c index c045d2cc4257..2c0b6ba6156c 100644 --- a/wmi/src/wmi_unified.c +++ b/wmi/src/wmi_unified.c @@ -2312,7 +2312,7 @@ QDF_STATUS wmi_unified_cmd_send_over_qmi(struct wmi_unified *wmi_handle, qdf_mem_zero(qdf_nbuf_data(buf), sizeof(WMI_CMD_HDR)); WMI_SET_FIELD(qdf_nbuf_data(buf), WMI_CMD_HDR, COMMANDID, cmd_id); - wmi_debug("Sending WMI_CMD_ID: %d over qmi", cmd_id); + wmi_debug("Sending WMI_CMD_ID: 0x%x over qmi", cmd_id); status = qdf_wmi_send_recv_qmi(qdf_nbuf_data(buf), buflen + sizeof(WMI_CMD_HDR), wmi_handle, From db5374f08f7639425844ada79e6af5ec85f07aaf Mon Sep 17 00:00:00 2001 From: Yu Tian Date: Wed, 22 Jul 2020 11:20:45 +0800 Subject: [PATCH 4/5] qcacmn: Allow drop pkts when pkts pending is large On some cases, dp_rx_thread can not handle nbufs in time, then a large number of packets are pending in rx_thread->nbuf_queue, which run out of system memory at last and failed to malloc new buffers for refill buffer ring, fw crash is encountered. To avoid this, drop RX packets when the pending number becomes large. Change-Id: I370ad983b185b6ecb28fa7c0b4820b8edc00c710 CRs-Fixed: 2737191 --- wlan_cfg/cfg_dp.h | 55 ++++++++++++++++++++++++++++++++++++++++++++- wlan_cfg/wlan_cfg.c | 17 ++++++++++++++ wlan_cfg/wlan_cfg.h | 22 ++++++++++++++++++ 3 files changed, 93 insertions(+), 1 deletion(-) diff --git a/wlan_cfg/cfg_dp.h b/wlan_cfg/cfg_dp.h index 159cc8510589..65703ccc69c6 100644 --- a/wlan_cfg/cfg_dp.h +++ b/wlan_cfg/cfg_dp.h @@ -107,6 +107,14 @@ #define WLAN_CFG_INT_TIMER_THRESHOLD_OTHER 8 #endif +#define WLAN_CFG_RX_PENDING_HL_THRESHOLD 0x60000 +#define WLAN_CFG_RX_PENDING_HL_THRESHOLD_MIN 0 +#define WLAN_CFG_RX_PENDING_HL_THRESHOLD_MAX 0x80000 + +#define WLAN_CFG_RX_PENDING_LO_THRESHOLD 0x60000 +#define WLAN_CFG_RX_PENDING_LO_THRESHOLD_MIN 100 +#define WLAN_CFG_RX_PENDING_LO_THRESHOLD_MAX 0x80000 + #define WLAN_CFG_INT_TIMER_THRESHOLD_WBM_RELEASE_RING 256 #define WLAN_CFG_INT_TIMER_THRESHOLD_REO_RING 512 @@ -523,6 +531,49 @@ WLAN_CFG_PER_PDEV_LMAC_RING_MAX, \ WLAN_CFG_PER_PDEV_LMAC_RING, \ CFG_VALUE_OR_DEFAULT, "DP pdev LMAC ring") +/* + * + * dp_rx_pending_hl_threshold - High threshold of frame number to start + * frame dropping scheme + * @Min: 0 + * @Max: 524288 + * @Default: 393216 + * + * This ini entry is used to set a high limit threshold to start frame + * dropping scheme + * + * Usage: External + * + * + */ +#define CFG_DP_RX_PENDING_HL_THRESHOLD \ + CFG_INI_UINT("dp_rx_pending_hl_threshold", \ + WLAN_CFG_RX_PENDING_HL_THRESHOLD_MIN, \ + WLAN_CFG_RX_PENDING_HL_THRESHOLD_MAX, \ + WLAN_CFG_RX_PENDING_HL_THRESHOLD, \ + CFG_VALUE_OR_DEFAULT, "DP rx pending hl threshold") + +/* + * + * dp_rx_pending_lo_threshold - Low threshold of frame number to stop + * frame dropping scheme + * @Min: 100 + * @Max: 524288 + * @Default: 393216 + * + * This ini entry is used to set a low limit threshold to stop frame + * dropping scheme + * + * Usage: External + * + * + */ +#define CFG_DP_RX_PENDING_LO_THRESHOLD \ + CFG_INI_UINT("dp_rx_pending_lo_threshold", \ + WLAN_CFG_RX_PENDING_LO_THRESHOLD_MIN, \ + WLAN_CFG_RX_PENDING_LO_THRESHOLD_MAX, \ + WLAN_CFG_RX_PENDING_LO_THRESHOLD, \ + CFG_VALUE_OR_DEFAULT, "DP rx pending lo threshold") #define CFG_DP_BASE_HW_MAC_ID \ CFG_INI_UINT("dp_base_hw_macid", \ @@ -973,6 +1024,8 @@ CFG(CFG_DP_FULL_MON_MODE) \ CFG(CFG_DP_REO_RINGS_MAP) \ CFG(CFG_DP_PEER_EXT_STATS) \ - CFG(CFG_DP_RX_BUFF_POOL_ENABLE) + CFG(CFG_DP_RX_BUFF_POOL_ENABLE) \ + CFG(CFG_DP_RX_PENDING_HL_THRESHOLD) \ + CFG(CFG_DP_RX_PENDING_LO_THRESHOLD) #endif /* _CFG_DP_H_ */ diff --git a/wlan_cfg/wlan_cfg.c b/wlan_cfg/wlan_cfg.c index b691f31db3d6..3327b4a2fe5b 100644 --- a/wlan_cfg/wlan_cfg.c +++ b/wlan_cfg/wlan_cfg.c @@ -612,6 +612,11 @@ wlan_cfg_soc_attach(struct cdp_ctrl_objmgr_psoc *psoc) wlan_cfg_ctx->pext_stats_enabled = cfg_get(psoc, CFG_DP_PEER_EXT_STATS); wlan_cfg_ctx->is_rx_buff_pool_enabled = cfg_get(psoc, CFG_DP_RX_BUFF_POOL_ENABLE); + wlan_cfg_ctx->rx_pending_high_threshold = + cfg_get(psoc, CFG_DP_RX_PENDING_HL_THRESHOLD); + wlan_cfg_ctx->rx_pending_low_threshold = + cfg_get(psoc, CFG_DP_RX_PENDING_LO_THRESHOLD); + return wlan_cfg_ctx; } @@ -882,6 +887,18 @@ int wlan_cfg_per_pdev_tx_ring(struct wlan_cfg_dp_soc_ctxt *cfg) return cfg->per_pdev_tx_ring; } +uint32_t +wlan_cfg_rx_pending_hl_threshold(struct wlan_cfg_dp_soc_ctxt *cfg) +{ + return cfg->rx_pending_high_threshold; +} + +uint32_t +wlan_cfg_rx_pending_lo_threshold(struct wlan_cfg_dp_soc_ctxt *cfg) +{ + return cfg->rx_pending_low_threshold; +} + int wlan_cfg_per_pdev_lmac_ring(struct wlan_cfg_dp_soc_ctxt *cfg) { return cfg->per_pdev_lmac_ring; diff --git a/wlan_cfg/wlan_cfg.h b/wlan_cfg/wlan_cfg.h index 5eef7640defb..5605cb65a0ca 100644 --- a/wlan_cfg/wlan_cfg.h +++ b/wlan_cfg/wlan_cfg.h @@ -187,6 +187,8 @@ struct wlan_srng_cfg { * @pext_stats_enabled: Flag to enable and disabled peer extended stats * @is_rx_buff_pool_enabled: flag to enable/disable emergency RX buffer * pool support + * @rx_pending_high_threshold: threshold of starting pkt drop + * @rx_pending_low_threshold: threshold of stopping pkt drop */ struct wlan_cfg_dp_soc_ctxt { int num_int_ctxts; @@ -292,6 +294,8 @@ struct wlan_cfg_dp_soc_ctxt { uint32_t reo_rings_mapping; bool pext_stats_enabled; bool is_rx_buff_pool_enabled; + uint32_t rx_pending_high_threshold; + uint32_t rx_pending_low_threshold; }; /** @@ -867,6 +871,24 @@ wlan_cfg_get_dma_mon_desc_ring_size(struct wlan_cfg_dp_pdev_ctxt *cfg); int wlan_cfg_get_rx_dma_buf_ring_size( struct wlan_cfg_dp_pdev_ctxt *wlan_cfg_pdev_ctx); +/* + * wlan_cfg_rx_pending_hl_threshold() - Return high threshold of rx pending + * @wlan_cfg_pdev_ctx + * + * Return: rx_pending_high_threshold + */ +uint32_t +wlan_cfg_rx_pending_hl_threshold(struct wlan_cfg_dp_soc_ctxt *cfg); + +/* + * wlan_cfg_rx_pending_lo_threshold() - Return low threshold of rx pending + * @wlan_cfg_pdev_ctx + * + * Return: rx_pending_low_threshold + */ +uint32_t +wlan_cfg_rx_pending_lo_threshold(struct wlan_cfg_dp_soc_ctxt *cfg); + /* * wlan_cfg_get_num_mac_rings() - Return the number of MAC RX DMA rings * per pdev From e762bb831e7f455cf01106670e769151ba53b337 Mon Sep 17 00:00:00 2001 From: Ruben Columbus Date: Mon, 29 Jun 2020 17:14:09 -0700 Subject: [PATCH 5/5] qcacmn: prevent double free on buffer wdi event has to be called before dp_txrx_ppdu_stats_handler. this will handle all pktlog htt messages including cases for mgmt frame Change-Id: Iefba15b61278fe77cbb6d6df9190e66b46ed573c --- dp/wifi3.0/dp_htt.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dp/wifi3.0/dp_htt.c b/dp/wifi3.0/dp_htt.c index 121007ca9efa..dde545232fd3 100644 --- a/dp/wifi3.0/dp_htt.c +++ b/dp/wifi3.0/dp_htt.c @@ -4192,11 +4192,11 @@ dp_ppdu_stats_ind_handler(struct htt_soc *soc, target_pdev_id = HTT_T2H_PPDU_STATS_PDEV_ID_GET(*msg_word); pdev_id = dp_get_host_pdev_id_for_target_pdev_id(soc->dp_soc, target_pdev_id); + dp_wdi_event_handler(WDI_EVENT_LITE_T2H, soc->dp_soc, + htt_t2h_msg, HTT_INVALID_PEER, WDI_NO_VAL, + pdev_id); free_buf = dp_txrx_ppdu_stats_handler(soc->dp_soc, pdev_id, htt_t2h_msg); - dp_wdi_event_handler(WDI_EVENT_LITE_T2H, soc->dp_soc, - htt_t2h_msg, HTT_INVALID_PEER, WDI_NO_VAL, - pdev_id); return free_buf; } #else