Эх сурвалжийг харах

qcacld-3.0: Relocate gProbeReqOUIs ini to FW offload component

Relocate gProbeReqOUIs ini parameter to FW offload component.

Change-Id: Ie3764cfaf3625911a14cc43fb7eaab415f54ece1
CRs-Fixed: 2324746
Dundi Raviteja 6 жил өмнө
parent
commit
29ec76d198

+ 23 - 17
fw_offload/core/inc/wlan_fw_offload_main.h

@@ -27,6 +27,8 @@
 #include <wlan_objmgr_global_obj.h>
 #include <wlan_cmn.h>
 
+#include "cfg_ie_whitelist.h"
+
 #define fwol_alert(params...) QDF_TRACE_FATAL(QDF_MODULE_ID_FWOL, params)
 #define fwol_err(params...) QDF_TRACE_ERROR(QDF_MODULE_ID_FWOL, params)
 #define fwol_warn(params...) QDF_TRACE_WARN(QDF_MODULE_ID_FWOL, params)
@@ -63,14 +65,14 @@ struct wlan_fwol_coex_config {
 
 /*
  * struct wlan_fwol_thermal_temp - Thermal temperature config items
- * thermal_temp_min_level0: Thermal temperature minimum level 0
- * thermal_temp_max_level0: Thermal temperature maximum level 0
- * thermal_temp_min_level1: Thermal temperature minimum level 1
- * thermal_temp_max_level1: Thermal temperature maximum level 1
- * thermal_temp_min_level2: Thermal temperature minimum level 2
- * thermal_temp_max_level2: Thermal temperature maximum level 2
- * thermal_temp_min_level3: Thermal temperature minimum level 3
- * thermal_temp_max_level3: Thermal temperature maximum level 3
+ * @thermal_temp_min_level0: Thermal temperature minimum level 0
+ * @thermal_temp_max_level0: Thermal temperature maximum level 0
+ * @thermal_temp_min_level1: Thermal temperature minimum level 1
+ * @thermal_temp_max_level1: Thermal temperature maximum level 1
+ * @thermal_temp_min_level2: Thermal temperature minimum level 2
+ * @thermal_temp_max_level2: Thermal temperature maximum level 2
+ * @thermal_temp_min_level3: Thermal temperature minimum level 3
+ * @thermal_temp_max_level3: Thermal temperature maximum level 3
  */
 struct wlan_fwol_thermal_temp {
 	uint16_t thermal_temp_min_level0;
@@ -85,15 +87,17 @@ struct wlan_fwol_thermal_temp {
 
 /**
  * struct wlan_fwol_ie_whitelist - Probe request IE whitelist config items
- * ie_whitelist: IE whitelist flag
- * ie_bitmap_0: IE bitmap 0
- * ie_bitmap_1: IE bitmap 1
- * ie_bitmap_2: IE bitmap 2
- * ie_bitmap_3: IE bitmap 3
- * ie_bitmap_4: IE bitmap 4
- * ie_bitmap_5: IE bitmap 5
- * ie_bitmap_6: IE bitmap 6
- * ie_bitmap_7: IE bitmap 7
+ * @ie_whitelist: IE whitelist flag
+ * @ie_bitmap_0: IE bitmap 0
+ * @ie_bitmap_1: IE bitmap 1
+ * @ie_bitmap_2: IE bitmap 2
+ * @ie_bitmap_3: IE bitmap 3
+ * @ie_bitmap_4: IE bitmap 4
+ * @ie_bitmap_5: IE bitmap 5
+ * @ie_bitmap_6: IE bitmap 6
+ * @ie_bitmap_7: IE bitmap 7
+ * @no_of_probe_req_ouis: Total number of ouis present in probe req
+ * @probe_req_voui: Stores oui values after parsing probe req ouis
  */
 struct wlan_fwol_ie_whitelist {
 	bool ie_whitelist;
@@ -105,6 +109,8 @@ struct wlan_fwol_ie_whitelist {
 	uint32_t ie_bitmap_5;
 	uint32_t ie_bitmap_6;
 	uint32_t ie_bitmap_7;
+	uint32_t no_of_probe_req_ouis;
+	uint32_t probe_req_voui[MAX_PROBE_REQ_OUIS];
 };
 
 /**

+ 96 - 0
fw_offload/core/src/wlan_fw_offload_main.c

@@ -76,6 +76,99 @@ fwol_init_thermal_temp_in_cfg(struct wlan_objmgr_psoc *psoc,
 				cfg_get(psoc, CFG_THERMAL_TEMP_MAX_LEVEL3);
 }
 
+/**
+ * fwol_parse_probe_req_ouis - form ouis from ini gProbeReqOUIs
+ * @psoc: Pointer to struct wlan_objmgr_psoc context
+ * @whitelist: Pointer to struct wlan_fwol_ie_whitelist
+ *
+ * This function parses the ini string gProbeReqOUIs which needs be to in the
+ * following format:
+ * "<8 characters of [0-9] or [A-F]>space<8 characters from [0-9] etc.,"
+ * example: "AABBCCDD 1122EEFF"
+ * and the logic counts the number of OUIS and allocates the memory
+ * for every valid OUI and is stored in struct hdd_context
+ *
+ * Return: None
+ */
+static void fwol_parse_probe_req_ouis(struct wlan_objmgr_psoc *psoc,
+				      struct wlan_fwol_ie_whitelist *whitelist)
+{
+	uint8_t probe_req_ouis[MAX_PRB_REQ_VENDOR_OUI_INI_LEN] = {0};
+	uint32_t *voui = whitelist->probe_req_voui;
+	char *str;
+	uint8_t *token;
+	uint32_t oui_indx = 0;
+	int ret;
+	uint32_t hex_value;
+
+	qdf_str_lcopy(probe_req_ouis, cfg_get(psoc, CFG_PROBE_REQ_OUI),
+		      MAX_PRB_REQ_VENDOR_OUI_INI_LEN);
+	str = probe_req_ouis;
+	whitelist->no_of_probe_req_ouis = 0;
+
+	if (!qdf_str_len(str)) {
+		fwol_info("NO OUIs to parse");
+		return;
+	}
+
+	token = strsep(&str, " ");
+	while (token) {
+		if (qdf_str_len(token) != 8)
+			goto next_token;
+
+		ret = qdf_kstrtouint(token, 16, &hex_value);
+		if (ret)
+			goto next_token;
+
+		voui[oui_indx++] = cpu_to_be32(hex_value);
+		if (oui_indx >= MAX_PROBE_REQ_OUIS)
+			break;
+next_token:
+		token = strsep(&str, " ");
+	}
+
+	if (!oui_indx) {
+		whitelist->ie_whitelist = false;
+		return;
+	}
+
+	whitelist->no_of_probe_req_ouis = oui_indx;
+}
+
+/**
+ * fwol_validate_ie_bitmaps() - Validate all IE whitelist bitmap param values
+ * @psoc: Pointer to struct wlan_objmgr_psoc
+ * @whitelist: Pointer to struct wlan_fwol_ie_whitelist
+ *
+ * Return: True if all bitmap values are valid, else false
+ */
+static bool fwol_validate_ie_bitmaps(struct wlan_objmgr_psoc *psoc,
+				     struct wlan_fwol_ie_whitelist *whitelist)
+{
+	if (!(whitelist->ie_bitmap_0 && whitelist->ie_bitmap_1 &&
+	      whitelist->ie_bitmap_2 && whitelist->ie_bitmap_3 &&
+	      whitelist->ie_bitmap_4 && whitelist->ie_bitmap_5 &&
+	      whitelist->ie_bitmap_6 && whitelist->ie_bitmap_7))
+		return false;
+
+	/*
+	 * check whether vendor oui IE is set and OUIs are present, each OUI
+	 * is entered in the form of string of 8 characters from ini, therefore,
+	 * for atleast one OUI, minimum length is 8 and hence this string length
+	 * is checked for minimum of 8
+	 */
+	if ((whitelist->ie_bitmap_6 & VENDOR_SPECIFIC_IE_BITMAP) &&
+	    (qdf_str_len(cfg_get(psoc, CFG_PROBE_REQ_OUI)) < 8))
+		return false;
+
+	/* check whether vendor oui IE is not set but OUIs are present */
+	if (!(whitelist->ie_bitmap_6 & VENDOR_SPECIFIC_IE_BITMAP) &&
+	    (qdf_str_len(cfg_get(psoc, CFG_PROBE_REQ_OUI)) > 0))
+		return false;
+
+	return true;
+}
+
 static void
 fwol_init_ie_whiltelist_in_cfg(struct wlan_objmgr_psoc *psoc,
 			       struct wlan_fwol_ie_whitelist *whitelist)
@@ -89,6 +182,9 @@ fwol_init_ie_whiltelist_in_cfg(struct wlan_objmgr_psoc *psoc,
 	whitelist->ie_bitmap_5 = cfg_get(psoc, CFG_PROBE_REQ_IE_BIT_MAP5);
 	whitelist->ie_bitmap_6 = cfg_get(psoc, CFG_PROBE_REQ_IE_BIT_MAP6);
 	whitelist->ie_bitmap_7 = cfg_get(psoc, CFG_PROBE_REQ_IE_BIT_MAP7);
+	if (!fwol_validate_ie_bitmaps(psoc, whitelist))
+		whitelist->ie_whitelist = false;
+	fwol_parse_probe_req_ouis(psoc, whitelist);
 }
 
 /**

+ 34 - 1
fw_offload/dispatcher/inc/cfg_ie_whitelist.h

@@ -274,6 +274,38 @@
 			CFG_VALUE_OR_DEFAULT, \
 			"IE Bitmap 7")
 
+#define MAX_PRB_REQ_VENDOR_OUI_INI_LEN 160
+#define VENDOR_SPECIFIC_IE_BITMAP 0x20000000
+/*
+ * For vendor specific IE, Probe Req OUI types and sub types which are
+ * to be white listed are specified in gProbeReqOUIs in the following
+ * example format - gProbeReqOUIs=AABBCCDD EEFF1122
+ */
+
+/*
+ * <ini>
+ * gProbeReqOUIs - Used to specify vendor specific OUIs
+ * @Default: Empty string
+ *
+ * This ini is used to include the specified OUIs in vendor specific IE
+ * of probe request.
+ *
+ * Related: Need to enable g_enable_probereq_whitelist_ies and
+ * vendor specific IE should be set in g_probe_req_ie_bitmap_6.
+ *
+ * Supported Feature: Probe request ie whitelisting
+ *
+ * Usage: Internal/External
+ *
+ * </ini>
+ */
+#define CFG_PROBE_REQ_OUI CFG_INI_STRING( \
+			"gProbeReqOUIs", \
+			0, \
+			MAX_PRB_REQ_VENDOR_OUI_INI_LEN, \
+			"", \
+			"Probe Req OUIs")
+
 #define CFG_IE_WHITELIST \
 	CFG(CFG_PROBE_REQ_IE_WHITELIST) \
 	CFG(CFG_PROBE_REQ_IE_BIT_MAP0) \
@@ -283,6 +315,7 @@
 	CFG(CFG_PROBE_REQ_IE_BIT_MAP4) \
 	CFG(CFG_PROBE_REQ_IE_BIT_MAP5) \
 	CFG(CFG_PROBE_REQ_IE_BIT_MAP6) \
-	CFG(CFG_PROBE_REQ_IE_BIT_MAP7)
+	CFG(CFG_PROBE_REQ_IE_BIT_MAP7) \
+	CFG(CFG_PROBE_REQ_OUI)
 
 #endif

+ 0 - 8
fw_offload/dispatcher/inc/wlan_fwol_ucfg_api.h

@@ -109,14 +109,6 @@ ucfg_fwol_get_ie_whitelist(struct wlan_objmgr_psoc *psoc, bool *ie_whitelist);
 QDF_STATUS
 ucfg_fwol_set_ie_whitelist(struct wlan_objmgr_psoc *psoc, bool ie_whitelist);
 
-/**
- * ucfg_validate_ie_bitmaps() - Validate all IE whitelist bitmap param values
- * @psoc: Pointer to psoc object
- *
- * Return: True if all bitmap values are valid, else false
- */
-bool ucfg_validate_ie_bitmaps(struct wlan_objmgr_psoc *psoc);
-
 /**
  * ucfg_fwol_get_all_whitelist_params() - Get all IE whitelist param values
  * @psoc: Pointer to psoc object

+ 0 - 22
fw_offload/dispatcher/src/wlan_fwol_ucfg_api.c

@@ -290,28 +290,6 @@ QDF_STATUS ucfg_get_enable_phy_reg_retention(struct wlan_objmgr_psoc *psoc,
 	return QDF_STATUS_SUCCESS;
 }
 
-bool ucfg_validate_ie_bitmaps(struct wlan_objmgr_psoc *psoc)
-{
-	struct wlan_fwol_psoc_obj *fwol_obj;
-	struct wlan_fwol_ie_whitelist whitelist = {0};
-
-	fwol_obj = fwol_get_psoc_obj(psoc);
-	if (!fwol_obj) {
-		fwol_err("Failed to get fwol obj");
-		return false;
-	}
-
-	whitelist = fwol_obj->cfg.ie_whitelist_cfg;
-
-	if (whitelist.ie_bitmap_0 && whitelist.ie_bitmap_1 &&
-	    whitelist.ie_bitmap_2 && whitelist.ie_bitmap_3 &&
-	    whitelist.ie_bitmap_4 && whitelist.ie_bitmap_5 &&
-	    whitelist.ie_bitmap_6 && whitelist.ie_bitmap_7)
-		return true;
-
-	return false;
-}
-
 QDF_STATUS
 ucfg_fwol_get_all_whitelist_params(struct wlan_objmgr_psoc *psoc,
 				   struct wlan_fwol_ie_whitelist *whitelist)