Browse Source

qcacld-3.0: Add configuration support for vdev dot11 mode

Add user configuration support to configure dot11 modes for
different vdev types.

Change-Id: I338d9d76f000195d1798bbc8b3b7ff1fb33ee305
CRs-Fixed: 2760240
Kiran Kumar Lokere 4 years ago
parent
commit
6ae664ed6c

+ 4 - 2
components/mlme/core/src/wlan_mlme_main.c

@@ -2232,9 +2232,11 @@ static void mlme_init_reg_cfg(struct wlan_objmgr_psoc *psoc,
 }
 
 static void
-mlme_init_dot11_mode_cfg(struct wlan_mlme_dot11_mode *dot11_mode)
+mlme_init_dot11_mode_cfg(struct wlan_objmgr_psoc *psoc,
+			 struct wlan_mlme_dot11_mode *dot11_mode)
 {
 	dot11_mode->dot11_mode = cfg_default(CFG_DOT11_MODE);
+	dot11_mode->vdev_type_dot11_mode = cfg_get(psoc, CFG_VDEV_DOT11_MODE);
 }
 
 QDF_STATUS mlme_cfg_on_psoc_enable(struct wlan_objmgr_psoc *psoc)
@@ -2274,7 +2276,7 @@ QDF_STATUS mlme_cfg_on_psoc_enable(struct wlan_objmgr_psoc *psoc)
 	mlme_init_lfr_cfg(psoc, &mlme_cfg->lfr);
 	mlme_init_feature_flag_in_cfg(psoc, &mlme_cfg->feature_flags);
 	mlme_init_roam_scoring_cfg(psoc, &mlme_cfg->roam_scoring);
-	mlme_init_dot11_mode_cfg(&mlme_cfg->dot11_mode);
+	mlme_init_dot11_mode_cfg(psoc, &mlme_cfg->dot11_mode);
 	mlme_init_threshold_cfg(psoc, &mlme_cfg->threshold);
 	mlme_init_acs_cfg(psoc, &mlme_cfg->acs);
 	mlme_init_power_cfg(psoc, &mlme_cfg->power);

+ 51 - 1
components/mlme/dispatcher/inc/cfg_mlme_dot11mode.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2019 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-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
@@ -31,8 +31,58 @@
 		CFG_VALUE_OR_DEFAULT, \
 		"dot 11 mode")
 
+/*
+ * <ini>
+ * vdev_dot11_mode- Bit mask to set the dot11 mode for different vdev types
+ * @Min: 0x0
+ * @Max: 0x333333
+ * @Default: 0
+ *
+ * This ini is used to set the dot11mode different vdev types.
+ * dot11_mode ini value (CFG_DOT11_MODE) is the master configuration
+ * Min configuration of INI dot11_mode and vdev_dot11_mode is used for that
+ * vdev type.
+ * dot11_mode vdev_dot11_mode dot11_mode_used
+ * 11AX        11AC              11AC
+ * 11AC        11AX              11AC
+ *
+ * Dot11 mode value is 4 bit length for each vdev. Below is the bit definition
+ * for different vdev types dot11 mode value bit index.
+ *
+ * Bits used for dot11mode        Vdev Type
+ * BIT[3:0]                       STA mode
+ * BIT[7:4]                       P2P_CLI/P2P_DEVICE mode
+ * BIT[11:8]                      NAN DISCOVERY
+ * BIT[15:12]                     OCB
+ * BIT[19:16]                     TDLS
+ * BIT[23:20]                     NDI mode
+ *
+ * Dot11 mode value to be set in the above bit definition:
+ * 0 - Auto, Uses CFG_DOT11_MODE setting
+ * 1 - HT mode(11N)
+ * 2 - VHT mode(11AC)
+ * 3 - HE mode(11AX)
+ *
+ * E.g: vdev_dot11_mode=0x013220
+ *
+ * 0          1        3       2             2        0
+ * NDI(auto)  TDLS HT  OCB_HE  VHT NAN_DISC  VHT P2P  STA_AUTO
+ *
+ * Usage: Internal/External
+ *
+ * </ini>
+ */
+#define CFG_VDEV_DOT11_MODE CFG_INI_UINT( \
+		"vdev_dot11_mode", \
+		0, \
+		0x333333, \
+		0, \
+		CFG_VALUE_OR_DEFAULT, \
+		"vdev dot 11 mode")
+
 #define CFG_DOT11_MODE_ALL \
 	CFG(CFG_DOT11_MODE) \
