Просмотр исходного кода

qcacld-3.0: Enable CTS2SELF for specified APs

Enable CTS2SELF for specified APs that has below OUI:

Currently, STA initiates an RTS before sending a data packet and expects
AP to send CTS. The data packet would be sent out only if CTS is
received. But some APs may not respond for the RTS and station would
retry RTS frames continuously till max retry threshold is reached. It's
observed that few commercial APs have this behavior and there is no use
of sending RTS to such APs.

Identify the vendor OUI of such APs, send a self-CTS and send the
data packets. This can avoid RTS spamming also.

Default OUIs: (All values in Hex)
OUI 1: 000C43
OUI data Len: 04
OUI Data : 07000000
OUI data Mask: F0 - 11110000
Info Mask : 21 - 0010 0001 Check for OUI and Band
Capabilities: C0 - 1100 0000 Band == 2 GHz || Band == 5 GHz

OUI 2 : 000C43
OUI data Len : 04
OUI Data : 03000000
OUI data Mask: F0 - 11110000
Info Mask : 21 - 0010 0001 Check for OUI and Band
Capabilities: C0 - 1100 0000 Band == 2 GHz || Band == 5 GHz

OUI 3 : 8CFDF0
OUI data Len : 05
OUI Data : 0101020100
OUI data Mask: F8 - 11111000
Info Mask : 21 - 0010 0001 Check for OUI and Band
Capabilities: C0 - 1100 0000 Band == 2 GHz || Band == 5 GHz

OUI 4 : 8CFDF0
OUI data Len : 05
OUI Data : 0109020300
OUI data Mask: F8 - 11111000
Info Mask : 21 - 0010 0001 Check for OUI and Band
Capabilities: C0 - 1100 0000 Band == 2 GHz || Band == 5 GHz

Change-Id: I98706d997587b712f6e830a43143645ec2e1b1c5
CRs-Fixed: 3637059
Aasir Rasheed 1 год назад
Родитель
Сommit
627795a306

+ 5 - 0
components/action_oui/core/src/wlan_action_oui_main.c

@@ -188,6 +188,11 @@ static void action_oui_load_config(struct action_oui_psoc_priv *psoc_priv)
 		      cfg_get(psoc,
 			      CFG_ACTION_OUI_ENABLE_CTS2SELF_WITH_QOS_NULL),
 		      ACTION_OUI_MAX_STR_LEN);
