Browse Source

qcacld-3.0: Fill op and ext rates in LIM

Fill operational and extended rates in LIM
instead of CSR as part of connection manager.

Change-Id: I9197e835703059d61bc67897a9670ff166460318
CRs-Fixed: 2892415
Utkarsh Bhatnagar 4 years ago
parent
commit
6664a74b45

+ 0 - 30
components/mlme/core/src/wlan_mlme_main.c

@@ -1246,12 +1246,6 @@ static bool is_sae_sap_enabled(struct wlan_objmgr_psoc *psoc)
 static void mlme_init_sap_cfg(struct wlan_objmgr_psoc *psoc,
 			      struct wlan_mlme_cfg_sap *sap_cfg)
 {
-	uint8_t *ssid;
-
-	ssid = cfg_default(CFG_SSID);
-	qdf_mem_zero(sap_cfg->cfg_ssid, WLAN_SSID_MAX_LEN);
-	sap_cfg->cfg_ssid_len = STR_SSID_DEFAULT_LEN;
-	qdf_mem_copy(sap_cfg->cfg_ssid, ssid, STR_SSID_DEFAULT_LEN);
 	sap_cfg->beacon_interval = cfg_get(psoc, CFG_BEACON_INTERVAL);
 	sap_cfg->dtim_interval = cfg_default(CFG_DTIM_PERIOD);
 	sap_cfg->listen_interval = cfg_default(CFG_LISTEN_INTERVAL);
@@ -1959,29 +1953,6 @@ static void mlme_init_nss_chains(struct wlan_objmgr_psoc *psoc,
 	nss_chains->enable_dynamic_nss_chains_cfg =
 			cfg_get(psoc, CFG_ENABLE_DYNAMIC_NSS_CHAIN_CONFIG);
 }
-static void mlme_init_wep_keys(struct wlan_mlme_wep_cfg *wep_params)
-{
-	/* initialize the default key values to zero */
-	wep_params->wep_default_key_1.len = WLAN_CRYPTO_KEY_WEP104_LEN;
-	wep_params->wep_default_key_1.max_len = WLAN_CRYPTO_KEY_WEP104_LEN;
-	qdf_mem_zero(wep_params->wep_default_key_1.data,
-		     WLAN_CRYPTO_KEY_WEP104_LEN);
-
-	wep_params->wep_default_key_2.len = WLAN_CRYPTO_KEY_WEP104_LEN;
-	wep_params->wep_default_key_2.max_len = WLAN_CRYPTO_KEY_WEP104_LEN;
-	qdf_mem_zero(wep_params->wep_default_key_2.data,
-		     WLAN_CRYPTO_KEY_WEP104_LEN);
-
-	wep_params->wep_default_key_3.len = WLAN_CRYPTO_KEY_WEP104_LEN;
-	wep_params->wep_default_key_3.max_len = WLAN_CRYPTO_KEY_WEP104_LEN;
-	qdf_mem_zero(wep_params->wep_default_key_3.data,
-		     WLAN_CRYPTO_KEY_WEP104_LEN);
-
-	wep_params->wep_default_key_4.len = WLAN_CRYPTO_KEY_WEP104_LEN;
-	wep_params->wep_default_key_4.max_len = WLAN_CRYPTO_KEY_WEP104_LEN;
-	qdf_mem_zero(wep_params->wep_default_key_4.data,
-		     WLAN_CRYPTO_KEY_WEP104_LEN);
-}
 
 static void mlme_init_wep_cfg(struct wlan_mlme_wep_cfg *wep_params)
 {
@@ -1993,7 +1964,6 @@ static void mlme_init_wep_cfg(struct wlan_mlme_wep_cfg *wep_params)
 			cfg_default(CFG_OPEN_SYSTEM_AUTH_ENABLE);
 
 	wep_params->wep_default_key_id = cfg_default(CFG_WEP_DEFAULT_KEYID);
-	mlme_init_wep_keys(wep_params);
 }
 
 static void mlme_init_wifi_pos_cfg(struct wlan_objmgr_psoc *psoc,

+ 1 - 12
components/mlme/dispatcher/inc/cfg_mlme_sap.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2020 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2021 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
@@ -23,16 +23,6 @@
 #ifndef __CFG_MLME_SAP_H
 #define __CFG_MLME_SAP_H
 
-#define STR_SSID_DEFAULT "1234567890"
-#define STR_SSID_DEFAULT_LEN sizeof(STR_SSID_DEFAULT)
-
-#define CFG_SSID CFG_STRING( \
-			"cfg_ssid", \
-			0, \
-			STR_SSID_DEFAULT_LEN, \
-			STR_SSID_DEFAULT, \
-			"CFG_SSID")
-
 #define CFG_BEACON_INTERVAL CFG_INI_UINT( \
 			"gBeaconInterval", \
 			0, \
@@ -735,7 +725,6 @@
 #define CFG_SAP_ALL \
 	CFG_SAP_SAE \
 	CFG(CFG_AP_ENABLE_RANDOM_BSSID) \
-	CFG(CFG_SSID) \
 	CFG(CFG_BEACON_INTERVAL) \
 	CFG(CFG_DTIM_PERIOD) \
 	CFG(CFG_LISTEN_INTERVAL) \

+ 0 - 11
components/mlme/dispatcher/inc/wlan_mlme_api.h

@@ -88,17 +88,6 @@ QDF_STATUS mlme_get_wep_key(struct wlan_objmgr_vdev *vdev,
 			    enum wep_key_id wep_keyid, uint8_t *default_key,
 			    qdf_size_t *key_len);
 
-/**
- * mlme_set_wep_key() - set the wep keys during auth
- * @wep_params: cfg wep parametrs structure
- * @wep_key_id: default key number that needs to be copied
- * @key_to_set: destination buffer to be copied
- * @len:        size to be copied
- */
-QDF_STATUS mlme_set_wep_key(struct wlan_mlme_wep_cfg *wep_params,
-			    enum wep_key_id wep_keyid, uint8_t *key_to_set,
-			    qdf_size_t len);
-
 /**
  * wlan_mlme_get_tx_power() - Get the max tx power in particular band
  * @psoc: pointer to psoc object

+ 0 - 10
components/mlme/dispatcher/inc/wlan_mlme_public_struct.h

@@ -742,8 +742,6 @@ struct wlan_mlme_wps_params {
  * @is_6g_sap_fd_enabled: enable fils discovery on sap
  */
 struct wlan_mlme_cfg_sap {
-	uint8_t cfg_ssid[WLAN_SSID_MAX_LEN];
-	uint8_t cfg_ssid_len;
 	uint16_t beacon_interval;
 	uint16_t dtim_interval;
 	uint16_t listen_interval;
@@ -2250,10 +2248,6 @@ enum wep_key_id {
  * @is_auth_open_system:    Flag to check if the auth type is open
  * @auth_type:              Authentication type value
  * @wep_default_key_id:     Default WEP key id
- * @wep_default_key_1:      WEP encryption key 1
- * @wep_default_key_2:      WEP encryption key 2
- * @wep_default_key_3:      WEP encryption key 3
- * @wep_default_key_4:      WEP encryption key 4
  */
 struct wlan_mlme_wep_cfg {
 	bool is_privacy_enabled;
@@ -2261,10 +2255,6 @@ struct wlan_mlme_wep_cfg {
 	bool is_auth_open_system;
 	uint8_t auth_type;
 	uint8_t wep_default_key_id;
-	struct mlme_cfg_str wep_default_key_1;
-	struct mlme_cfg_str wep_default_key_2;
-	struct mlme_cfg_str wep_default_key_3;
-	struct mlme_cfg_str wep_default_key_4;
 };
 
 /**

+ 0 - 42
components/mlme/dispatcher/src/wlan_mlme_api.c

@@ -2638,48 +2638,6 @@ QDF_STATUS mlme_get_wep_key(struct wlan_objmgr_vdev *vdev,
 	return QDF_STATUS_SUCCESS;
 }
 
-QDF_STATUS mlme_set_wep_key(struct wlan_mlme_wep_cfg *wep_params,
-			    enum wep_key_id wep_keyid, uint8_t *key_to_set,
-			    qdf_size_t len)
-{
-	if (len == 0)
-		return QDF_STATUS_E_FAILURE;
-
-	mlme_legacy_debug("WEP set key for key_id:%d key_len:%zd",
-			  wep_keyid, len);
-	switch (wep_keyid) {
-	case MLME_WEP_DEFAULT_KEY_1:
-		wlan_mlme_set_cfg_str(key_to_set,
-				      &wep_params->wep_default_key_1,
-				      len);
-		break;
-
-	case MLME_WEP_DEFAULT_KEY_2:
-		wlan_mlme_set_cfg_str(key_to_set,
-				      &wep_params->wep_default_key_2,
-				      len);
-		break;
-
-	case MLME_WEP_DEFAULT_KEY_3:
-		wlan_mlme_set_cfg_str(key_to_set,
-				      &wep_params->wep_default_key_3,
-				      len);
-		break;
-
-	case MLME_WEP_DEFAULT_KEY_4:
-		wlan_mlme_set_cfg_str(key_to_set,
-				      &wep_params->wep_default_key_4,
-				      len);
-		break;
-
-	default:
-		mlme_legacy_err("Invalid key id:%d", wep_keyid);
-		return QDF_STATUS_E_INVAL;
-	}
-
-	return QDF_STATUS_SUCCESS;
-}
-
 QDF_STATUS
 wlan_mlme_is_11h_enabled(struct wlan_objmgr_psoc *psoc, bool *value)
 {

+ 4 - 1
components/umac/mlme/connection_mgr/core/src/wlan_cm_vdev_connect.c

@@ -1016,7 +1016,10 @@ QDF_STATUS wlan_cm_send_connect_rsp(struct scheduler_msg *msg)
 		}
 	}
 	cm_csr_connect_rsp(vdev, rsp);
-	status = wlan_cm_connect_rsp(vdev, &rsp->connect_rsp);
+	if (rsp->connect_rsp.is_reassoc)
+		status = wlan_cm_reassoc_rsp(vdev, &rsp->connect_rsp);
+	else
+		status = wlan_cm_connect_rsp(vdev, &rsp->connect_rsp);
 	wlan_objmgr_vdev_release_ref(vdev, WLAN_MLME_CM_ID);
 
 	wlan_cm_free_connect_rsp(rsp);

+ 115 - 9
core/mac/inc/sir_api.h

@@ -51,6 +51,9 @@ struct mac_context;
 #include "wlan_cp_stats_mc_defs.h"
 
 #define OFFSET_OF(structType, fldName)   (&((structType *)0)->fldName)
+#define WLAN_DOT11_BASIC_RATE_MASK (0x80)
+#define BITS_ON(_Field, _Bitmask)  ((_Field) |=  (_Bitmask))
+#define BITS_OFF(_Field, _Bitmask) ((_Field) &= ~(_Bitmask))
 
 /* / Max supported channel list */
 #define SIR_MAX_SUPPORTED_CHANNEL_LIST      96
@@ -178,6 +181,112 @@ enum ps_state {
 	UAPSD_MODE
 };
 
+/**
+ * \var g_phy_rates_suppt
+ *
+ * \brief Rate support lookup table
+ *
+ *
+ * This is a  lookup table indexing rates &  configuration parameters to
+ * support.  Given a rate (in  unites of 0.5Mpbs) & three bools (MIMO
+ * Enabled, Channel  Bonding Enabled, & Concatenation  Enabled), one can
+ * determine  whether  the given  rate  is  supported  by computing  two
+ * indices.  The  first maps  the rate to  table row as  indicated below
+ * (i.e. eHddSuppRate_6Mbps maps to  row zero, eHddSuppRate_9Mbps to row
+ * 1, and so on).  Index two can be computed like so:
+ *
+ * \code
+ *  idx2 = ( fEsf  ? 0x4 : 0x0 ) |
+ *         ( fCb   ? 0x2 : 0x0 ) |
+ *         ( fMimo ? 0x1 : 0x0 );
+ * \endcode
+ *
+ *
+ * Given that:
+ *
+ *  \code
+ *  fSupported = g_phy_rates_suppt[idx1][idx2];
+ *  \endcode
+ *
+ *
+ * This table is based on  the document "PHY Supported Rates.doc".  This
+ * table is  permissive in that a  rate is reflected  as being supported
+ * even  when turning  off an  enabled feature  would be  required.  For
+ * instance, "PHY Supported Rates"  lists 42Mpbs as unsupported when CB,
+ * ESF, &  MIMO are all  on.  However,  if we turn  off either of  CB or
+ * MIMO, it then becomes supported.   Therefore, we mark it as supported
+ * even in index 7 of this table.
+ *
+ *
+ */
+
+static const bool g_phy_rates_suppt[24][8] = {
+
+	/* SSF   SSF    SSF    SSF    ESF    ESF    ESF    ESF */
+	/* SIMO  MIMO   SIMO   MIMO   SIMO   MIMO   SIMO   MIMO */
+	/* No CB No CB  CB     CB     No CB  No CB  CB     CB */
+	{true, true, true, true, true, true, true, true},       /* 6Mbps */
+	{true, true, true, true, true, true, true, true},       /* 9Mbps */
+	{true, true, true, true, true, true, true, true},       /* 12Mbps */
+	{true, true, true, true, true, true, true, true},       /* 18Mbps */
+	{false, false, true, true, false, false, true, true},   /* 20Mbps */
+	{true, true, true, true, true, true, true, true},       /* 24Mbps */
+	{true, true, true, true, true, true, true, true},       /* 36Mbps */
+	{false, false, true, true, false, true, true, true},    /* 40Mbps */
+	{false, false, true, true, false, true, true, true},    /* 42Mbps */
+	{true, true, true, true, true, true, true, true},       /* 48Mbps */
+	{true, true, true, true, true, true, true, true},       /* 54Mbps */
+	{false, true, true, true, false, true, true, true},     /* 72Mbps */
+	{false, false, true, true, false, true, true, true},    /* 80Mbps */
+	{false, false, true, true, false, true, true, true},    /* 84Mbps */
+	{false, true, true, true, false, true, true, true},     /* 96Mbps */
+	{false, true, true, true, false, true, true, true},     /* 108Mbps */
+	{false, false, true, true, false, true, true, true},    /* 120Mbps */
+	{false, false, true, true, false, true, true, true},    /* 126Mbps */
+	{false, false, false, true, false, false, false, true}, /* 144Mbps */
+	{false, false, false, true, false, false, false, true}, /* 160Mbps */
+	{false, false, false, true, false, false, false, true}, /* 168Mbps */
+	{false, false, false, true, false, false, false, true}, /* 192Mbps */
+	{false, false, false, true, false, false, false, true}, /* 216Mbps */
+	{false, false, false, true, false, false, false, true}, /* 240Mbps */
+};
+
+typedef enum {
+	/* 11b rates */
+	SUPP_RATE_1_MBPS   =   1 * 2,
+	SUPP_RATE_2_MBPS   =   2 * 2,
+	SUPP_RATE_5_MBPS =     11,
+	SUPP_RATE_11_MBPS  =   11 * 2,
+
+	/* 11a / 11g rates */
+	SUPP_RATE_6_MBPS   =   6 * 2,
+	SUPP_RATE_9_MBPS   =   9 * 2,
+	SUPP_RATE_12_MBPS  =   12 * 2,
+	SUPP_RATE_18_MBPS  =   18 * 2,
+	SUPP_RATE_24_MBPS  =   24 * 2,
+	SUPP_RATE_36_MBPS  =   36 * 2,
+	SUPP_RATE_48_MBPS  =   48 * 2,
+	SUPP_RATE_54_MBPS  =   54 * 2,
+
+	/* Airgo prop. rates */
+	SUPP_RATE_20_MBPS   =  20 * 2,
+	SUPP_RATE_40_MBPS   =  40 * 2,
+	SUPP_RATE_42_MBPS   =  42 * 2,
+	SUPP_RATE_72_MBPS   =  72 * 2,
+	SUPP_RATE_80_MBPS   =  80 * 2,
+	SUPP_RATE_84_MBPS   =  84 * 2,
+	SUPP_RATE_96_MBPS   =  96 * 2,
+	SUPP_RATE_108_MBPS  =  108 * 2,
+	SUPP_RATE_120_MBPS  =  120 * 2,
+	SUPP_RATE_126_MBPS  =  126 * 2,
+	SUPP_RATE_144_MBPS  =  144 * 2,
+	SUPP_RATE_160_MBPS  =  160 * 2,
+	SUPP_RATE_168_MBPS  =  168 * 2,
+	SUPP_RATE_192_MBPS  =  192 * 2,
+	SUPP_RATE_216_MBPS  =  216 * 2,
+	SUPP_RATE_240_MBPS  =  240 * 2
+} eCsrSupportedRates;
+
 /**
  * struct ps_params - maintain power save state and USAPD params
  * @mac_ctx: mac_ctx
@@ -925,29 +1034,26 @@ struct join_req {
 	uint16_t length;
 	uint8_t vdev_id;
 	tSirMacSSid ssId;
-	uint8_t dot11mode;      /* to support BT-AMP */
-	bool wps_registration;
-
-	tSirMacRateSet operationalRateSet;      /* Has 11a or 11b rates */
-	tSirMacRateSet extendedRateSet; /* Has 11g rates */
 	tSirRSNie rsnIE;        /* RSN IE to be sent in */
 	tSirAddie addIEScan;    /* Additional IE to be sent in */
 	/* (unicast) Probe Request at the time of join */
 
 	tSirAddie addIEAssoc;   /* Additional IE to be sent in */
 	/* (Re) Association Request */
-
+#ifndef FEATURE_CM_ENABLE
 	tAniEdType UCEncryptionType;
 	enum ani_akm_type akm;
+	bool wps_registration;
+	bool isOSENConnection;
+	bool force_24ghz_in_ht20;
+#endif
 
 #ifdef FEATURE_WLAN_ESE
 	tESETspecInfo eseTspecInfo;
 #endif
-	bool isOSENConnection;
 	struct supported_channels supportedChannels;
-	/* Pls make this as last variable in struct */
-	bool force_24ghz_in_ht20;
 	bool force_rsne_override;
+	/* Pls make this as last variable in struct */
 	struct bss_description bssDescription;
 	/*
 	 * WARNING: Pls make bssDescription as last variable in struct

+ 16 - 1
core/mac/src/include/parser_api.h

@@ -850,7 +850,7 @@ populate_dot11f_ssid(struct mac_context *mac,
 		tSirMacSSid *pInternal, tDot11fIESSID *pDot11f);
 
 /* / Populate a tDot11fIESSID from CFG */
-QDF_STATUS populate_dot11f_ssid2(struct mac_context *mac,
+QDF_STATUS populate_dot11f_ssid2(struct pe_session *pe_session,
 				tDot11fIESSID *pDot11f);
 
 /**
@@ -1275,6 +1275,9 @@ wlan_get_parsed_bss_description_ies(struct mac_context *mac_ctx,
 				    struct bss_description *bss_desc,
 				    tDot11fBeaconIEs **ie_struct);
 
+void wlan_populate_basic_rates(tSirMacRateSet *rate_set, bool is_ofdm_rates,
+			       bool is_basic_rates);
+
 uint32_t wlan_get_11h_power_constraint(struct mac_context *mac_ctx,
 				       tDot11fIEPowerConstraints *constraints);
 
@@ -1296,6 +1299,18 @@ wlan_fill_bss_desc_from_scan_entry(struct mac_context *mac_ctx,
 uint16_t
 wlan_get_ielen_from_bss_description(struct bss_description *bss_desc);
 
+bool wlan_rates_is_dot11_rate_supported(struct mac_context *mac_ctx,
+					uint8_t rate);
+
+bool wlan_check_rate_bitmap(uint8_t rate, uint16_t rate_bitmap);
+
+QDF_STATUS wlan_get_rate_set(struct mac_context *mac,
+			     tDot11fBeaconIEs *ie_struct,
+			     tSirMacRateSet *op_rate,
+			     tSirMacRateSet *ext_rate);
+
+void wlan_add_rate_bitmap(uint8_t rate, uint16_t *rate_bitmap);
+
 /**
  * dot11f_parse_assoc_response() - API to parse Assoc IE buffer to struct
  * @mac_ctx: MAC context

+ 100 - 81
core/mac/src/pe/lim/lim_process_sme_req_messages.c

@@ -473,6 +473,55 @@ lim_configure_ap_start_bss_session(struct mac_context *mac_ctx,
 
 }
 
+static void lim_set_privacy(struct mac_context *mac_ctx,
+			    int32_t ucast_cipher,
+			    int32_t auth_mode, int32_t akm, bool ap_privacy)
+{
+	bool rsn_enabled, privacy;
+
+	/* set default to open */
+	mac_ctx->mlme_cfg->wep_params.auth_type = eSIR_OPEN_SYSTEM;
+	if (QDF_HAS_PARAM(auth_mode, WLAN_CRYPTO_AUTH_AUTO) &&
+	    (QDF_HAS_PARAM(ucast_cipher, WLAN_CRYPTO_CIPHER_WEP) ||
+	     QDF_HAS_PARAM(ucast_cipher, WLAN_CRYPTO_CIPHER_WEP_40) ||
+	     QDF_HAS_PARAM(ucast_cipher, WLAN_CRYPTO_CIPHER_WEP_104)))
+		mac_ctx->mlme_cfg->wep_params.auth_type = eSIR_AUTO_SWITCH;
+	else if (QDF_HAS_PARAM(auth_mode, WLAN_CRYPTO_AUTH_SHARED))
+		mac_ctx->mlme_cfg->wep_params.auth_type = eSIR_SHARED_KEY;
+	else if (QDF_HAS_PARAM(akm, WLAN_CRYPTO_KEY_MGMT_FT_SAE) ||
+	    QDF_HAS_PARAM(akm, WLAN_CRYPTO_KEY_MGMT_SAE))
+		mac_ctx->mlme_cfg->wep_params.auth_type = eSIR_AUTH_TYPE_SAE;
+
+	if (QDF_HAS_PARAM(ucast_cipher, WLAN_CRYPTO_CIPHER_WEP) ||
+	     QDF_HAS_PARAM(ucast_cipher, WLAN_CRYPTO_CIPHER_WEP_40) ||
+	     QDF_HAS_PARAM(ucast_cipher, WLAN_CRYPTO_CIPHER_WEP_104)) {
+		privacy = true;
+		rsn_enabled = false;
+	} else if (QDF_HAS_PARAM(ucast_cipher, WLAN_CRYPTO_CIPHER_TKIP) ||
+		   QDF_HAS_PARAM(ucast_cipher, WLAN_CRYPTO_CIPHER_AES_CCM) ||
+		   QDF_HAS_PARAM(ucast_cipher, WLAN_CRYPTO_CIPHER_AES_OCB) ||
+		   QDF_HAS_PARAM(ucast_cipher,
+				 WLAN_CRYPTO_CIPHER_AES_CCM_256) ||
+		   QDF_HAS_PARAM(ucast_cipher, WLAN_CRYPTO_CIPHER_AES_GCM) ||
+		   QDF_HAS_PARAM(ucast_cipher,
+				 WLAN_CRYPTO_CIPHER_AES_GCM_256) ||
+		   QDF_HAS_PARAM(ucast_cipher, WLAN_CRYPTO_CIPHER_WAPI_GCM4) ||
+		   QDF_HAS_PARAM(ucast_cipher, WLAN_CRYPTO_CIPHER_WAPI_SMS4)) {
+		privacy = ap_privacy;
+		rsn_enabled = true;
+	} else {
+		rsn_enabled = false;
+		privacy = false;
+	}
+
+	mac_ctx->mlme_cfg->feature_flags.enable_rsn = rsn_enabled;
+	mac_ctx->mlme_cfg->wep_params.is_privacy_enabled = privacy;
+	mac_ctx->mlme_cfg->wep_params.wep_default_key_id = 0;
+	pe_debug("rsn_enabled %d privacy %d ucast_cipher %x auth_mode %x akm %x auth_type %d",
+		 rsn_enabled, privacy, ucast_cipher, auth_mode, akm,
+		 mac_ctx->mlme_cfg->wep_params.auth_type);
+}
+
 /**
  * lim_send_start_vdev_req() - send vdev start request
  *@session: pe session
@@ -616,6 +665,9 @@ __lim_handle_sme_start_bss_request(struct mac_context *mac_ctx, uint32_t *msg_bu
 	uint32_t chanwidth;
 	struct vdev_type_nss *vdev_type_nss;
 	QDF_STATUS qdf_status = QDF_STATUS_SUCCESS;
+	int32_t ucast_cipher;
+	int32_t auth_mode;
+	int32_t akm;
 
 /* FEATURE_WLAN_DIAG_SUPPORT */
 #ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM
@@ -728,6 +780,15 @@ __lim_handle_sme_start_bss_request(struct mac_context *mac_ctx, uint32_t *msg_bu
 			mac_ctx->pdev, session->curr_op_freq);
 		/* Store the dot 11 mode in to the session Table */
 		session->dot11mode = sme_start_bss_req->dot11mode;
+		ucast_cipher = wlan_crypto_get_param(session->vdev,
+					WLAN_CRYPTO_PARAM_UCAST_CIPHER);
+		auth_mode = wlan_crypto_get_param(session->vdev,
+					WLAN_CRYPTO_PARAM_AUTH_MODE);
+		akm = wlan_crypto_get_param(session->vdev,
+					    WLAN_CRYPTO_PARAM_KEY_MGMT);
+
+		lim_set_privacy(mac_ctx, ucast_cipher, auth_mode, akm,
+				sme_start_bss_req->privacy);
 #ifdef FEATURE_WLAN_MCC_TO_SCC_SWITCH
 		session->cc_switch_mode =
 			sme_start_bss_req->cc_switch_mode;
@@ -2415,6 +2476,19 @@ lim_fill_ese_params(struct mac_context *mac_ctx, struct pe_session *session,
 }
 #endif
 
+static void lim_get_basic_rates(tSirMacRateSet *b_rates, uint32_t chan_freq)
+{
+	/*
+	 * Some IOT APs don't send supported rates in
+	 * probe resp, hence add BSS basic rates in
+	 * supported rates IE of assoc request.
+	 */
+	if (WLAN_REG_IS_24GHZ_CH_FREQ(chan_freq))
+		wlan_populate_basic_rates(b_rates, false, true);
+	else if (WLAN_REG_IS_5GHZ_CH_FREQ(chan_freq))
+		wlan_populate_basic_rates(b_rates, true, true);
+}
+
 static QDF_STATUS
 lim_fill_pe_session(struct mac_context *mac_ctx, struct pe_session *session,
 		    struct bss_description *bss_desc)
@@ -2491,6 +2565,13 @@ lim_fill_pe_session(struct mac_context *mac_ctx, struct pe_session *session,
 		return QDF_STATUS_E_FAILURE;
 	}
 
+	status = wlan_get_rate_set(mac_ctx, ie_struct, &session->rateSet,
+				   &session->extRateSet);
+	if (QDF_IS_STATUS_ERROR(status)) {
+		pe_err("Get rate failed vdev id %d", session->vdev_id);
+		lim_get_basic_rates(&session->rateSet, bss_desc->chan_freq);
+	}
+
 	if (session->dot11mode == MLME_DOT11_MODE_11B)
 		mac_ctx->mlme_cfg->feature_flags.enable_short_slot_time_11g = 0;
 	else
@@ -3249,7 +3330,6 @@ lim_fill_wapi_ie(struct mac_context *mac_ctx, struct pe_session *session,
 }
 #endif
 
-
 static void lim_fill_crypto_params(struct mac_context *mac_ctx,
 				   struct pe_session *session,
 				   struct cm_vdev_join_req *req)
@@ -3258,7 +3338,6 @@ static void lim_fill_crypto_params(struct mac_context *mac_ctx,
 	int32_t auth_mode;
 	int32_t akm;
 	tSirMacCapabilityInfo *ap_cap_info;
-	bool rsn_enabled, privacy;
 
 	ucast_cipher = wlan_crypto_get_param(session->vdev,
 					     WLAN_CRYPTO_PARAM_UCAST_CIPHER);
@@ -3266,51 +3345,11 @@ static void lim_fill_crypto_params(struct mac_context *mac_ctx,
 					  WLAN_CRYPTO_PARAM_AUTH_MODE);
 	akm = wlan_crypto_get_param(session->vdev,
 				    WLAN_CRYPTO_PARAM_KEY_MGMT);
-
-	/* set default to open */
-	mac_ctx->mlme_cfg->wep_params.auth_type = eSIR_OPEN_SYSTEM;
 	ap_cap_info = (tSirMacCapabilityInfo *)
-		&session->lim_join_req->bssDescription.capabilityInfo;
-
-	if (QDF_HAS_PARAM(auth_mode, WLAN_CRYPTO_AUTH_AUTO) &&
-	    (QDF_HAS_PARAM(ucast_cipher, WLAN_CRYPTO_CIPHER_WEP) ||
-	     QDF_HAS_PARAM(ucast_cipher, WLAN_CRYPTO_CIPHER_WEP_40) ||
-	     QDF_HAS_PARAM(ucast_cipher, WLAN_CRYPTO_CIPHER_WEP_104)))
-		mac_ctx->mlme_cfg->wep_params.auth_type = eSIR_AUTO_SWITCH;
-	else if (QDF_HAS_PARAM(auth_mode, WLAN_CRYPTO_AUTH_SHARED))
-		mac_ctx->mlme_cfg->wep_params.auth_type = eSIR_SHARED_KEY;
-	else if (QDF_HAS_PARAM(akm, WLAN_CRYPTO_KEY_MGMT_FT_SAE) ||
-	    QDF_HAS_PARAM(akm, WLAN_CRYPTO_KEY_MGMT_SAE))
-		mac_ctx->mlme_cfg->wep_params.auth_type = eSIR_AUTH_TYPE_SAE;
-
-	if (QDF_HAS_PARAM(ucast_cipher, WLAN_CRYPTO_CIPHER_WEP) ||
-	     QDF_HAS_PARAM(ucast_cipher, WLAN_CRYPTO_CIPHER_WEP_40) ||
-	     QDF_HAS_PARAM(ucast_cipher, WLAN_CRYPTO_CIPHER_WEP_104)) {
-		privacy = true;
-		rsn_enabled = false;
-	} else if (QDF_HAS_PARAM(ucast_cipher, WLAN_CRYPTO_CIPHER_TKIP) ||
-		   QDF_HAS_PARAM(ucast_cipher, WLAN_CRYPTO_CIPHER_AES_CCM) ||
-		   QDF_HAS_PARAM(ucast_cipher, WLAN_CRYPTO_CIPHER_AES_OCB) ||
-		   QDF_HAS_PARAM(ucast_cipher,
-				 WLAN_CRYPTO_CIPHER_AES_CCM_256) ||
-		   QDF_HAS_PARAM(ucast_cipher, WLAN_CRYPTO_CIPHER_AES_GCM) ||
-		   QDF_HAS_PARAM(ucast_cipher,
-				 WLAN_CRYPTO_CIPHER_AES_GCM_256) ||
-		   QDF_HAS_PARAM(ucast_cipher, WLAN_CRYPTO_CIPHER_WAPI_GCM4) ||
-		   QDF_HAS_PARAM(ucast_cipher, WLAN_CRYPTO_CIPHER_WAPI_SMS4)) {
-		privacy = ap_cap_info->privacy;
-		rsn_enabled = true;
-	} else {
-		rsn_enabled = false;
-		privacy = false;
-	}
+			&session->lim_join_req->bssDescription.capabilityInfo;
 
-	mac_ctx->mlme_cfg->feature_flags.enable_rsn = rsn_enabled;
-	mac_ctx->mlme_cfg->wep_params.is_privacy_enabled = privacy;
-	mac_ctx->mlme_cfg->wep_params.wep_default_key_id = 0;
-	pe_debug("rsn_enabled %d privacy %d ucast_cipher %x auth_mode %x akm %x auth_type %d",
-		 rsn_enabled, privacy, ucast_cipher, auth_mode, akm,
-		 mac_ctx->mlme_cfg->wep_params.auth_type);
+	lim_set_privacy(mac_ctx, ucast_cipher, auth_mode, akm,
+			ap_cap_info->privacy);
 	session->encryptType = lim_get_encrypt_ed_type(ucast_cipher);
 	session->connected_akm = lim_get_connected_akm(session, ucast_cipher,
 						       auth_mode, akm);
@@ -3338,7 +3377,6 @@ lim_fill_session_params(struct mac_context *mac_ctx,
 	uint32_t ie_len;
 	uint32_t bss_len;
 	struct join_req *pe_join_req;
-	qdf_size_t op_rate_len, ext_rate_len;
 
 	ie_len = util_scan_entry_ie_len(req->entry);
 	bss_len = (uint16_t)(offsetof(struct bss_description,
@@ -3380,26 +3418,6 @@ lim_fill_session_params(struct mac_context *mac_ctx,
 		return QDF_STATUS_E_FAILURE;
 	}
 
-	status = mlme_get_opr_rate(session->vdev, session->rateSet.rate,
-				   &op_rate_len);
-
-	if (QDF_IS_STATUS_ERROR(status)) {
-		qdf_mem_free(session->lim_join_req);
-		session->lim_join_req = NULL;
-		return QDF_STATUS_E_FAILURE;
-	}
-
-	status = mlme_get_ext_opr_rate(session->vdev, session->extRateSet.rate,
-				       &ext_rate_len);
-
-	if (QDF_IS_STATUS_ERROR(status)) {
-		qdf_mem_free(session->lim_join_req);
-		session->lim_join_req = NULL;
-		return QDF_STATUS_E_FAILURE;
-	}
-
-	session->rateSet.numRates = op_rate_len;
-	session->extRateSet.numRates = ext_rate_len;
 	pe_debug("Assoc IE len: %d", req->assoc_ie.len);
 	if (req->assoc_ie.len)
 		QDF_TRACE_HEX_DUMP(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_DEBUG,
@@ -3485,7 +3503,7 @@ fail:
 		pe_delete_session(mac_ctx, pe_session);
 
 	lim_cm_send_connect_rsp(mac_ctx, NULL, req, CM_GENERIC_FAILURE,
-				QDF_STATUS_E_FAILURE, 0);
+				QDF_STATUS_E_FAILURE, 0, false);
 	return QDF_STATUS_E_FAILURE;
 }
 
@@ -3840,14 +3858,6 @@ __lim_process_sme_join_req(struct mac_context *mac_ctx, void *msg_buf)
 				     &sme_join_req->addIEAssoc,
 				     sizeof(tSirAddie));
 
-		/* copy operational rate from session */
-		qdf_mem_copy((void *)&session->rateSet,
-			(void *)&sme_join_req->operationalRateSet,
-			sizeof(tSirMacRateSet));
-		qdf_mem_copy((void *)&session->extRateSet,
-			(void *)&sme_join_req->extendedRateSet,
-			sizeof(tSirMacRateSet));
-
 		session->isOSENConnection = sme_join_req->isOSENConnection;
 		pe_debug("Freq %d width %d freq0 %d freq1 %d, Smps %d: mode %d action %d, nss 1x1 %d vdev_nss %d nss %d cbMode %d dot11mode %d subfer %d subfee %d csn %d is_cisco %d",
 			 session->curr_op_freq, session->ch_width,
@@ -4336,6 +4346,9 @@ static void __lim_process_sme_reassoc_req(struct mac_context *mac_ctx,
 	struct bss_description *bss_desc;
 	uint8_t wmm_mode, value;
 	bool is_pwr_constraint;
+	int32_t ucast_cipher;
+	int32_t auth_mode;
+	int32_t akm;
 
 	vdev_id = in_req->vdev_id;
 
@@ -4383,7 +4396,7 @@ static void __lim_process_sme_reassoc_req(struct mac_context *mac_ctx,
 	session_entry->pLimReAssocReq = reassoc_req;
 
 	status = wlan_get_parsed_bss_description_ies(mac_ctx,
-				&session_entry->lim_join_req->bssDescription,
+				&session_entry->pLimReAssocReq->bssDescription,
 				&ie_struct);
 	if (QDF_IS_STATUS_ERROR(status)) {
 		pe_err("IE parsing failed vdev id %d",
@@ -4392,9 +4405,17 @@ static void __lim_process_sme_reassoc_req(struct mac_context *mac_ctx,
 		goto end;
 	}
 
-	session_entry->dot11mode = reassoc_req->dot11mode;
-	session_entry->vhtCapability =
-		IS_DOT11_MODE_VHT(reassoc_req->dot11mode);
+	ucast_cipher = wlan_crypto_get_param(session_entry->vdev,
+					     WLAN_CRYPTO_PARAM_UCAST_CIPHER);
+	auth_mode = wlan_crypto_get_param(session_entry->vdev,
+					  WLAN_CRYPTO_PARAM_AUTH_MODE);
+	akm = wlan_crypto_get_param(session_entry->vdev,
+				    WLAN_CRYPTO_PARAM_KEY_MGMT);
+	ap_cap_info = (tSirMacCapabilityInfo *)
+		&session_entry->pLimReAssocReq->bssDescription.capabilityInfo;
+
+	lim_set_privacy(mac_ctx, ucast_cipher, auth_mode, akm,
+			ap_cap_info->privacy);
 
 	if (session_entry->vhtCapability) {
 		if (session_entry->opmode == QDF_STA_MODE) {
@@ -4601,8 +4622,6 @@ static void __lim_process_sme_reassoc_req(struct mac_context *mac_ctx,
 		val = mac_ctx->mlme_cfg->sap_cfg.listen_interval;
 
 	mlm_reassoc_req->listenInterval = (uint16_t) val;
-
-	ap_cap_info = (tSirMacCapabilityInfo *)&bss_desc->capabilityInfo;
 	if (mac_ctx->mlme_cfg->gen.enabled_11h &&
 	    ap_cap_info->spectrumMgt && bss_desc->nwType == eSIR_11A_NW_TYPE)
 		session_entry->spectrumMgtEnabled = true;

+ 2 - 2
core/mac/src/pe/lim/lim_send_frames_host_roam.c

@@ -134,7 +134,7 @@ void lim_send_reassoc_req_with_ft_ies_mgmt_frame(struct mac_context *mac_ctx,
 	qdf_mem_copy((uint8_t *)frm->CurrentAPAddress.mac,
 			pe_session->prev_ap_bssid, sizeof(tSirMacAddr));
 
-	populate_dot11f_ssid2(mac_ctx, &frm->SSID);
+	populate_dot11f_ssid2(pe_session, &frm->SSID);
 	populate_dot11f_supp_rates(mac_ctx, POPULATE_DOT11F_RATES_OPERATIONAL,
 		&frm->SuppRates, pe_session);
 
@@ -600,7 +600,7 @@ void lim_send_reassoc_req_mgmt_frame(struct mac_context *mac,
 	qdf_mem_copy((uint8_t *) frm->CurrentAPAddress.mac,
 		     (uint8_t *) pe_session->bssId, 6);
 
-	populate_dot11f_ssid2(mac, &frm->SSID);
+	populate_dot11f_ssid2(pe_session, &frm->SSID);
 	populate_dot11f_supp_rates(mac, POPULATE_DOT11F_RATES_OPERATIONAL,
 				   &frm->SuppRates, pe_session);
 

+ 1 - 5
core/mac/src/pe/lim/lim_send_management_frames.c

@@ -2147,11 +2147,7 @@ lim_send_assoc_req_mgmt_frame(struct mac_context *mac_ctx,
 
 	frm->ListenInterval.interval = mlm_assoc_req->listenInterval;
 
-	qdf_mem_copy(frm->SSID.ssid, pe_session->ssId.ssId,
-		     pe_session->ssId.length);
-	frm->SSID.present = 1;
-	frm->SSID.num_ssid = pe_session->ssId.length;
-
+	populate_dot11f_ssid2(pe_session, &frm->SSID);
 	populate_dot11f_supp_rates(mac_ctx, POPULATE_DOT11F_RATES_OPERATIONAL,
 		&frm->SuppRates, pe_session);
 

+ 8 - 5
core/mac/src/pe/lim/lim_send_sme_rsp_messages.c

@@ -389,7 +389,8 @@ void lim_cm_send_connect_rsp(struct mac_context *mac_ctx,
 			     struct cm_vdev_join_req *req,
 			     enum wlan_cm_connect_fail_reason reason,
 			     QDF_STATUS connect_status,
-			     enum wlan_status_code status_code)
+			     enum wlan_status_code status_code,
+			     bool is_reassoc)
 {
 	struct cm_vdev_join_rsp *rsp;
 	QDF_STATUS status;
@@ -424,6 +425,7 @@ void lim_cm_send_connect_rsp(struct mac_context *mac_ctx,
 		}
 	}
 
+	rsp->connect_rsp.is_reassoc = is_reassoc;
 	qdf_mem_zero(&msg, sizeof(msg));
 
 	msg.bodyptr = rsp;
@@ -522,10 +524,11 @@ void lim_send_sme_join_reassoc_rsp(struct mac_context *mac_ctx,
 			lim_cm_get_fail_reason_from_result_code(result_code);
 	}
 
-	if (msg_type == eWNI_SME_JOIN_RSP)
-		return lim_cm_send_connect_rsp(mac_ctx, session_entry, NULL,
-					       fail_reason, connect_status,
-					       prot_status_code);
+	return lim_cm_send_connect_rsp(mac_ctx, session_entry, NULL,
+				       fail_reason, connect_status,
+				       prot_status_code,
+				       msg_type == eWNI_SME_JOIN_RSP ?
+				       false : true);
 
 	/* add reassoc resp API */
 }

+ 3 - 1
core/mac/src/pe/lim/lim_send_sme_rsp_messages.h

@@ -103,6 +103,7 @@ void lim_send_sme_join_reassoc_rsp(struct mac_context *mac_ctx,
  * @reason: reason of failure, valid only if status is failure
  * @connect_status: Indicates the staus of the req
  * @status_code: Protocol Status Code
+ * @is_reassoc: if reassoc resp
  *
  * Return: None
  */
@@ -111,7 +112,8 @@ void lim_cm_send_connect_rsp(struct mac_context *mac_ctx,
 			     struct cm_vdev_join_req *req,
 			     enum wlan_cm_connect_fail_reason reason,
 			     QDF_STATUS connect_status,
-			     enum wlan_status_code status_code);
+			     enum wlan_status_code status_code,
+			     bool is_reassoc);
 #endif
 
 /**

+ 387 - 5
core/mac/src/sys/legacy/src/utils/src/parser_api.c

@@ -1868,13 +1868,14 @@ populate_dot11f_ssid(struct mac_context *mac,
 	}
 } /* End populate_dot11f_ssid. */
 
-QDF_STATUS populate_dot11f_ssid2(struct mac_context *mac, tDot11fIESSID *pDot11f)
+QDF_STATUS populate_dot11f_ssid2(struct pe_session *pe_session,
+				 tDot11fIESSID *pDot11f)
 {
-
-	qdf_mem_copy(pDot11f->ssid, mac->mlme_cfg->sap_cfg.cfg_ssid,
-		     mac->mlme_cfg->sap_cfg.cfg_ssid_len);
-	pDot11f->num_ssid = mac->mlme_cfg->sap_cfg.cfg_ssid_len;
+	qdf_mem_copy(pDot11f->ssid, pe_session->ssId.ssId,
+		     pe_session->ssId.length);
+	pDot11f->num_ssid = pe_session->ssId.length;
 	pDot11f->present = 1;
+
 	return QDF_STATUS_SUCCESS;
 } /* End populate_dot11f_ssid2. */
 
@@ -6700,6 +6701,387 @@ wlan_get_parsed_bss_description_ies(struct mac_context *mac_ctx,
 	return status;
 }
 
+void
+wlan_populate_basic_rates(tSirMacRateSet *rate_set, bool is_ofdm_rates,
+			  bool is_basic_rates)
+{
+	int i = 0;
+	uint8_t ofdm_rates[8] = {
+		SIR_MAC_RATE_6,
+		SIR_MAC_RATE_9,
+		SIR_MAC_RATE_12,
+		SIR_MAC_RATE_18,
+		SIR_MAC_RATE_24,
+		SIR_MAC_RATE_36,
+		SIR_MAC_RATE_48,
+		SIR_MAC_RATE_54
+	};
+	uint8_t cck_rates[4] = {
+		SIR_MAC_RATE_1,
+		SIR_MAC_RATE_2,
+		SIR_MAC_RATE_5_5,
+		SIR_MAC_RATE_11
+	};
+
+	if (is_ofdm_rates == true) {
+		rate_set->numRates = 8;
+		qdf_mem_copy(rate_set->rate, ofdm_rates, sizeof(ofdm_rates));
+		if (is_basic_rates) {
+			rate_set->rate[0] |= WLAN_DOT11_BASIC_RATE_MASK;
+			rate_set->rate[2] |= WLAN_DOT11_BASIC_RATE_MASK;
+			rate_set->rate[4] |= WLAN_DOT11_BASIC_RATE_MASK;
+		}
+		for (i = 0; i < rate_set->numRates; i++)
+			QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG,
+			("Default OFDM rate is %2x"), rate_set->rate[i]);
+	} else {
+		rate_set->numRates = 4;
+		qdf_mem_copy(rate_set->rate, cck_rates, sizeof(cck_rates));
+		if (is_basic_rates) {
+			rate_set->rate[0] |= WLAN_DOT11_BASIC_RATE_MASK;
+			rate_set->rate[1] |= WLAN_DOT11_BASIC_RATE_MASK;
+			rate_set->rate[2] |= WLAN_DOT11_BASIC_RATE_MASK;
+			rate_set->rate[3] |= WLAN_DOT11_BASIC_RATE_MASK;
+		}
+		for (i = 0; i < rate_set->numRates; i++)
+			QDF_TRACE(QDF_MODULE_ID_PE, QDF_TRACE_LEVEL_DEBUG,
+			("Default CCK rate is %2x"), rate_set->rate[i]);
+	}
+}
+
+/**
+ * wlan_is_aggregate_rate_supported() - to check if aggregate rate is supported
+ * @mac_ctx: pointer to mac context
+ * @rate: A rate in units of 500kbps
+ *
+ *
+ * The rate encoding  is just as in 802.11  Information Elements, except
+ * that the high bit is \em  not interpreted as indicating a Basic Rate,
+ * and proprietary rates are allowed, too.
+ *
+ * Note  that if the  adapter's dot11Mode  is g,  we don't  restrict the
+ * rates.  According to hwReadEepromParameters, this will happen when:
+ * ... the  card is  configured for ALL  bands through  the property
+ * page.  If this occurs, and the card is not an ABG card ,then this
+ * code  is  setting the  dot11Mode  to  assume  the mode  that  the
+ * hardware can support.   For example, if the card  is an 11BG card
+ * and we  are configured to support  ALL bands, then  we change the
+ * dot11Mode  to 11g  because  ALL in  this  case is  only what  the
+ * hardware can support.
+ *
+ * Return: true if  the adapter is currently capable of supporting this rate
+ */
+
+static bool wlan_is_aggregate_rate_supported(struct mac_context *mac_ctx,
+					     uint16_t rate)
+{
+	bool supported = false;
+	uint16_t idx, new_rate;
+	enum mlme_dot11_mode self_dot11_mode =
+				mac_ctx->mlme_cfg->dot11_mode.dot11_mode;
+
+	/* In case basic rate flag is set */
+	new_rate = BITS_OFF(rate, WLAN_DOT11_BASIC_RATE_MASK);
+	if (self_dot11_mode == MLME_DOT11_MODE_11A) {
+		switch (new_rate) {
+		case SUPP_RATE_6_MBPS:
+		case SUPP_RATE_9_MBPS:
+		case SUPP_RATE_12_MBPS:
+		case SUPP_RATE_18_MBPS:
+		case SUPP_RATE_24_MBPS:
+		case SUPP_RATE_36_MBPS:
+		case SUPP_RATE_48_MBPS:
+		case SUPP_RATE_54_MBPS:
+			supported = true;
+			break;
+		default:
+			supported = false;
+			break;
+		}
+	} else if (self_dot11_mode == MLME_DOT11_MODE_11B) {
+		switch (new_rate) {
+		case SUPP_RATE_1_MBPS:
+		case SUPP_RATE_2_MBPS:
+		case SUPP_RATE_5_MBPS:
+		case SUPP_RATE_11_MBPS:
+			supported = true;
+			break;
+		default:
+			supported = false;
+			break;
+		}
+	} else if (!mac_ctx->roam.configParam.ProprietaryRatesEnabled) {
+		switch (new_rate) {
+		case SUPP_RATE_1_MBPS:
+		case SUPP_RATE_2_MBPS:
+		case SUPP_RATE_5_MBPS:
+		case SUPP_RATE_6_MBPS:
+		case SUPP_RATE_9_MBPS:
+		case SUPP_RATE_11_MBPS:
+		case SUPP_RATE_12_MBPS:
+		case SUPP_RATE_18_MBPS:
+		case SUPP_RATE_24_MBPS:
+		case SUPP_RATE_36_MBPS:
+		case SUPP_RATE_48_MBPS:
+		case SUPP_RATE_54_MBPS:
+			supported = true;
+			break;
+		default:
+			supported = false;
+			break;
+		}
+	} else if (new_rate == SUPP_RATE_1_MBPS ||
+		   new_rate == SUPP_RATE_2_MBPS ||
+		   new_rate == SUPP_RATE_5_MBPS ||
+		   new_rate == SUPP_RATE_11_MBPS)
+		supported = true;
+	else {
+		idx = 0x1;
+
+		switch (new_rate) {
+		case SUPP_RATE_6_MBPS:
+			supported = g_phy_rates_suppt[0][idx];
+			break;
+		case SUPP_RATE_9_MBPS:
+			supported = g_phy_rates_suppt[1][idx];
+			break;
+		case SUPP_RATE_12_MBPS:
+			supported = g_phy_rates_suppt[2][idx];
+			break;
+		case SUPP_RATE_18_MBPS:
+			supported = g_phy_rates_suppt[3][idx];
+			break;
+		case SUPP_RATE_20_MBPS:
+			supported = g_phy_rates_suppt[4][idx];
+			break;
+		case SUPP_RATE_24_MBPS:
+			supported = g_phy_rates_suppt[5][idx];
+			break;
+		case SUPP_RATE_36_MBPS:
+			supported = g_phy_rates_suppt[6][idx];
+			break;
+		case SUPP_RATE_40_MBPS:
+			supported = g_phy_rates_suppt[7][idx];
+			break;
+		case SUPP_RATE_42_MBPS:
+			supported = g_phy_rates_suppt[8][idx];
+			break;
+		case SUPP_RATE_48_MBPS:
+			supported = g_phy_rates_suppt[9][idx];
+			break;
+		case SUPP_RATE_54_MBPS:
+			supported = g_phy_rates_suppt[10][idx];
+			break;
+		case SUPP_RATE_72_MBPS:
+			supported = g_phy_rates_suppt[11][idx];
+			break;
+		case SUPP_RATE_80_MBPS:
+			supported = g_phy_rates_suppt[12][idx];
+			break;
+		case SUPP_RATE_84_MBPS:
+			supported = g_phy_rates_suppt[13][idx];
+			break;
+		case SUPP_RATE_96_MBPS:
+			supported = g_phy_rates_suppt[14][idx];
+			break;
+		case SUPP_RATE_108_MBPS:
+			supported = g_phy_rates_suppt[15][idx];
+			break;
+		case SUPP_RATE_120_MBPS:
+			supported = g_phy_rates_suppt[16][idx];
+			break;
+		case SUPP_RATE_126_MBPS:
+			supported = g_phy_rates_suppt[17][idx];
+			break;
+		case SUPP_RATE_144_MBPS:
+			supported = g_phy_rates_suppt[18][idx];
+			break;
+		case SUPP_RATE_160_MBPS:
+			supported = g_phy_rates_suppt[19][idx];
+			break;
+		case SUPP_RATE_168_MBPS:
+			supported = g_phy_rates_suppt[20][idx];
+			break;
+		case SUPP_RATE_192_MBPS:
+			supported = g_phy_rates_suppt[21][idx];
+			break;
+		case SUPP_RATE_216_MBPS:
+			supported = g_phy_rates_suppt[22][idx];
+			break;
+		case SUPP_RATE_240_MBPS:
+			supported = g_phy_rates_suppt[23][idx];
+			break;
+		default:
+			supported = false;
+			break;
+		}
+	}
+
+	return supported;
+}
+
+bool wlan_rates_is_dot11_rate_supported(struct mac_context *mac_ctx,
+					uint8_t rate)
+{
+	uint16_t n = BITS_OFF(rate, WLAN_DOT11_BASIC_RATE_MASK);
+
+	return wlan_is_aggregate_rate_supported(mac_ctx, n);
+}
+
+bool wlan_check_rate_bitmap(uint8_t rate, uint16_t rate_bitmap)
+{
+	uint16_t n = BITS_OFF(rate, WLAN_DOT11_BASIC_RATE_MASK);
+
+	switch (n) {
+	case SIR_MAC_RATE_1:
+		rate_bitmap &= SIR_MAC_RATE_1_BITMAP;
+		break;
+	case SIR_MAC_RATE_2:
+		rate_bitmap &= SIR_MAC_RATE_2_BITMAP;
+		break;
+	case SIR_MAC_RATE_5_5:
+		rate_bitmap &= SIR_MAC_RATE_5_5_BITMAP;
+		break;
+	case SIR_MAC_RATE_11:
+		rate_bitmap &= SIR_MAC_RATE_11_BITMAP;
+		break;
+	case SIR_MAC_RATE_6:
+		rate_bitmap &= SIR_MAC_RATE_6_BITMAP;
+		break;
+	case SIR_MAC_RATE_9:
+		rate_bitmap &= SIR_MAC_RATE_9_BITMAP;
+		break;
+	case SIR_MAC_RATE_12:
+		rate_bitmap &= SIR_MAC_RATE_12_BITMAP;
+		break;
+	case SIR_MAC_RATE_18:
+		rate_bitmap &= SIR_MAC_RATE_18_BITMAP;
+		break;
+	case SIR_MAC_RATE_24:
+		rate_bitmap &= SIR_MAC_RATE_24_BITMAP;
+		break;
+	case SIR_MAC_RATE_36:
+		rate_bitmap &= SIR_MAC_RATE_36_BITMAP;
+		break;
+	case SIR_MAC_RATE_48:
+		rate_bitmap &= SIR_MAC_RATE_48_BITMAP;
+		break;
+	case SIR_MAC_RATE_54:
+		rate_bitmap &= SIR_MAC_RATE_54_BITMAP;
+		break;
+	}
+	return !!rate_bitmap;
+}
+
+void wlan_add_rate_bitmap(uint8_t rate, uint16_t *rate_bitmap)
+{
+	uint16_t n = BITS_OFF(rate, CSR_DOT11_BASIC_RATE_MASK);
+
+	switch (n) {
+	case SIR_MAC_RATE_1:
+		*rate_bitmap |= SIR_MAC_RATE_1_BITMAP;
+		break;
+	case SIR_MAC_RATE_2:
+		*rate_bitmap |= SIR_MAC_RATE_2_BITMAP;
+		break;
+	case SIR_MAC_RATE_5_5:
+		*rate_bitmap |= SIR_MAC_RATE_5_5_BITMAP;
+		break;
+	case SIR_MAC_RATE_11:
+		*rate_bitmap |= SIR_MAC_RATE_11_BITMAP;
+		break;
+	case SIR_MAC_RATE_6:
+		*rate_bitmap |= SIR_MAC_RATE_6_BITMAP;
+		break;
+	case SIR_MAC_RATE_9:
+		*rate_bitmap |= SIR_MAC_RATE_9_BITMAP;
+		break;
+	case SIR_MAC_RATE_12:
+		*rate_bitmap |= SIR_MAC_RATE_12_BITMAP;
+		break;
+	case SIR_MAC_RATE_18:
+		*rate_bitmap |= SIR_MAC_RATE_18_BITMAP;
+		break;
+	case SIR_MAC_RATE_24:
+		*rate_bitmap |= SIR_MAC_RATE_24_BITMAP;
+		break;
+	case SIR_MAC_RATE_36:
+		*rate_bitmap |= SIR_MAC_RATE_36_BITMAP;
+		break;
+	case SIR_MAC_RATE_48:
+		*rate_bitmap |= SIR_MAC_RATE_48_BITMAP;
+		break;
+	case SIR_MAC_RATE_54:
+		*rate_bitmap |= SIR_MAC_RATE_54_BITMAP;
+		break;
+	}
+}
+
+QDF_STATUS wlan_get_rate_set(struct mac_context *mac,
+			     tDot11fBeaconIEs *ie_struct,
+			     tSirMacRateSet *op_rate,
+			     tSirMacRateSet *ext_rate)
+{
+	QDF_STATUS status = QDF_STATUS_E_FAILURE;
+	int i;
+	uint8_t *dst_rate;
+	uint16_t rateBitmap = 0;
+
+	qdf_mem_zero(op_rate, sizeof(tSirMacRateSet));
+	qdf_mem_zero(ext_rate, sizeof(tSirMacRateSet));
+	QDF_ASSERT(ie_struct);
+
+	/*
+	 * Originally, we thought that for 11a networks, the 11a rates
+	 * are always in the Operational Rate set & for 11b and 11g
+	 * networks, the 11b rates appear in the Operational Rate set.
+	 * Consequently, in either case, we would blindly put the rates
+	 * we support into our Operational Rate set.
+	 * (including the basic rates, which we've already verified are
+	 * supported earlier in the roaming decision).
+	 * However, it turns out that this is not always the case.
+	 * Some AP's (e.g. D-Link DI-784) ram 11g rates into the
+	 * Operational Rate set too.  Now, we're a little more careful.
+	 */
+	dst_rate = op_rate->rate;
+	if (ie_struct->SuppRates.present) {
+		for (i = 0; i < ie_struct->SuppRates.num_rates; i++) {
+			if (csr_rates_is_dot11_rate_supported(mac,
+				ie_struct->SuppRates.rates[i]) &&
+				!wlan_check_rate_bitmap(
+					ie_struct->SuppRates.rates[i],
+					rateBitmap)) {
+				wlan_add_rate_bitmap(ie_struct->SuppRates.
+						    rates[i], &rateBitmap);
+				*dst_rate++ = ie_struct->SuppRates.rates[i];
+				op_rate->numRates++;
+			}
+		}
+	}
+	/*
+	 * If there are Extended Rates in the beacon, we will reflect the
+	 * extended rates that we support in our Extended Operational Rate
+	 * set.
+	 */
+	if (ie_struct->ExtSuppRates.present) {
+		dst_rate = ext_rate->rate;
+		for (i = 0; i < ie_struct->ExtSuppRates.num_rates; i++) {
+			if (wlan_rates_is_dot11_rate_supported(mac,
+				ie_struct->ExtSuppRates.rates[i]) &&
+				!wlan_check_rate_bitmap(
+					ie_struct->ExtSuppRates.rates[i],
+					rateBitmap)) {
+				*dst_rate++ = ie_struct->ExtSuppRates.rates[i];
+				ext_rate->numRates++;
+			}
+		}
+	}
+	if (op_rate->numRates > 0 || ext_rate->numRates > 0)
+		status = QDF_STATUS_SUCCESS;
+
+	return status;
+}
+
 uint32_t wlan_get_11h_power_constraint(struct mac_context *mac_ctx,
 				       tDot11fIEPowerConstraints *constraints)
 {

+ 0 - 1
core/sme/inc/csr_api.h

@@ -577,7 +577,6 @@ typedef struct tagCsrKeys {
 	/* Also use to indicate whether the key index is set */
 	uint8_t KeyLength[CSR_MAX_NUM_KEY];
 	uint8_t KeyMaterial[CSR_MAX_NUM_KEY][CSR_MAX_KEY_LEN];
-	uint8_t defaultIndex;
 } tCsrKeys;
 
 /*

+ 0 - 4
core/sme/inc/csr_internal.h

@@ -803,10 +803,6 @@ uint8_t csr_construct_wapi_ie(struct mac_context *mac, uint32_t sessionId,
 		tDot11fBeaconIEs *pIes, tCsrWapiIe *pWapiIe);
 #endif /* FEATURE_WLAN_WAPI */
 
-void csr_set_cfg_privacy(struct mac_context *mac,
-			 struct csr_roam_profile *pProfile,
-			 bool fPrivacy);
-
 /**
  * csr_get_concurrent_operation_freq() - To get concurrent operating freq
  * @mac_ctx: Pointer to mac context

+ 1 - 3
core/sme/inc/csr_link_list.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011-2012, 2014-2016, 2018-2019 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2011-2012, 2014-2016, 2018-2019, 2021 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
@@ -62,8 +62,6 @@ typedef struct tagDblLinkList {
 #define GET_FIELD_OFFSET(type, field)  ((uintptr_t)(&(((type *)0)->field)))
 #define GET_ROUND_UP(_Field, _Boundary) \
 	(((_Field) + ((_Boundary) - 1))  & ~((_Boundary) - 1))
-#define BITS_ON(_Field, _Bitmask)  ((_Field) |=  (_Bitmask))
-#define BITS_OFF(_Field, _Bitmask) ((_Field) &= ~(_Bitmask))
 #define csrIsListEmpty(pHead) ((pHead)->next == (pHead))
 
 uint32_t csr_ll_count(tDblLinkList *pList);

+ 1 - 44
core/sme/inc/csr_support.h

@@ -60,7 +60,7 @@
 #define CSR_DOT11_SUPPORTED_RATES_MAX (12)
 #define CSR_DOT11_EXTENDED_SUPPORTED_RATES_MAX (8)
 
-#define CSR_DOT11_BASIC_RATE_MASK (0x80)
+#define CSR_DOT11_BASIC_RATE_MASK    WLAN_DOT11_BASIC_RATE_MASK
 
 /* NOTE these index are use as array index for csr_rsn_oui */
 #define CSR_OUI_USE_GROUP_CIPHER_INDEX 0x00
@@ -84,47 +84,6 @@
 #define CSR_OUI_WAPI_WAI_MAX_INDEX     0x03
 #endif /* FEATURE_WLAN_WAPI */
 
-typedef enum {
-	/* 11b rates */
-	eCsrSuppRate_1Mbps   = 1 * 2,
-	eCsrSuppRate_2Mbps   = 2 * 2,
-	eCsrSuppRate_5_5Mbps = 11,      /* 5.5 * 2 */
-	eCsrSuppRate_11Mbps  = 11 * 2,
-
-	/* 11a / 11g rates */
-	eCsrSuppRate_6Mbps   = 6 * 2,
-	eCsrSuppRate_9Mbps   = 9 * 2,
-	eCsrSuppRate_12Mbps  = 12 * 2,
-	eCsrSuppRate_18Mbps  = 18 * 2,
-	eCsrSuppRate_24Mbps  = 24 * 2,
-	eCsrSuppRate_36Mbps  = 36 * 2,
-	eCsrSuppRate_48Mbps  = 48 * 2,
-	eCsrSuppRate_54Mbps  = 54 * 2,
-
-	/* airgo proprietary rates */
-	eCsrSuppRate_10Mbps   = 10 * 2,
-	eCsrSuppRate_10_5Mbps = 21,     /* 10.5 * 2 */
-	eCsrSuppRate_20Mbps   = 20 * 2,
-	eCsrSuppRate_21Mbps   = 21 * 2,
-	eCsrSuppRate_40Mbps   = 40 * 2,
-	eCsrSuppRate_42Mbps   = 42 * 2,
-	eCsrSuppRate_60Mbps   = 60 * 2,
-	eCsrSuppRate_63Mbps   = 63 * 2,
-	eCsrSuppRate_72Mbps   = 72 * 2,
-	eCsrSuppRate_80Mbps   = 80 * 2,
-	eCsrSuppRate_84Mbps   = 84 * 2,
-	eCsrSuppRate_96Mbps   = 96 * 2,
-	eCsrSuppRate_108Mbps  = 108 * 2,
-	eCsrSuppRate_120Mbps  = 120 * 2,
-	eCsrSuppRate_126Mbps  = 126 * 2,
-	eCsrSuppRate_144Mbps  = 144 * 2,
-	eCsrSuppRate_160Mbps  = 160 * 2,
-	eCsrSuppRate_168Mbps  = 168 * 2,
-	eCsrSuppRate_192Mbps  = 192 * 2,
-	eCsrSuppRate_216Mbps  = 216 * 2,
-	eCsrSuppRate_240Mbps  = 240 * 2
-} eCsrSupportedRates;
-
 /* Generic Information Element Structure */
 typedef struct sDot11IEHeader {
 	uint8_t ElementID;
@@ -294,8 +253,6 @@ tAniEdType csr_translate_encrypt_type_to_ed_type(
 
 bool csr_is_bssid_match(struct qdf_mac_addr *pProfBssid,
 			struct qdf_mac_addr *BssBssid);
-void csr_add_rate_bitmap(uint8_t rate, uint16_t *pRateBitmap);
-bool csr_check_rate_bitmap(uint8_t rate, uint16_t RateBitmap);
 bool csr_rates_is_dot11_rate_supported(struct mac_context *mac_ctx, uint8_t rate);
 enum bss_type csr_translate_bsstype_to_mac_type(eCsrRoamBssType csrtype);
 /* Caller allocates memory for pIEStruct */

+ 2 - 404
core/sme/src/csr/csr_api_roam.c

@@ -3174,211 +3174,6 @@ csr_roam_get_qos_info_from_bss(struct mac_context *mac,
 	return status;
 }
 
-static void csr_reset_cfg_privacy(struct mac_context *mac)
-{
-	uint8_t Key0[WLAN_CRYPTO_KEY_WEP104_LEN] = {0};
-	uint8_t Key1[WLAN_CRYPTO_KEY_WEP104_LEN] = {0};
-	uint8_t Key2[WLAN_CRYPTO_KEY_WEP104_LEN] = {0};
-	uint8_t Key3[WLAN_CRYPTO_KEY_WEP104_LEN] = {0};
-	struct wlan_mlme_wep_cfg *wep_params = &mac->mlme_cfg->wep_params;
-
-	mlme_set_wep_key(wep_params, MLME_WEP_DEFAULT_KEY_1, Key0,
-			 WLAN_CRYPTO_KEY_WEP104_LEN);
-	mlme_set_wep_key(wep_params, MLME_WEP_DEFAULT_KEY_2, Key1,
-			 WLAN_CRYPTO_KEY_WEP104_LEN);
-	mlme_set_wep_key(wep_params, MLME_WEP_DEFAULT_KEY_3, Key2,
-			 WLAN_CRYPTO_KEY_WEP104_LEN);
-	mlme_set_wep_key(wep_params, MLME_WEP_DEFAULT_KEY_4, Key3,
-			 WLAN_CRYPTO_KEY_WEP104_LEN);
-}
-
-void csr_set_cfg_privacy(struct mac_context *mac, struct csr_roam_profile *pProfile,
-			 bool fPrivacy)
-{
-	/*
-	 * the only difference between this function and
-	 * the csr_set_cfg_privacyFromProfile() is the setting of the privacy
-	 * CFG based on the advertised privacy setting from the AP for WPA
-	 * associations. See note below in this function...
-	 */
-	uint32_t privacy_enabled = 0, rsn_enabled = 0, wep_default_key_id = 0;
-	uint32_t WepKeyLength = WLAN_CRYPTO_KEY_WEP40_LEN;
-	uint32_t Key0Length = 0, Key1Length = 0, Key2Length = 0, Key3Length = 0;
-
-	/* Reserve for the biggest key */
-	uint8_t Key0[WLAN_CRYPTO_KEY_WEP104_LEN];
-	uint8_t Key1[WLAN_CRYPTO_KEY_WEP104_LEN];
-	uint8_t Key2[WLAN_CRYPTO_KEY_WEP104_LEN];
-	uint8_t Key3[WLAN_CRYPTO_KEY_WEP104_LEN];
-
-	struct wlan_mlme_wep_cfg *wep_params = &mac->mlme_cfg->wep_params;
-
-	switch (pProfile->negotiatedUCEncryptionType) {
-	case eCSR_ENCRYPT_TYPE_NONE:
-		/* for NO encryption, turn off Privacy and Rsn. */
-		privacy_enabled = 0;
-		rsn_enabled = 0;
-		/* clear out the WEP keys that may be hanging around. */
-		Key0Length = 0;
-		Key1Length = 0;
-		Key2Length = 0;
-		Key3Length = 0;
-		break;
-
-	case eCSR_ENCRYPT_TYPE_WEP40_STATICKEY:
-	case eCSR_ENCRYPT_TYPE_WEP40:
-
-		/* Privacy is ON.  NO RSN for Wep40 static key. */
-		privacy_enabled = 1;
-		rsn_enabled = 0;
-		/* Set the Wep default key ID. */
-		wep_default_key_id = pProfile->Keys.defaultIndex;
-		/* Wep key size if 5 bytes (40 bits). */
-		WepKeyLength = WLAN_CRYPTO_KEY_WEP40_LEN;
-		/*
-		 * set encryption keys in the CFG database or
-		 * clear those that are not present in this profile.
-		 */
-		if (pProfile->Keys.KeyLength[0]) {
-			qdf_mem_copy(Key0,
-				pProfile->Keys.KeyMaterial[0],
-				WLAN_CRYPTO_KEY_WEP40_LEN);
-			Key0Length = WLAN_CRYPTO_KEY_WEP40_LEN;
-		} else {
-			Key0Length = 0;
-		}
-
-		if (pProfile->Keys.KeyLength[1]) {
-			qdf_mem_copy(Key1,
-				pProfile->Keys.KeyMaterial[1],
-				WLAN_CRYPTO_KEY_WEP40_LEN);
-			Key1Length = WLAN_CRYPTO_KEY_WEP40_LEN;
-		} else {
-			Key1Length = 0;
-		}
-
-		if (pProfile->Keys.KeyLength[2]) {
-			qdf_mem_copy(Key2,
-				pProfile->Keys.KeyMaterial[2],
-				WLAN_CRYPTO_KEY_WEP40_LEN);
-			Key2Length = WLAN_CRYPTO_KEY_WEP40_LEN;
-		} else {
-			Key2Length = 0;
-		}
-
-		if (pProfile->Keys.KeyLength[3]) {
-			qdf_mem_copy(Key3,
-				pProfile->Keys.KeyMaterial[3],
-				WLAN_CRYPTO_KEY_WEP40_LEN);
-			Key3Length = WLAN_CRYPTO_KEY_WEP40_LEN;
-		} else {
-			Key3Length = 0;
-		}
-		break;
-
-	case eCSR_ENCRYPT_TYPE_WEP104_STATICKEY:
-	case eCSR_ENCRYPT_TYPE_WEP104:
-
-		/* Privacy is ON.  NO RSN for Wep40 static key. */
-		privacy_enabled = 1;
-		rsn_enabled = 0;
-		/* Set the Wep default key ID. */
-		wep_default_key_id = pProfile->Keys.defaultIndex;
-		/* Wep key size if 13 bytes (104 bits). */
-		WepKeyLength = WLAN_CRYPTO_KEY_WEP104_LEN;
-		/*
-		 * set encryption keys in the CFG database or clear
-		 * those that are not present in this profile.
-		 */
-		if (pProfile->Keys.KeyLength[0]) {
-			qdf_mem_copy(Key0,
-				pProfile->Keys.KeyMaterial[0],
-				WLAN_CRYPTO_KEY_WEP104_LEN);
-			Key0Length = WLAN_CRYPTO_KEY_WEP104_LEN;
-		} else {
-			Key0Length = 0;
-		}
-
-		if (pProfile->Keys.KeyLength[1]) {
-			qdf_mem_copy(Key1,
-				pProfile->Keys.KeyMaterial[1],
-				WLAN_CRYPTO_KEY_WEP104_LEN);
-			Key1Length = WLAN_CRYPTO_KEY_WEP104_LEN;
-		} else {
-			Key1Length = 0;
-		}
-
-		if (pProfile->Keys.KeyLength[2]) {
-			qdf_mem_copy(Key2,
-				pProfile->Keys.KeyMaterial[2],
-				WLAN_CRYPTO_KEY_WEP104_LEN);
-			Key2Length = WLAN_CRYPTO_KEY_WEP104_LEN;
-		} else {
-			Key2Length = 0;
-		}
-
-		if (pProfile->Keys.KeyLength[3]) {
-			qdf_mem_copy(Key3,
-				pProfile->Keys.KeyMaterial[3],
-				WLAN_CRYPTO_KEY_WEP104_LEN);
-			Key3Length = WLAN_CRYPTO_KEY_WEP104_LEN;
-		} else {
-			Key3Length = 0;
-		}
-		break;
-
-	case eCSR_ENCRYPT_TYPE_TKIP:
-	case eCSR_ENCRYPT_TYPE_AES:
-	case eCSR_ENCRYPT_TYPE_AES_GCMP:
-	case eCSR_ENCRYPT_TYPE_AES_GCMP_256:
-#ifdef FEATURE_WLAN_WAPI
-	case eCSR_ENCRYPT_TYPE_WPI:
-#endif /* FEATURE_WLAN_WAPI */
-		/*
-		 * this is the only difference between this function and
-		 * the csr_set_cfg_privacyFromProfile().
-		 * (setting of the privacy CFG based on the advertised
-		 *  privacy setting from AP for WPA/WAPI associations).
-		 */
-		privacy_enabled = (0 != fPrivacy);
-		/* turn on RSN enabled for WPA associations */
-		rsn_enabled = 1;
-		/* clear static WEP keys that may be hanging around. */
-		Key0Length = 0;
-		Key1Length = 0;
-		Key2Length = 0;
-		Key3Length = 0;
-		break;
-	default:
-		privacy_enabled = 0;
-		rsn_enabled = 0;
-		break;
-	}
-
-	mac->mlme_cfg->wep_params.is_privacy_enabled = privacy_enabled;
-	mac->mlme_cfg->feature_flags.enable_rsn = rsn_enabled;
-	mlme_set_wep_key(wep_params, MLME_WEP_DEFAULT_KEY_1, Key0, Key0Length);
-	mlme_set_wep_key(wep_params, MLME_WEP_DEFAULT_KEY_2, Key1, Key1Length);
-	mlme_set_wep_key(wep_params, MLME_WEP_DEFAULT_KEY_3, Key2, Key2Length);
-	mlme_set_wep_key(wep_params, MLME_WEP_DEFAULT_KEY_4, Key3, Key3Length);
-	mac->mlme_cfg->wep_params.wep_default_key_id = wep_default_key_id;
-}
-
-static void csr_set_cfg_ssid(struct mac_context *mac, tSirMacSSid *pSSID)
-{
-	uint32_t len = 0;
-
-	if (pSSID->length <= WLAN_SSID_MAX_LEN)
-		len = pSSID->length;
-	else
-		len = WLAN_SSID_MAX_LEN;
-
-	qdf_mem_copy(mac->mlme_cfg->sap_cfg.cfg_ssid,
-		     (uint8_t *)pSSID->ssId, len);
-	mac->mlme_cfg->sap_cfg.cfg_ssid_len = len;
-
-}
-
 static QDF_STATUS csr_set_qos_to_cfg(struct mac_context *mac, uint32_t sessionId,
 				     eCsrMediaAccessType qosType)
 {
@@ -3421,75 +3216,6 @@ static QDF_STATUS csr_set_qos_to_cfg(struct mac_context *mac, uint32_t sessionId
 	return status;
 }
 
-static QDF_STATUS csr_get_rate_set(struct mac_context *mac,
-				   tDot11fBeaconIEs *pIes,
-				   tSirMacRateSet *pOpRateSet,
-				   tSirMacRateSet *pExRateSet)
-{
-	QDF_STATUS status = QDF_STATUS_E_FAILURE;
-	int i;
-	uint8_t *pDstRate;
-	uint16_t rateBitmap = 0;
-
-	qdf_mem_zero(pOpRateSet, sizeof(tSirMacRateSet));
-	qdf_mem_zero(pExRateSet, sizeof(tSirMacRateSet));
-	QDF_ASSERT(pIes);
-
-	if (!pIes) {
-		sme_err("failed to parse BssDesc");
-		return status;
-	}
-
-	/*
-	 * Originally, we thought that for 11a networks, the 11a rates
-	 * are always in the Operational Rate set & for 11b and 11g
-	 * networks, the 11b rates appear in the Operational Rate set.
-	 * Consequently, in either case, we would blindly put the rates
-	 * we support into our Operational Rate set.
-	 * (including the basic rates, which we've already verified are
-	 * supported earlier in the roaming decision).
-	 * However, it turns out that this is not always the case.
-	 * Some AP's (e.g. D-Link DI-784) ram 11g rates into the
-	 * Operational Rate set too.  Now, we're a little more careful.
-	 */
-	pDstRate = pOpRateSet->rate;
-	if (pIes->SuppRates.present) {
-		for (i = 0; i < pIes->SuppRates.num_rates; i++) {
-			if (csr_rates_is_dot11_rate_supported(mac,
-				pIes->SuppRates.rates[i]) &&
-				!csr_check_rate_bitmap(
-					pIes->SuppRates.rates[i],
-					rateBitmap)) {
-				csr_add_rate_bitmap(pIes->SuppRates.
-						    rates[i], &rateBitmap);
-				*pDstRate++ = pIes->SuppRates.rates[i];
-				pOpRateSet->numRates++;
-			}
-		}
-	}
-	/*
-	 * If there are Extended Rates in the beacon, we will reflect the
-	 * extended rates that we support in our Extended Operational Rate
-	 * set.
-	 */
-	if (pIes->ExtSuppRates.present) {
-		pDstRate = pExRateSet->rate;
-		for (i = 0; i < pIes->ExtSuppRates.num_rates; i++) {
-			if (csr_rates_is_dot11_rate_supported(mac,
-				pIes->ExtSuppRates.rates[i]) &&
-				!csr_check_rate_bitmap(
-					pIes->ExtSuppRates.rates[i],
-					rateBitmap)) {
-				*pDstRate++ = pIes->ExtSuppRates.rates[i];
-				pExRateSet->numRates++;
-			}
-		}
-	}
-	if (pOpRateSet->numRates > 0 || pExRateSet->numRates > 0)
-		status = QDF_STATUS_SUCCESS;
-	return status;
-}
-
 static void csr_set_cfg_rate_set(struct mac_context *mac, eCsrPhyMode phyMode,
 				 struct csr_roam_profile *pProfile,
 				 struct bss_description *bss_desc,
@@ -3753,16 +3479,7 @@ QDF_STATUS csr_roam_set_bss_config_cfg(struct mac_context *mac, uint32_t session
 	}
 	/* Qos */
 	csr_set_qos_to_cfg(mac, sessionId, pBssConfig->qosType);
-	/* SSID */
-	csr_set_cfg_ssid(mac, &pBssConfig->SSID);
-
-	/* Auth type */
-	mac->mlme_cfg->wep_params.auth_type = pBssConfig->authType;
-
-	/* encryption type */
-	csr_set_cfg_privacy(mac, pProfile, (bool) pBssConfig->BssCap.privacy);
 	/* CB */
-
 	if (CSR_IS_INFRA_AP(pProfile))
 		chan_freq = pProfile->op_freq;
 	else if (bss_desc)
@@ -11808,9 +11525,6 @@ static bool csr_roam_is_same_profile_keys(struct mac_context *mac,
 			    (mac, &pProfile2->EncryptionType,
 			    pConnProfile->EncryptionType))
 			break;
-		if (pConnProfile->Keys.defaultIndex !=
-		    pProfile2->Keys.defaultIndex)
-			break;
 		for (i = 0; i < CSR_MAX_NUM_KEY; i++) {
 			if (pConnProfile->Keys.KeyLength[i] !=
 			    pProfile2->Keys.KeyLength[i])
@@ -11841,51 +11555,9 @@ static bool csr_roam_is_same_profile_keys(struct mac_context *mac,
  */
 static void
 csr_populate_basic_rates(tSirMacRateSet *rate_set, bool is_ofdm_rates,
-		bool is_basic_rates)
+			 bool is_basic_rates)
 {
-	int i = 0;
-	uint8_t ofdm_rates[8] = {
-		SIR_MAC_RATE_6,
-		SIR_MAC_RATE_9,
-		SIR_MAC_RATE_12,
-		SIR_MAC_RATE_18,
-		SIR_MAC_RATE_24,
-		SIR_MAC_RATE_36,
-		SIR_MAC_RATE_48,
-		SIR_MAC_RATE_54
-	};
-	uint8_t cck_rates[4] = {
-		SIR_MAC_RATE_1,
-		SIR_MAC_RATE_2,
-		SIR_MAC_RATE_5_5,
-		SIR_MAC_RATE_11
-	};
-
-	if (is_ofdm_rates == true) {
-		rate_set->numRates = 8;
-		qdf_mem_copy(rate_set->rate, ofdm_rates, sizeof(ofdm_rates));
-		if (is_basic_rates) {
-			rate_set->rate[0] |= CSR_DOT11_BASIC_RATE_MASK;
-			rate_set->rate[2] |= CSR_DOT11_BASIC_RATE_MASK;
-			rate_set->rate[4] |= CSR_DOT11_BASIC_RATE_MASK;
-		}
-		for (i = 0; i < rate_set->numRates; i++)
-			QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG,
-			("Default OFDM rate is %2x"), rate_set->rate[i]);
-	} else {
-		rate_set->numRates = 4;
-		qdf_mem_copy(rate_set->rate, cck_rates, sizeof(cck_rates));
-		if (is_basic_rates) {
-			rate_set->rate[0] |= CSR_DOT11_BASIC_RATE_MASK;
-			rate_set->rate[1] |= CSR_DOT11_BASIC_RATE_MASK;
-			rate_set->rate[2] |= CSR_DOT11_BASIC_RATE_MASK;
-			rate_set->rate[3] |= CSR_DOT11_BASIC_RATE_MASK;
-		}
-		for (i = 0; i < rate_set->numRates; i++)
-			QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG,
-			("Default CCK rate is %2x"), rate_set->rate[i]);
-
-	}
+	wlan_populate_basic_rates(rate_set, is_ofdm_rates, is_basic_rates);
 }
 
 /**
@@ -12587,8 +12259,6 @@ QDF_STATUS cm_csr_handle_connect_req(struct wlan_objmgr_vdev *vdev,
 {
 	struct mac_context *mac_ctx;
 	uint8_t vdev_id = wlan_vdev_get_id(vdev);
-	tSirMacRateSet op_rate_set;
-	tSirMacRateSet ext_rate_set;
 	QDF_STATUS status;
 	tDot11fBeaconIEs *ie_struct;
 	struct bss_description *bss_desc;
@@ -12641,19 +12311,9 @@ QDF_STATUS cm_csr_handle_connect_req(struct wlan_objmgr_vdev *vdev,
 	     !ie_struct->Country.present)
 		csr_apply_channel_power_info_wrapper(mac_ctx);
 
-	status = csr_get_rate_set(mac_ctx, ie_struct, &op_rate_set,
-				  &ext_rate_set);
 	qdf_mem_free(ie_struct);
 	qdf_mem_free(bss_desc);
 
-	if (QDF_IS_STATUS_ERROR(status)) {
-		sme_err("Rates parsing failed vdev id %d", vdev_id);
-		return QDF_STATUS_E_FAILURE;
-	}
-
-	mlme_set_opr_rate(vdev, op_rate_set.rate, op_rate_set.numRates);
-	mlme_set_ext_opr_rate(vdev, ext_rate_set.rate, ext_rate_set.numRates);
-
 	cm_csr_set_joining(vdev_id);
 
 	return QDF_STATUS_SUCCESS;
@@ -13131,19 +12791,6 @@ csr_validate_and_update_fils_info(struct mac_context *mac,
 }
 #endif
 
-static void csr_get_basic_rates(tSirMacRateSet *b_rates, uint32_t chan_freq)
-{
-	/*
-	 * Some IOT APs don't send supported rates in
-	 * probe resp, hence add BSS basic rates in
-	 * supported rates IE of assoc request.
-	 */
-	if (WLAN_REG_IS_24GHZ_CH_FREQ(chan_freq))
-		csr_populate_basic_rates(b_rates, false, true);
-	else if (WLAN_REG_IS_5GHZ_CH_FREQ(chan_freq))
-		csr_populate_basic_rates(b_rates, true, true);
-}
-
 static QDF_STATUS csr_copy_assoc_ie(struct mac_context *mac, uint8_t vdev_id,
 				    struct csr_roam_profile *profile,
 				    struct join_req *csr_join_req)
@@ -13245,10 +12892,7 @@ QDF_STATUS csr_send_join_req_msg(struct mac_context *mac, uint32_t sessionId,
 	uint8_t acm_mask = 0, uapsd_mask;
 	uint32_t bss_freq;
 	uint16_t msgLen, ieLen;
-	tSirMacRateSet OpRateSet;
-	tSirMacRateSet ExRateSet;
 	struct csr_roam_session *pSession = CSR_GET_SESSION(mac, sessionId);
-	uint32_t dot11mode = 0;
 	uint8_t *wpaRsnIE = NULL;
 	struct join_req *csr_join_req;
 	tpCsrNeighborRoamControlInfo neigh_roam_info;
@@ -13349,60 +12993,15 @@ QDF_STATUS csr_send_join_req_msg(struct mac_context *mac, uint32_t sessionId,
 				   pBssDescription->bssId,
 				   pProfile->negotiatedAuthType,
 				   pBssDescription->chan_freq);
-		/* dot11mode */
-		dot11mode =
-			csr_translate_to_wni_cfg_dot11_mode(mac,
-							    pSession->bssParams.
-							    uCfgDot11Mode);
 		akm = pProfile->negotiatedAuthType;
 		csr_join_req->akm = csr_convert_csr_to_ani_akm_type(akm);
 
-		csr_join_req->dot11mode = (uint8_t)dot11mode;
 		csr_join_req->wps_registration = pProfile->bWPSAssociation;
 		csr_join_req->force_24ghz_in_ht20 =
 			pProfile->force_24ghz_in_ht20;
 		src_config.uint_value = pProfile->uapsd_mask;
 		wlan_cm_roam_cfg_set_value(mac->psoc, sessionId, UAPSD_MASK,
 					   &src_config);
-		status =
-			csr_get_rate_set(mac, pIes, &OpRateSet,
-					 &ExRateSet);
-
-		if (QDF_IS_STATUS_SUCCESS(status)) {
-			/* OperationalRateSet */
-			if (OpRateSet.numRates) {
-				csr_join_req->operationalRateSet.numRates =
-					OpRateSet.numRates;
-				qdf_mem_copy(&csr_join_req->operationalRateSet.
-						rate, OpRateSet.rate,
-						OpRateSet.numRates);
-			} else if (pProfile->phyMode == eCSR_DOT11_MODE_AUTO) {
-				tSirMacRateSet b_rates = {0};
-
-				csr_get_basic_rates(&b_rates,
-						    pBssDescription->chan_freq);
-				csr_join_req->operationalRateSet = b_rates;
-			}
-			/* ExtendedRateSet */
-			if (ExRateSet.numRates) {
-				csr_join_req->extendedRateSet.numRates =
-					ExRateSet.numRates;
-				qdf_mem_copy(&csr_join_req->extendedRateSet.
-						rate, ExRateSet.rate,
-						ExRateSet.numRates);
-			} else {
-				csr_join_req->extendedRateSet.numRates = 0;
-			}
-		} else if (pProfile->phyMode == eCSR_DOT11_MODE_AUTO) {
-			tSirMacRateSet b_rates = {0};
-
-			csr_get_basic_rates(&b_rates,
-					    pBssDescription->chan_freq);
-			csr_join_req->operationalRateSet = b_rates;
-		} else {
-			csr_join_req->operationalRateSet.numRates = 0;
-			csr_join_req->extendedRateSet.numRates = 0;
-		}
 
 		/* rsnIE */
 		if (csr_is_profile_wpa(pProfile)) {
@@ -14463,7 +14062,6 @@ void csr_cleanup_vdev_session(struct mac_context *mac, uint8_t vdev_id)
 		sme_ft_close(MAC_HANDLE(mac), vdev_id);
 		csr_free_connect_bss_desc(mac, vdev_id);
 		sme_reset_key(MAC_HANDLE(mac), vdev_id);
-		csr_reset_cfg_privacy(mac);
 		csr_flush_roam_scan_chan_lists(mac, vdev_id);
 		csr_roam_free_connect_profile(&pSession->connectedProfile);
 		csr_roam_free_connected_info(mac, &pSession->connectedInfo);

+ 15 - 354
core/sme/src/csr/csr_util.c

@@ -160,80 +160,6 @@ uint8_t csr_group_mgmt_oui[][CSR_RSN_OUI_SIZE] = {
 	{0x00, 0x0F, 0xAC, 0x0C},
 };
 
-
-/* ////////////////////////////////////////////////////////////////////// */
-
-/**
- * \var g_phy_rates_suppt
- *
- * \brief Rate support lookup table
- *
- *
- * This is a  lookup table indexing rates &  configuration parameters to
- * support.  Given a rate (in  unites of 0.5Mpbs) & three bools (MIMO
- * Enabled, Channel  Bonding Enabled, & Concatenation  Enabled), one can
- * determine  whether  the given  rate  is  supported  by computing  two
- * indices.  The  first maps  the rate to  table row as  indicated below
- * (i.e. eHddSuppRate_6Mbps maps to  row zero, eHddSuppRate_9Mbps to row
- * 1, and so on).  Index two can be computed like so:
- *
- * \code
- *  idx2 = ( fEsf  ? 0x4 : 0x0 ) |
- *         ( fCb   ? 0x2 : 0x0 ) |
- *         ( fMimo ? 0x1 : 0x0 );
- * \endcode
- *
- *
- * Given that:
- *
- *  \code
- *  fSupported = g_phy_rates_suppt[idx1][idx2];
- *  \endcode
- *
- *
- * This table is based on  the document "PHY Supported Rates.doc".  This
- * table is  permissive in that a  rate is reflected  as being supported
- * even  when turning  off an  enabled feature  would be  required.  For
- * instance, "PHY Supported Rates"  lists 42Mpbs as unsupported when CB,
- * ESF, &  MIMO are all  on.  However,  if we turn  off either of  CB or
- * MIMO, it then becomes supported.   Therefore, we mark it as supported
- * even in index 7 of this table.
- *
- *
- */
-
-static const bool g_phy_rates_suppt[24][8] = {
-
-	/* SSF   SSF    SSF    SSF    ESF    ESF    ESF    ESF */
-	/* SIMO  MIMO   SIMO   MIMO   SIMO   MIMO   SIMO   MIMO */
-	/* No CB No CB  CB     CB     No CB  No CB  CB     CB */
-	{true, true, true, true, true, true, true, true},       /* 6Mbps */
-	{true, true, true, true, true, true, true, true},       /* 9Mbps */
-	{true, true, true, true, true, true, true, true},       /* 12Mbps */
-	{true, true, true, true, true, true, true, true},       /* 18Mbps */
-	{false, false, true, true, false, false, true, true},   /* 20Mbps */
-	{true, true, true, true, true, true, true, true},       /* 24Mbps */
-	{true, true, true, true, true, true, true, true},       /* 36Mbps */
-	{false, false, true, true, false, true, true, true},    /* 40Mbps */
-	{false, false, true, true, false, true, true, true},    /* 42Mbps */
-	{true, true, true, true, true, true, true, true},       /* 48Mbps */
-	{true, true, true, true, true, true, true, true},       /* 54Mbps */
-	{false, true, true, true, false, true, true, true},     /* 72Mbps */
-	{false, false, true, true, false, true, true, true},    /* 80Mbps */
-	{false, false, true, true, false, true, true, true},    /* 84Mbps */
-	{false, true, true, true, false, true, true, true},     /* 96Mbps */
-	{false, true, true, true, false, true, true, true},     /* 108Mbps */
-	{false, false, true, true, false, true, true, true},    /* 120Mbps */
-	{false, false, true, true, false, true, true, true},    /* 126Mbps */
-	{false, false, false, true, false, false, false, true}, /* 144Mbps */
-	{false, false, false, true, false, false, false, true}, /* 160Mbps */
-	{false, false, false, true, false, false, false, true}, /* 168Mbps */
-	{false, false, false, true, false, false, false, true}, /* 192Mbps */
-	{false, false, false, true, false, false, false, true}, /* 216Mbps */
-	{false, false, false, true, false, false, false, true}, /* 240Mbps */
-
-};
-
 #define CASE_RETURN_STR(n) {\
 	case (n): return (# n);\
 }
@@ -2489,10 +2415,10 @@ bool csr_rates_is_dot11_rate11b_supported_rate(uint8_t dot11Rate)
 		(uint16_t) (BITS_OFF(dot11Rate, CSR_DOT11_BASIC_RATE_MASK));
 
 	switch (nonBasicRate) {
-	case eCsrSuppRate_1Mbps:
-	case eCsrSuppRate_2Mbps:
-	case eCsrSuppRate_5_5Mbps:
-	case eCsrSuppRate_11Mbps:
+	case SUPP_RATE_1_MBPS:
+	case SUPP_RATE_2_MBPS:
+	case SUPP_RATE_5_MBPS:
+	case SUPP_RATE_11_MBPS:
 		fSupported = true;
 		break;
 
@@ -2510,14 +2436,14 @@ bool csr_rates_is_dot11_rate11a_supported_rate(uint8_t dot11Rate)
 		(uint16_t) (BITS_OFF(dot11Rate, CSR_DOT11_BASIC_RATE_MASK));
 
 	switch (nonBasicRate) {
-	case eCsrSuppRate_6Mbps:
-	case eCsrSuppRate_9Mbps:
-	case eCsrSuppRate_12Mbps:
-	case eCsrSuppRate_18Mbps:
-	case eCsrSuppRate_24Mbps:
-	case eCsrSuppRate_36Mbps:
-	case eCsrSuppRate_48Mbps:
-	case eCsrSuppRate_54Mbps:
+	case SUPP_RATE_6_MBPS:
+	case SUPP_RATE_9_MBPS:
+	case SUPP_RATE_12_MBPS:
+	case SUPP_RATE_18_MBPS:
+	case SUPP_RATE_24_MBPS:
+	case SUPP_RATE_36_MBPS:
+	case SUPP_RATE_48_MBPS:
+	case SUPP_RATE_54_MBPS:
 		fSupported = true;
 		break;
 
@@ -2684,275 +2610,10 @@ bool csr_is_bssid_match(struct qdf_mac_addr *pProfBssid,
 	return fMatch;
 }
 
-/**
- * csr_is_aggregate_rate_supported() - to check if aggregate rate is supported
- * @mac_ctx: pointer to mac context
- * @rate: A rate in units of 500kbps
- *
- *
- * The rate encoding  is just as in 802.11  Information Elements, except
- * that the high bit is \em  not interpreted as indicating a Basic Rate,
- * and proprietary rates are allowed, too.
- *
- * Note  that if the  adapter's dot11Mode  is g,  we don't  restrict the
- * rates.  According to hwReadEepromParameters, this will happen when:
- * ... the  card is  configured for ALL  bands through  the property
- * page.  If this occurs, and the card is not an ABG card ,then this
- * code  is  setting the  dot11Mode  to  assume  the mode  that  the
- * hardware can support.   For example, if the card  is an 11BG card
- * and we  are configured to support  ALL bands, then  we change the
- * dot11Mode  to 11g  because  ALL in  this  case is  only what  the
- * hardware can support.
- *
- * Return: true if  the adapter is currently capable of supporting this rate
- */
-
-static bool csr_is_aggregate_rate_supported(struct mac_context *mac_ctx,
-			uint16_t rate)
-{
-	bool supported = false;
-	uint16_t idx, new_rate;
-
-	/* In case basic rate flag is set */
-	new_rate = BITS_OFF(rate, CSR_DOT11_BASIC_RATE_MASK);
-	if (eCSR_CFG_DOT11_MODE_11A ==
-			mac_ctx->roam.configParam.uCfgDot11Mode) {
-		switch (new_rate) {
-		case eCsrSuppRate_6Mbps:
-		case eCsrSuppRate_9Mbps:
-		case eCsrSuppRate_12Mbps:
-		case eCsrSuppRate_18Mbps:
-		case eCsrSuppRate_24Mbps:
-		case eCsrSuppRate_36Mbps:
-		case eCsrSuppRate_48Mbps:
-		case eCsrSuppRate_54Mbps:
-			supported = true;
-			break;
-		default:
-			supported = false;
-			break;
-		}
-
-	} else if (eCSR_CFG_DOT11_MODE_11B ==
-		   mac_ctx->roam.configParam.uCfgDot11Mode) {
-		switch (new_rate) {
-		case eCsrSuppRate_1Mbps:
-		case eCsrSuppRate_2Mbps:
-		case eCsrSuppRate_5_5Mbps:
-		case eCsrSuppRate_11Mbps:
-			supported = true;
-			break;
-		default:
-			supported = false;
-			break;
-		}
-	} else if (!mac_ctx->roam.configParam.ProprietaryRatesEnabled) {
-
-		switch (new_rate) {
-		case eCsrSuppRate_1Mbps:
-		case eCsrSuppRate_2Mbps:
-		case eCsrSuppRate_5_5Mbps:
-		case eCsrSuppRate_6Mbps:
-		case eCsrSuppRate_9Mbps:
-		case eCsrSuppRate_11Mbps:
-		case eCsrSuppRate_12Mbps:
-		case eCsrSuppRate_18Mbps:
-		case eCsrSuppRate_24Mbps:
-		case eCsrSuppRate_36Mbps:
-		case eCsrSuppRate_48Mbps:
-		case eCsrSuppRate_54Mbps:
-			supported = true;
-			break;
-		default:
-			supported = false;
-			break;
-		}
-	} else if (eCsrSuppRate_1Mbps == new_rate ||
-			eCsrSuppRate_2Mbps == new_rate ||
-			eCsrSuppRate_5_5Mbps == new_rate ||
-			eCsrSuppRate_11Mbps == new_rate)
-		supported = true;
-	else {
-		idx = 0x1;
-
-		switch (new_rate) {
-		case eCsrSuppRate_6Mbps:
-			supported = g_phy_rates_suppt[0][idx];
-			break;
-		case eCsrSuppRate_9Mbps:
-			supported = g_phy_rates_suppt[1][idx];
-			break;
-		case eCsrSuppRate_12Mbps:
-			supported = g_phy_rates_suppt[2][idx];
-			break;
-		case eCsrSuppRate_18Mbps:
-			supported = g_phy_rates_suppt[3][idx];
-			break;
-		case eCsrSuppRate_20Mbps:
-			supported = g_phy_rates_suppt[4][idx];
-			break;
-		case eCsrSuppRate_24Mbps:
-			supported = g_phy_rates_suppt[5][idx];
-			break;
-		case eCsrSuppRate_36Mbps:
-			supported = g_phy_rates_suppt[6][idx];
-			break;
-		case eCsrSuppRate_40Mbps:
-			supported = g_phy_rates_suppt[7][idx];
-			break;
-		case eCsrSuppRate_42Mbps:
-			supported = g_phy_rates_suppt[8][idx];
-			break;
-		case eCsrSuppRate_48Mbps:
-			supported = g_phy_rates_suppt[9][idx];
-			break;
-		case eCsrSuppRate_54Mbps:
-			supported = g_phy_rates_suppt[10][idx];
-			break;
-		case eCsrSuppRate_72Mbps:
-			supported = g_phy_rates_suppt[11][idx];
-			break;
-		case eCsrSuppRate_80Mbps:
-			supported = g_phy_rates_suppt[12][idx];
-			break;
-		case eCsrSuppRate_84Mbps:
-			supported = g_phy_rates_suppt[13][idx];
-			break;
-		case eCsrSuppRate_96Mbps:
-			supported = g_phy_rates_suppt[14][idx];
-			break;
-		case eCsrSuppRate_108Mbps:
-			supported = g_phy_rates_suppt[15][idx];
-			break;
-		case eCsrSuppRate_120Mbps:
-			supported = g_phy_rates_suppt[16][idx];
-			break;
-		case eCsrSuppRate_126Mbps:
-			supported = g_phy_rates_suppt[17][idx];
-			break;
-		case eCsrSuppRate_144Mbps:
-			supported = g_phy_rates_suppt[18][idx];
-			break;
-		case eCsrSuppRate_160Mbps:
-			supported = g_phy_rates_suppt[19][idx];
-			break;
-		case eCsrSuppRate_168Mbps:
-			supported = g_phy_rates_suppt[20][idx];
-			break;
-		case eCsrSuppRate_192Mbps:
-			supported = g_phy_rates_suppt[21][idx];
-			break;
-		case eCsrSuppRate_216Mbps:
-			supported = g_phy_rates_suppt[22][idx];
-			break;
-		case eCsrSuppRate_240Mbps:
-			supported = g_phy_rates_suppt[23][idx];
-			break;
-		default:
-			supported = false;
-			break;
-		}
-	}
-	return supported;
-}
-
-void csr_add_rate_bitmap(uint8_t rate, uint16_t *pRateBitmap)
-{
-	uint16_t rateBitmap;
-	uint16_t n = BITS_OFF(rate, CSR_DOT11_BASIC_RATE_MASK);
-
-	rateBitmap = *pRateBitmap;
-	switch (n) {
-	case SIR_MAC_RATE_1:
-		rateBitmap |= SIR_MAC_RATE_1_BITMAP;
-		break;
-	case SIR_MAC_RATE_2:
-		rateBitmap |= SIR_MAC_RATE_2_BITMAP;
-		break;
-	case SIR_MAC_RATE_5_5:
-		rateBitmap |= SIR_MAC_RATE_5_5_BITMAP;
-		break;
-	case SIR_MAC_RATE_11:
-		rateBitmap |= SIR_MAC_RATE_11_BITMAP;
-		break;
-	case SIR_MAC_RATE_6:
-		rateBitmap |= SIR_MAC_RATE_6_BITMAP;
-		break;
-	case SIR_MAC_RATE_9:
-		rateBitmap |= SIR_MAC_RATE_9_BITMAP;
-		break;
-	case SIR_MAC_RATE_12:
-		rateBitmap |= SIR_MAC_RATE_12_BITMAP;
-		break;
-	case SIR_MAC_RATE_18:
-		rateBitmap |= SIR_MAC_RATE_18_BITMAP;
-		break;
-	case SIR_MAC_RATE_24:
-		rateBitmap |= SIR_MAC_RATE_24_BITMAP;
-		break;
-	case SIR_MAC_RATE_36:
-		rateBitmap |= SIR_MAC_RATE_36_BITMAP;
-		break;
-	case SIR_MAC_RATE_48:
-		rateBitmap |= SIR_MAC_RATE_48_BITMAP;
-		break;
-	case SIR_MAC_RATE_54:
-		rateBitmap |= SIR_MAC_RATE_54_BITMAP;
-		break;
-	}
-	*pRateBitmap = rateBitmap;
-}
-
-bool csr_check_rate_bitmap(uint8_t rate, uint16_t rateBitmap)
-{
-	uint16_t n = BITS_OFF(rate, CSR_DOT11_BASIC_RATE_MASK);
-
-	switch (n) {
-	case SIR_MAC_RATE_1:
-		rateBitmap &= SIR_MAC_RATE_1_BITMAP;
-		break;
-	case SIR_MAC_RATE_2:
-		rateBitmap &= SIR_MAC_RATE_2_BITMAP;
-		break;
-	case SIR_MAC_RATE_5_5:
-		rateBitmap &= SIR_MAC_RATE_5_5_BITMAP;
-		break;
-	case SIR_MAC_RATE_11:
-		rateBitmap &= SIR_MAC_RATE_11_BITMAP;
-		break;
-	case SIR_MAC_RATE_6:
-		rateBitmap &= SIR_MAC_RATE_6_BITMAP;
-		break;
-	case SIR_MAC_RATE_9:
-		rateBitmap &= SIR_MAC_RATE_9_BITMAP;
-		break;
-	case SIR_MAC_RATE_12:
-		rateBitmap &= SIR_MAC_RATE_12_BITMAP;
-		break;
-	case SIR_MAC_RATE_18:
-		rateBitmap &= SIR_MAC_RATE_18_BITMAP;
-		break;
-	case SIR_MAC_RATE_24:
-		rateBitmap &= SIR_MAC_RATE_24_BITMAP;
-		break;
-	case SIR_MAC_RATE_36:
-		rateBitmap &= SIR_MAC_RATE_36_BITMAP;
-		break;
-	case SIR_MAC_RATE_48:
-		rateBitmap &= SIR_MAC_RATE_48_BITMAP;
-		break;
-	case SIR_MAC_RATE_54:
-		rateBitmap &= SIR_MAC_RATE_54_BITMAP;
-		break;
-	}
-	return !!rateBitmap;
-}
-
-bool csr_rates_is_dot11_rate_supported(struct mac_context *mac_ctx, uint8_t rate)
+bool csr_rates_is_dot11_rate_supported(struct mac_context *mac_ctx,
+				       uint8_t rate)
 {
-	uint16_t n = BITS_OFF(rate, CSR_DOT11_BASIC_RATE_MASK);
-
-	return csr_is_aggregate_rate_supported(mac_ctx, n);
+	return wlan_rates_is_dot11_rate_supported(mac_ctx, rate);
 }
 
 #ifndef FEATURE_CM_ENABLE