+	CFG(CFG_VDEV_DOT11_MODE) \
 
 #endif /* __CFG_MLME_DOT11MODE_H */
 

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

@@ -43,6 +43,13 @@
 #define CFG_VHT_TX_MCS_MAP_STAMAX    0xFFFF
 #define CFG_VHT_TX_MCS_MAP_STADEF    0xFFFE
 
+#define STA_DOT11_MODE_INDX       0
+#define P2P_DEV_DOT11_MODE_INDX   4
+#define NAN_DISC_DOT11_MODE_INDX  8
+#define OCB_DOT11_MODE_INDX       12
+#define TDLS_DOT11_MODE_INDX      16
+#define NDI_DOT11_MODE_INDX       20
+
 /* Roam debugging related macro defines */
 #define MAX_ROAM_DEBUG_BUF_SIZE    250
 #define MAX_ROAM_EVENTS_SUPPORTED  5
@@ -195,13 +202,29 @@ enum mlme_dot11_mode {
 	MLME_DOT11_MODE_11AX_ONLY
 };
 
+/**
+ * enum mlme_vdev_dot11_mode - Dot11 mode of the vdev
+ * MLME_VDEV_DOT11_MODE_AUTO: vdev uses mlme_dot11_mode
+ * MLME_VDEV_DOT11_MODE_11N: vdev supports 11N mode
+ * MLME_VDEV_DOT11_MODE_11AC: vdev supports 11AC mode
+ * MLME_VDEV_DOT11_MODE_11AX: vdev supports 11AX mode
+ */
+enum mlme_vdev_dot11_mode {
+	MLME_VDEV_DOT11_MODE_AUTO,
+	MLME_VDEV_DOT11_MODE_11N,
+	MLME_VDEV_DOT11_MODE_11AC,
+	MLME_VDEV_DOT11_MODE_11AX,
+};
+
 /**
  * struct wlan_mlme_dot11_mode - dot11 mode
  *
  * @dot11_mode: dot11 mode supported
+ * @vdev_type_dot11_mode: dot11 mode supported by different vdev types
  */
 struct wlan_mlme_dot11_mode {
 	enum mlme_dot11_mode dot11_mode;
+	uint32_t vdev_type_dot11_mode;
 };
 
 /**

+ 4 - 2
core/hdd/src/wlan_hdd_main.c

@@ -5610,7 +5610,8 @@ QDF_STATUS hdd_init_station_mode(struct hdd_adapter *adapter)
 		hdd_err("unable to get vht_enable2x2");
 	sme_set_pdev_ht_vht_ies(mac_handle, bval);
 
-	sme_set_vdev_ies_per_band(mac_handle, adapter->vdev_id);
+	sme_set_vdev_ies_per_band(mac_handle, adapter->vdev_id,
+				  adapter->device_mode);
 
 	hdd_roam_profile_init(adapter);
 	hdd_register_wext(adapter->dev);
@@ -5717,7 +5718,8 @@ QDF_STATUS hdd_init_station_mode(struct hdd_adapter *adapter)
 		hdd_err("unable to get vht_enable2x2");
 	sme_set_pdev_ht_vht_ies(mac_handle, bval);
 
-	sme_set_vdev_ies_per_band(mac_handle, adapter->vdev_id);
+	sme_set_vdev_ies_per_band(mac_handle, adapter->vdev_id,
+				  adapter->device_mode);
 
 	hdd_roam_profile_init(adapter);
 	hdd_register_wext(adapter->dev);

+ 2 - 1
core/hdd/src/wlan_hdd_nan_datapath.c

@@ -492,7 +492,8 @@ int hdd_init_nan_data_mode(struct hdd_adapter *adapter)
 		hdd_err("unable to get vht_enable2x2");
 
 	sme_set_pdev_ht_vht_ies(mac_handle, bval);
-	sme_set_vdev_ies_per_band(mac_handle, adapter->vdev_id);
+	sme_set_vdev_ies_per_band(mac_handle, adapter->vdev_id,
+				  adapter->device_mode);
 
 	hdd_roam_profile_init(adapter);
 	hdd_register_wext(wlan_dev);

+ 2 - 0
core/mac/inc/sir_api.h

@@ -3361,6 +3361,8 @@ struct sir_set_vdev_ies_per_band {
 	uint16_t msg_type;
 	uint16_t len;
 	uint32_t vdev_id;
+	uint16_t dot11_mode;
+	enum QDF_OPMODE device_mode;
 };
 
 /**

+ 4 - 3
core/mac/src/pe/lim/lim_process_sme_req_messages.c

@@ -4295,7 +4295,7 @@ static void lim_set_pdev_vht_ie(struct mac_context *mac_ctx, uint8_t pdev_id,
  * Return: None
  */
 static void lim_process_set_vdev_ies_per_band(struct mac_context *mac_ctx,
-						uint32_t *msg_buf)
+					      uint32_t *msg_buf)
 {
 	struct sir_set_vdev_ies_per_band *p_msg =
 				(struct sir_set_vdev_ies_per_band *)msg_buf;
@@ -4308,8 +4308,9 @@ static void lim_process_set_vdev_ies_per_band(struct mac_context *mac_ctx,
 	pe_debug("rcvd set vdev ie per band req vdev_id = %d",
 		p_msg->vdev_id);
 	/* intentionally using NULL here so that self capabilty are sent */
-	if (lim_send_ies_per_band(mac_ctx, NULL, p_msg->vdev_id) !=
-			QDF_STATUS_SUCCESS)
+	if (lim_send_ies_per_band(mac_ctx, NULL, p_msg->vdev_id,
+				  p_msg->dot11_mode, p_msg->device_mode) !=
+	    QDF_STATUS_SUCCESS)
 		pe_err("Unable to send HT/VHT Cap to FW");
 }
 

+ 6 - 31
core/mac/src/pe/lim/lim_utils.c

@@ -5682,54 +5682,29 @@ static QDF_STATUS lim_send_vht_caps_ie(struct mac_context *mac_ctx,
 	return QDF_STATUS_E_FAILURE;
 }
 
-/**
- * lim_send_ies_per_band() - gets ht and vht capability and send to firmware via
- * wma
- * @mac_ctx: global mac context
- * @session: pe session. This can be NULL. In that case self cap will be sent
- * @vdev_id: vdev for which IE is targeted
- *
- * This funciton gets ht and vht capability and send to firmware via wma
- *
- * Return: status of operation
- */
 QDF_STATUS lim_send_ies_per_band(struct mac_context *mac_ctx,
-				 struct pe_session *session,
-				 uint8_t vdev_id)
+				 struct pe_session *session, uint8_t vdev_id,
+				 enum csr_cfgdot11mode dot11_mode,
+				 enum QDF_OPMODE device_mode)
 {
-	struct wlan_objmgr_vdev *vdev;
-	enum QDF_OPMODE device_mode;
 	QDF_STATUS status_ht = QDF_STATUS_SUCCESS;
 	QDF_STATUS status_vht = QDF_STATUS_SUCCESS;
 	QDF_STATUS status_he = QDF_STATUS_SUCCESS;
 
-	vdev = wlan_objmgr_get_vdev_by_id_from_psoc(
-			mac_ctx->psoc, vdev_id,
-			WLAN_LEGACY_MAC_ID);
-	if (!vdev) {
-		pe_err("vdev is NULL");
-		return QDF_STATUS_E_FAILURE;
-	}
-	device_mode = wlan_vdev_mlme_get_opmode(vdev);
-	wlan_objmgr_vdev_release_ref(vdev, WLAN_LEGACY_MAC_ID);
-
 	/*
 	 * Note: Do not use Dot11f VHT structure, since 1 byte present flag in
 	 * it is causing weird padding errors. Instead use Sir Mac VHT struct
 	 * to send IE to wma.
 	 */
-	if (is_dot11mode_support_ht_cap(
-				mac_ctx->roam.configParam.uCfgDot11Mode))
+	if (is_dot11mode_support_ht_cap(dot11_mode))
 		status_ht = lim_send_ht_caps_ie(mac_ctx, session,
 						device_mode, vdev_id);
 
-	if (is_dot11mode_support_vht_cap(
-				mac_ctx->roam.configParam.uCfgDot11Mode))
+	if (is_dot11mode_support_vht_cap(dot11_mode))
 		status_vht = lim_send_vht_caps_ie(mac_ctx, session,
 						  device_mode, vdev_id);
 
-	if (is_dot11mode_support_he_cap(
-				mac_ctx->roam.configParam.uCfgDot11Mode)) {
+	if (is_dot11mode_support_he_cap(dot11_mode)) {
 		status_he = lim_send_he_caps_ie(mac_ctx, session,
 						device_mode, vdev_id);
 

+ 16 - 1
core/mac/src/pe/lim/lim_utils.h

@@ -862,8 +862,23 @@ void lim_check_and_reset_protection_params(struct mac_context *mac_ctx);
 QDF_STATUS lim_send_ext_cap_ie(struct mac_context *mac_ctx, uint32_t session_id,
 			       tDot11fIEExtCap *extracted_extcap, bool merge);
 
+/**
+ * lim_send_ies_per_band() - gets ht and vht capability and send to firmware via
+ * wma
+ * @mac_ctx: global mac context
+ * @session: pe session. This can be NULL. In that case self cap will be sent
+ * @vdev_id: vdev for which IE is targeted
+ * @dot11_mode: vdev dot11 mode
+ * @device_mode: device mode
+ *
+ * This funciton gets ht and vht capability and send to firmware via wma
+ *
+ * Return: status of operation
+ */
 QDF_STATUS lim_send_ies_per_band(struct mac_context *mac_ctx,
-				 struct pe_session *session, uint8_t vdev_id);
+				 struct pe_session *session, uint8_t vdev_id,
+				 enum csr_cfgdot11mode dot11_mode,
+				 enum QDF_OPMODE device_mode);
 
 /**
  * lim_send_action_frm_tb_ppdu_cfg() - sets action frame in TB PPDU cfg to FW

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

@@ -751,6 +751,26 @@ struct csr_roamstruct {
 	((eCSR_DOT11_MODE_11ac == phy_mode) || \
 	 (eCSR_DOT11_MODE_11ac_ONLY == phy_mode))
 
+#define CSR_IS_DOT11_MODE_11N(dot11mode) \
+	((dot11mode == eCSR_CFG_DOT11_MODE_AUTO) || \
+	 (dot11mode == eCSR_CFG_DOT11_MODE_11N) || \
+	 (dot11mode == eCSR_CFG_DOT11_MODE_11AC) || \
+	 (dot11mode == eCSR_CFG_DOT11_MODE_11N_ONLY) || \
+	 (dot11mode == eCSR_CFG_DOT11_MODE_11AC_ONLY) || \
+	 (dot11mode == eCSR_CFG_DOT11_MODE_11AX) || \
+	 (dot11mode == eCSR_CFG_DOT11_MODE_11AX_ONLY))
+
+#define CSR_IS_DOT11_MODE_11AC(dot11mode) \
+	((dot11mode == eCSR_CFG_DOT11_MODE_AUTO) || \
+	 (dot11mode == eCSR_CFG_DOT11_MODE_11AC) || \
+	 (dot11mode == eCSR_CFG_DOT11_MODE_11AC_ONLY) || \
+	 (dot11mode == eCSR_CFG_DOT11_MODE_11AX) || \
+	 (dot11mode == eCSR_CFG_DOT11_MODE_11AX_ONLY))
+
+#define CSR_IS_DOT11_MODE_11AX(dot11mode) \
+	((dot11mode == eCSR_CFG_DOT11_MODE_AUTO) || \
+	 (dot11mode == eCSR_CFG_DOT11_MODE_11AX) || \
+	 (dot11mode == eCSR_CFG_DOT11_MODE_11AX_ONLY))
 /*
  * this function returns true if the NIC is operating exclusively in
  * the 2.4 GHz band, meaning. it is NOT operating in the 5.0 GHz band.
@@ -811,6 +831,22 @@ struct csr_roamstruct {
 #define CSR_GET_SUBNET_STATUS(roam_reason) (0)
 #endif
 
+/**
+ * csr_get_vdev_dot11_mode() - get the supported dot11mode by vdev
+ * @mac_ctx:  pointer to global mac structure
+ * @device_mode: vdev mode
+ * @curr_dot11_mode: Current dot11 mode
+ *
+ * The function return the min of supported dot11 mode and vdev type dot11mode
+ * for given vdev type.
+ *
+ * Return:csr_cfgdot11mode
+ */
+enum csr_cfgdot11mode
+csr_get_vdev_dot11_mode(struct mac_context *mac,
+			enum QDF_OPMODE device_mode,
+			enum csr_cfgdot11mode curr_dot11_mode);
+
 QDF_STATUS csr_get_channel_and_power_list(struct mac_context *mac);
 
 QDF_STATUS csr_scan_filter_results(struct mac_context *mac);

+ 11 - 1
core/sme/inc/sme_api.h

@@ -2153,7 +2153,17 @@ QDF_STATUS sme_create_mon_session(mac_handle_t mac_handle, uint8_t *bssid,
  */
 QDF_STATUS sme_delete_mon_session(mac_handle_t mac_handle, uint8_t vdev_id);
 
-void sme_set_vdev_ies_per_band(mac_handle_t mac_handle, uint8_t vdev_id);
+/**
+ * sme_set_vdev_ies_per_band() - sends the per band IEs to vdev
+ * @mac_handle: Opaque handle to the global MAC context
+ * @vdev_id: vdev_id for which IE is targeted
+ * @device_mode: vdev mode
+ *
+ * Return: None
+ */
+void sme_set_vdev_ies_per_band(mac_handle_t mac_handle, uint8_t vdev_id,
+			       enum QDF_OPMODE device_mode);
+
 void sme_set_pdev_ht_vht_ies(mac_handle_t mac_handle, bool enable2x2);
 
 /**

+ 11 - 10
core/sme/src/common/sme_api.c

@@ -13159,27 +13159,28 @@ void sme_set_chan_info_callback(mac_handle_t mac_handle,
 	mac->chan_info_cb = callback;
 }
 
-/**
- * sme_set_vdev_ies_per_band() - sends the per band IEs to vdev
- * @mac_handle: Opaque handle to the global MAC context
- * @vdev_id: vdev_id for which IE is targeted
- *
- * Return: None
- */
-void sme_set_vdev_ies_per_band(mac_handle_t mac_handle, uint8_t vdev_id)
+void sme_set_vdev_ies_per_band(mac_handle_t mac_handle, uint8_t vdev_id,
+			       enum QDF_OPMODE device_mode)
 {
 	struct sir_set_vdev_ies_per_band *p_msg;
 	QDF_STATUS status = QDF_STATUS_E_FAILURE;
+	struct mac_context *mac_ctx = MAC_CONTEXT(mac_handle);
+	enum csr_cfgdot11mode curr_dot11_mode =
+				mac_ctx->roam.configParam.uCfgDot11Mode;
 
 	p_msg = qdf_mem_malloc(sizeof(*p_msg));
 	if (!p_msg)
 		return;
 
+
 	p_msg->vdev_id = vdev_id;
+	p_msg->device_mode = device_mode;
+	p_msg->dot11_mode = csr_get_vdev_dot11_mode(mac_ctx, device_mode,
+						    curr_dot11_mode);
 	p_msg->msg_type = eWNI_SME_SET_VDEV_IES_PER_BAND;
 	p_msg->len = sizeof(*p_msg);
-	sme_debug("sending eWNI_SME_SET_VDEV_IES_PER_BAND: vdev_id: %d",
-		vdev_id);
+	sme_debug("SET_VDEV_IES_PER_BAND: vdev_id %d dot11mode %d dev_mode %d",
+		  vdev_id, p_msg->dot11_mode, device_mode);
 	status = umac_send_mb_message_to_mac(p_msg);
 	if (QDF_STATUS_SUCCESS != status)
 		sme_err("Send eWNI_SME_SET_VDEV_IES_PER_BAND fail");

+ 63 - 0
core/sme/src/csr/csr_util.c

@@ -599,6 +599,66 @@ bool csr_is_conn_state_wds(struct mac_context *mac, uint32_t sessionId)
 	       csr_is_conn_state_disconnected_wds(mac, sessionId);
 }
 
+enum csr_cfgdot11mode
+csr_get_vdev_dot11_mode(struct mac_context *mac,
+			enum QDF_OPMODE device_mode,
+			enum csr_cfgdot11mode curr_dot11_mode)
+{
+	enum mlme_vdev_dot11_mode vdev_dot11_mode;
+	uint8_t dot11_mode_indx;
+	enum csr_cfgdot11mode dot11_mode = curr_dot11_mode;
+	uint32_t vdev_type_dot11_mode =
+				mac->mlme_cfg->dot11_mode.vdev_type_dot11_mode;
+
+	sme_debug("curr_dot11_mode %d, vdev_dot11 %08X, dev_mode %d",
+		  curr_dot11_mode, vdev_type_dot11_mode, device_mode);
+
+	switch (device_mode) {
+	case QDF_STA_MODE:
+		dot11_mode_indx = STA_DOT11_MODE_INDX;
+		break;
+	case QDF_P2P_CLIENT_MODE:
+	case QDF_P2P_DEVICE_MODE:
+		dot11_mode_indx = P2P_DEV_DOT11_MODE_INDX;
+		break;
+	case QDF_TDLS_MODE:
+		dot11_mode_indx = TDLS_DOT11_MODE_INDX;
+		break;
+	case QDF_NAN_DISC_MODE:
+		dot11_mode_indx = NAN_DISC_DOT11_MODE_INDX;
+		break;
+	case QDF_NDI_MODE:
+		dot11_mode_indx = NDI_DOT11_MODE_INDX;
+		break;
+	case QDF_OCB_MODE:
+		dot11_mode_indx = OCB_DOT11_MODE_INDX;
+		break;
+	default:
+		return dot11_mode;
+	}
+	vdev_dot11_mode = QDF_GET_BITS(vdev_type_dot11_mode,
+				       dot11_mode_indx, 4);
+	if (vdev_dot11_mode == MLME_VDEV_DOT11_MODE_AUTO)
+		dot11_mode = curr_dot11_mode;
+
+	if (CSR_IS_DOT11_MODE_11N(curr_dot11_mode) &&
+	    vdev_dot11_mode == MLME_VDEV_DOT11_MODE_11N)
+		dot11_mode = eCSR_CFG_DOT11_MODE_11N;
+
+	if (CSR_IS_DOT11_MODE_11AC(curr_dot11_mode) &&
+	    vdev_dot11_mode == MLME_VDEV_DOT11_MODE_11AC)
+		dot11_mode = eCSR_CFG_DOT11_MODE_11AC;
+
+	if (CSR_IS_DOT11_MODE_11AX(curr_dot11_mode) &&
+	    vdev_dot11_mode == MLME_VDEV_DOT11_MODE_11AX)
+		dot11_mode = eCSR_CFG_DOT11_MODE_11AX;
+
+	sme_debug("INI vdev_dot11_mode %d new dot11_mode %d",
+		  vdev_dot11_mode, dot11_mode);
+
+	return dot11_mode;
+}
+
 static bool csr_is_conn_state_ap(struct mac_context *mac, uint32_t sessionId)
 {
 	struct csr_roam_session *pSession;
@@ -1909,6 +1969,9 @@ bool csr_is_phy_mode_match(struct mac_context *mac, uint32_t phyMode,
 			}
 		}
 	}
+
+	cfgDot11ModeToUse = csr_get_vdev_dot11_mode(mac, pProfile->csrPersona,
+						    cfgDot11ModeToUse);
 	if (fMatch && pReturnCfgDot11Mode) {
 		if (pProfile) {
 			/*