+
+	qdf_str_lcopy(psoc_priv->action_oui_str[ACTION_OUI_ENABLE_CTS2SELF],
+		      cfg_get(psoc, CFG_ACTION_OUI_ENABLE_CTS2SELF),
+		      ACTION_OUI_MAX_STR_LEN);
+
 	qdf_str_lcopy(psoc_priv->action_oui_str
 			[ACTION_OUI_SEND_SMPS_FRAME_WITH_OMN],
 		      cfg_get(psoc,

+ 53 - 0
components/action_oui/dispatcher/inc/wlan_action_oui_cfg.h

@@ -761,6 +761,58 @@
 	"", \
 	"Used to enable CTS2SELF with QoS null frame for specified APs")
 
+/*
+ * <ini>
+ * g_action_oui_enable_cts_2_self - Used to enable CTS2SELF for specified APs
+ *
+ * Default OUIs: (All values in Hex)
+ * OUI 1: 000C43
+ * OUI data Len: 04
+ * OUI Data : 07000000
+ * OUI data Mask: F0 - 11110000
+ * Info Mask : 21 - 0010 0001 Check for OUI and Band
+ * Capabilities: C0 - 1100 0000 Band == 2 GHz || Band == 5 GHz
+ *
+ * OUI 2 : 000C43
+ * OUI data Len : 04
+ * OUI Data : 03000000
+ * OUI data Mask: F0 - 11110000
+ * Info Mask : 21 - 0010 0001 Check for OUI and Band
+ * Capabilities: C0 - 1100 0000 Band == 2 GHz || Band == 5 GHz
+ *
+ * OUI 3 : 8CFDF0
+ * OUI data Len : 05
+ * OUI Data : 0101020100
+ * OUI data Mask: F8 - 11111000
+ * Info Mask : 21 - 0010 0001 Check for OUI and Band
+ * Capabilities: C0 - 1100 0000 Band == 2 GHz || Band == 5 GHz
+ *
+ * OUI 4 : 8CFDF0
+ * OUI data Len : 05
+ * OUI Data : 0109020300
+ * OUI data Mask: F8 - 11111000
+ * Info Mask : 21 - 0010 0001 Check for OUI and Band
+ * Capabilities: C0 - 1100 0000 Band == 2 GHz || Band == 5 GHz
+ *
+ * g_action_oui_enable_cts_2_self=000C43 04 07000000 F0 21 C0 000C43 04 03000000 F0 21 C0 8CFDF0 05 0101020100 F8 21 C0 8CFDF0 05 0109020300 F8 21 C0
+ *
+ * Refer to gEnableActionOUI for more detail about the format.
+ *
+ * Related: gEnableActionOUI
+ *
+ * Supported Feature: Action OUIs
+ *
+ * Usage: External
+ *
+ * </ini>
+ */
+#define CFG_ACTION_OUI_ENABLE_CTS2SELF CFG_INI_STRING( \
+	"g_action_oui_enable_cts_2_self", \
+	0, \
+	ACTION_OUI_MAX_STR_LEN, \
+	"000C43 04 07000000 F0 21 C0 000C43 04 03000000 F0 21 C0 8CFDF0 05 0101020100 F8 21 C0 8CFDF0 05 0109020300 F8 21 C0", \
+	"Used to enable CTS2SELF frame for specified APs")
+
 /*
  * <ini>
  * gActionOUISendSMPSFrameWithOMN - Used to send SMPS frame along with OMN
@@ -807,6 +859,7 @@
 	CFG(CFG_ACTION_OUI_TAKE_ALL_BAND_INFO) \
 	CFG(CFG_ACTION_OUI_11BE_ALLOW_LIST) \
 	CFG(CFG_ACTION_OUI_DISABLE_DYNAMIC_QOS_NULL_TX_RATE) \
+	CFG(CFG_ACTION_OUI_ENABLE_CTS2SELF) \
 	CFG(CFG_ACTION_OUI_ENABLE_CTS2SELF_WITH_QOS_NULL) \
 	CFG(CFG_ACTION_OUI_SEND_SMPS_FRAME_WITH_OMN) \
 	CFG(CFG_ACTION_OUI_AUTH_ASSOC_6MBPS_2GHZ) \

+ 2 - 0
components/action_oui/dispatcher/inc/wlan_action_oui_public_struct.h

@@ -124,6 +124,7 @@
  * on 2.4 GHz
  * @ACTION_OUI_DISABLE_BFORMEE: disable SU/MU beam formee capability for
  * specified AP
+ * @ACTION_OUI_ENABLE_CTS2SELF: enable cts to self for specified AP's
  * @ACTION_OUI_MAXIMUM_ID: maximum number of action oui types
  */
 enum action_oui_id {
@@ -148,6 +149,7 @@ enum action_oui_id {
 	ACTION_OUI_AUTH_ASSOC_6MBPS_2GHZ,
 	ACTION_OUI_DISABLE_BFORMEE,
 	ACTION_OUI_DISABLE_AGGRESSIVE_EDCA,
+	ACTION_OUI_ENABLE_CTS2SELF,
 	ACTION_OUI_MAXIMUM_ID
 };
 

+ 17 - 0
core/mac/src/pe/include/lim_api.h

@@ -603,6 +603,23 @@ void lim_set_twt_ext_capabilities(struct mac_context *mac_ctx,
  */
 void lim_get_basic_rates(tSirMacRateSet *b_rates, uint32_t chan_freq);
 
+#define FW_CTS2SELF_PROFILE 34
+
+/**
+ * lim_enable_cts_to_self_for_exempted_iot_ap() - enable cts to self for iot ap
+ * @mac_ctx: mac context
+ * @session: pe session
+ * @ie_ptr: ie pointer
+ * @ie_len: ie length
+ *
+ * Return: true on success else false
+ */
+bool lim_enable_cts_to_self_for_exempted_iot_ap(
+				       struct mac_context *mac_ctx,
+				       struct pe_session *session,
+				       uint8_t *ie_ptr,
+				       uint16_t ie_len);
+
 /**
  * lim_fill_pe_session() - Lim fill pe session
  * @mac_ctx: Pointer to mac context

+ 17 - 2
core/mac/src/pe/lim/lim_api.c

@@ -2884,6 +2884,8 @@ pe_roam_synch_callback(struct mac_context *mac_ctx,
 	struct bss_description *bss_desc = NULL;
 	uint16_t ric_tspec_len;
 	struct qdf_mac_addr bssid;
+	uint8_t *oui_ie_ptr;
+	uint16_t oui_ie_len;
 
 	if (!roam_sync_ind_ptr) {
 		pe_err("LFR3:roam_sync_ind_ptr is NULL");
@@ -2999,7 +3001,6 @@ pe_roam_synch_callback(struct mac_context *mac_ctx,
 	/* Next routine may update nss based on dot11Mode */
 
 	lim_ft_prepare_add_bss_req(mac_ctx, ft_session_ptr, bss_desc);
-	qdf_mem_free(bss_desc);
 
 	if (session_ptr->is11Rconnection)
 		lim_fill_fils_ft(session_ptr, ft_session_ptr);
@@ -3020,6 +3021,7 @@ pe_roam_synch_callback(struct mac_context *mac_ctx,
 	if (!sta_ds && !is_multi_link_roam(roam_sync_ind_ptr)) {
 		pe_err("LFR3:failed to lookup hash entry");
 		ft_session_ptr->bRoamSynchInProgress = false;
+		qdf_mem_free(bss_desc);
 		goto roam_sync_fail;
 	}
 
@@ -3034,6 +3036,7 @@ pe_roam_synch_callback(struct mac_context *mac_ctx,
 		pe_err("LFR3:failed to add hash entry for "QDF_MAC_ADDR_FMT,
 		       QDF_MAC_ADDR_REF(add_bss_params->staContext.staMac));
 		ft_session_ptr->bRoamSynchInProgress = false;
+		qdf_mem_free(bss_desc);
 		goto roam_sync_fail;
 	}
 
@@ -3054,18 +3057,30 @@ pe_roam_synch_callback(struct mac_context *mac_ctx,
 		if (ft_session_ptr->is_unexpected_peer_error)
 			status = QDF_STATUS_E_FAILURE;
 
-		if (QDF_IS_STATUS_ERROR(status))
+		if (QDF_IS_STATUS_ERROR(status)) {
+			qdf_mem_free(bss_desc);
 			goto roam_sync_fail;
+		}
 	} else {
 		lim_process_assoc_rsp_frame(mac_ctx, reassoc_resp,
 					    roam_sync_ind_ptr->reassoc_resp_length - SIR_MAC_HDR_LEN_3A,
 					    LIM_REASSOC, ft_session_ptr);
 		if (ft_session_ptr->is_unexpected_peer_error) {
 			status = QDF_STATUS_E_FAILURE;
+			qdf_mem_free(bss_desc);
 			goto roam_sync_fail;
 		}
 	}
 
+	oui_ie_ptr = (uint8_t *)&bss_desc->ieFields[0];
+	oui_ie_len = wlan_get_ielen_from_bss_description(bss_desc);
+	lim_enable_cts_to_self_for_exempted_iot_ap(mac_ctx,
+						   ft_session_ptr,
+						   oui_ie_ptr, oui_ie_len);
+	qdf_mem_free(bss_desc);
+	oui_ie_len = 0;
+	oui_ie_ptr = NULL;
+
 	lim_check_ft_initial_im_association(roam_sync_ind_ptr, ft_session_ptr);
 
 	lim_copy_and_free_hlp_data_from_session(ft_session_ptr,

+ 7 - 0
core/mac/src/pe/lim/lim_process_assoc_rsp_frame.c

@@ -1684,6 +1684,13 @@ lim_process_assoc_rsp_frame(struct mac_context *mac_ctx, uint8_t *rx_pkt_info,
 	lim_update_iot_aggr_sz(mac_ctx, ie, ie_len, session_entry);
 
 	lim_extract_ap_capabilities(mac_ctx, ie, ie_len, beacon);
+
+	if (session_entry->opmode == QDF_STA_MODE) {
+		lim_enable_cts_to_self_for_exempted_iot_ap(
+			mac_ctx, session_entry,
+			ie, ie_len);
+	}
+
 	lim_update_assoc_sta_datas(mac_ctx, sta_ds, assoc_rsp,
 				   session_entry, beacon);
 

+ 22 - 0
core/mac/src/pe/lim/lim_process_sme_req_messages.c

@@ -3098,6 +3098,28 @@ static void lim_reset_self_ocv_caps(struct pe_session *session)
 
 }
 
+bool lim_enable_cts_to_self_for_exempted_iot_ap(
+				       struct mac_context *mac_ctx,
+				       struct pe_session *session,
+				       uint8_t *ie_ptr,
+				       uint16_t ie_len)
+{
+	struct action_oui_search_attr vendor_ap_search_attr;
+
+	vendor_ap_search_attr.ie_data = ie_ptr;
+	vendor_ap_search_attr.ie_length = ie_len;
+
+	if (wlan_action_oui_search(mac_ctx->psoc, &vendor_ap_search_attr,
+				   ACTION_OUI_ENABLE_CTS2SELF)) {
+		pe_debug("vdev %d: enable cts to self", session->vdev_id);
+		wma_cli_set_command(session->vdev_id,
+				    wmi_vdev_param_enable_rtscts,
+				    FW_CTS2SELF_PROFILE, VDEV_CMD);
+		return true;
+	}
+	return false;
+}
+
 /**
  * lim_disable_bformee_for_iot_ap() - disable bformee for iot ap
  *@mac_ctx: mac context

+ 36 - 11
core/mac/src/pe/lim/lim_utils.c

@@ -5272,6 +5272,38 @@ static void lim_update_sta_edca_params(struct mac_context *mac,
 			     sta_session->vdev_id, false);
 }
 
+static void check_and_send_vendor_oui(struct mac_context *mac,
+				      struct pe_session *sta_session)
+{
+	QDF_STATUS status;
+	uint8_t *tmp_ptr = NULL;
+	struct element_info frame;
+
+	status = wlan_scan_get_entry_by_mac_addr(
+			mac->pdev,
+			(struct qdf_mac_addr *)&sta_session->bssId,
+			&frame);
+	if (QDF_IS_STATUS_ERROR(status) && !frame.len) {
+		pe_err("Failed to get scan entry for " QDF_MAC_ADDR_FMT,
+		       QDF_MAC_ADDR_REF(sta_session->bssId));
+		return;
+	}
+
+	tmp_ptr = frame.ptr;
+	tmp_ptr += SIR_MAC_HDR_LEN_3A + SIR_MAC_B_PR_SSID_OFFSET;
+	frame.len -= SIR_MAC_HDR_LEN_3A + SIR_MAC_B_PR_SSID_OFFSET;
+
+	if (!lim_enable_cts_to_self_for_exempted_iot_ap(
+	    mac, sta_session,
+	    tmp_ptr, frame.len))
+		wma_cli_set_command(sta_session->vdev_id,
+				    wmi_vdev_param_enable_rtscts,
+				    cfg_get(mac->psoc,
+					    CFG_ENABLE_FW_RTS_PROFILE),
+					    VDEV_CMD);
+	qdf_mem_free(frame.ptr);
+}
+
 /**
  * lim_check_conc_and_send_edca() - Function to check and update EDCA params
  *                                  and RTS profile based on STA/SAP
@@ -5388,12 +5420,8 @@ static void lim_check_conc_and_send_edca(struct mac_context *mac,
 	 * if active parameters are not equal that means they have been updated
 	 * because of conncurrency and are need to be restored now
 	 */
+		check_and_send_vendor_oui(mac, sta_session);
 
-		wma_cli_set_command(sta_session->vdev_id,
-				    wmi_vdev_param_enable_rtscts,
-				    cfg_get(mac->psoc,
-					    CFG_ENABLE_FW_RTS_PROFILE),
-				    VDEV_CMD);
 		for (i = QCA_WLAN_AC_BE; i < QCA_WLAN_AC_ALL; i++) {
 			if (qdf_mem_cmp(&sta_session->gLimEdcaParamsActive[i],
 					&sta_session->gLimEdcaParams[i],
@@ -5418,12 +5446,9 @@ static void lim_check_conc_and_send_edca(struct mac_context *mac,
 				    cfg_get(mac->psoc,
 					    CFG_ENABLE_FW_RTS_PROFILE),
 				    VDEV_CMD);
-		if (sta_session)
-			wma_cli_set_command(sta_session->vdev_id,
-					    wmi_vdev_param_enable_rtscts,
-					    cfg_get(mac->psoc,
-						    CFG_ENABLE_FW_RTS_PROFILE),
-					    VDEV_CMD);
+		if (sta_session) {
+			check_and_send_vendor_oui(mac, sta_session);
+		}
 
 		for (i = QCA_WLAN_AC_BE; i < QCA_WLAN_AC_ALL; i++) {
 			if (qdf_mem_cmp(&sap_session->gLimEdcaParamsActive[i],