浏览代码

qcacld-3.0: Add changes to parse fils indication element

Add changes to parse fils indication element and add the info
to bss descriptor for further use.

Change-Id: If4b56435180a226438c9f0afdda0f58a26854d88
CRs-Fixed: 2028113
Sridhar Selvaraj 7 年之前
父节点
当前提交
a44c19ee19

+ 30 - 3
core/mac/inc/sir_api.h

@@ -117,6 +117,14 @@ typedef uint8_t tSirVersionString[SIR_VERSION_STRING_LEN];
 #define NUM_CHAINS_MAX  2
 
 #define MAX_RSSI_AVOID_BSSID_LIST    10
+
+/* Maximum number of realms present in fils indication element */
+#define SIR_MAX_REALM_COUNT 7
+/* Realm length */
+#define SIR_REALM_LEN 2
+/* Cache ID length */
+#define CACHE_ID_LEN 2
+
 /**
  * enum sir_conn_update_reason: Reason for conc connection update
  * @SIR_UPDATE_REASON_SET_OPER_CHAN: Set probable operating channel
@@ -709,6 +717,24 @@ typedef struct sSirSmeStartBssReq {
 
 #define WSCIE_PROBE_RSP_LEN (317 + 2)
 
+#ifdef WLAN_FEATURE_FILS_SK
+/* struct fils_ind_elements: elements parsed from fils indication present
+ * in beacon/probe resp
+ * @realm_cnt: number of realm present
+ * @realm: realms
+ * @is_fils_sk_supported: if FILS SK supported
+ * @is_cache_id_present: if cache id present
+ * @cache_id: cache id
+ */
+struct fils_ind_elements {
+	uint16_t realm_cnt;
+	uint8_t realm[SIR_MAX_REALM_COUNT][SIR_REALM_LEN];
+	bool is_fils_sk_supported;
+	bool is_cache_id_present;
+	uint8_t cache_id[CACHE_ID_LEN];
+};
+#endif
+
 typedef struct sSirBssDescription {
 	/* offset of the ieFields from bssId. */
 	uint16_t length;
@@ -740,8 +766,6 @@ typedef struct sSirBssDescription {
 	/* To achieve 8-byte alignment with ESE enabled */
 	uint32_t reservedPadding5;
 #endif
-	/* Please keep the structure 4 bytes aligned above the ieFields */
-
 	/* whether it is from a probe rsp */
 	uint8_t fProbeRsp;
 	/* Actual channel the beacon/probe response was received on */
@@ -751,7 +775,10 @@ typedef struct sSirBssDescription {
 	uint8_t WscIeProbeRsp[WSCIE_PROBE_RSP_LEN];
 	uint8_t reservedPadding4;
 	uint32_t tsf_delta;
-
+#ifdef WLAN_FEATURE_FILS_SK
+	struct fils_ind_elements fils_info_element;
+#endif
+	/* Please keep the structure 4 bytes aligned above the ieFields */
 	uint32_t ieFields[1];
 } tSirBssDescription, *tpSirBssDescription;
 

+ 98 - 0
core/mac/src/include/parser_api.h

@@ -109,6 +109,90 @@ typedef struct sSirQCNIE {
 	uint8_t sub_version;
 } tSirQCNIE, *tpSirQCNIE;
 
+#ifdef WLAN_FEATURE_FILS_SK
+#define SIR_MAX_IDENTIFIER_CNT 7
+#define SIR_CACHE_IDENTIFIER_LEN 2
+#define SIR_HESSID_LEN 6
+#define SIR_MAX_KEY_CNT 7
+#define SIR_MAX_KEY_LEN 48
+
+/*
+ * struct public_key_identifier: structure for public key identifier
+ * present in fils indication element
+ * @is_present: if Key info is present
+ * @key_cnt:  number of keys present
+ * @key_type: type of key used
+ * @length: length of key
+ * @key: key data
+ */
+struct public_key_identifier {
+	bool is_present;
+	uint8_t key_cnt;
+	uint8_t key_type;
+	uint8_t length;
+	uint8_t key[SIR_MAX_KEY_CNT][SIR_MAX_KEY_LEN];
+};
+
+/*
+ * struct fils_cache_identifier: structure for fils cache identifier
+ * present in fils indication element
+ * @is_present: if cache identifier is present
+ * @identifier: cache identifier
+ */
+struct fils_cache_identifier {
+	bool is_present;
+	uint8_t identifier[SIR_CACHE_IDENTIFIER_LEN];
+};
+
+/*
+ * struct fils_hessid: structure for fils hessid
+ * present in fils indication element
+ * @is_present: if hessid info is present
+ * @hessid: hessid data
+ */
+struct fils_hessid {
+	bool is_present;
+	uint8_t hessid[SIR_HESSID_LEN];
+};
+
+/*
+ * struct fils_realm_identifier: structure for fils_realm_identifier
+ * present in fils indication element
+ * @is_present: if realm info is present
+ * @realm_cnt: realm count
+ * @realm: realm data
+ */
+struct fils_realm_identifier {
+	bool is_present;
+	uint8_t realm_cnt;
+	uint8_t realm[SIR_MAX_REALM_COUNT][SIR_REALM_LEN];
+};
+
+/*
+ * struct sir_fils_indication: structure for fils indication element
+ * @is_present: if indication element is present
+ * @is_ip_config_supported: if IP config is supported
+ * @is_fils_sk_auth_supported: if fils sk suppprted
+ * @is_fils_sk_auth_pfs_supported: if fils sk with pfs supported
+ * @is_pk_auth_supported: if fils public key supported
+ * @cache_identifier: fils cache idenfier info
+ * @hessid: fils hessid info
+ * @realm_identifier: fils realm info
+ * @key_identifier: fils key identifier info
+ */
+struct sir_fils_indication {
+	bool is_present;
+	uint8_t is_ip_config_supported;
+	uint8_t is_fils_sk_auth_supported;
+	uint8_t is_fils_sk_auth_pfs_supported;
+	uint8_t is_pk_auth_supported;
+	struct fils_cache_identifier cache_identifier;
+	struct fils_hessid hessid;
+	struct fils_realm_identifier realm_identifier;
+	struct public_key_identifier key_identifier;
+};
+#endif
+
 /* Structure common to Beacons & Probe Responses */
 typedef struct sSirProbeRespBeacon {
 	tSirMacTimeStamp timeStamp;
@@ -203,6 +287,9 @@ typedef struct sSirProbeRespBeacon {
 #ifdef WLAN_FEATURE_11AX_BSS_COLOR
 	tDot11fIEbss_color_change vendor_he_bss_color_change;
 #endif
+#ifdef WLAN_FEATURE_FILS_SK
+	struct sir_fils_indication fils_ind;
+#endif
 } tSirProbeRespBeacon, *tpSirProbeRespBeacon;
 
 /* probe Request structure */
@@ -1024,6 +1111,17 @@ sir_validate_and_rectify_ies(tpAniSirGlobal mac_ctx,
 void sir_copy_caps_info(tpAniSirGlobal mac_ctx, tDot11fFfCapabilities caps,
 			tpSirProbeRespBeacon pProbeResp);
 
+#ifdef WLAN_FEATURE_FILS_SK
+/**
+ * update_fils_data: update fils params from beacon/probe response
+ * @fils_ind: pointer to sir_fils_indication
+ * @fils_indication: pointer to tDot11fIEfils_indication
+ *
+ * Return: None
+ */
+void update_fils_data(struct sir_fils_indication *fils_ind,
+				 tDot11fIEfils_indication * fils_indication);
+#endif
 #ifdef WLAN_FEATURE_11AX
 QDF_STATUS populate_dot11f_he_caps(tpAniSirGlobal , tpPESession ,
 				   tDot11fIEvendor_he_cap *);

+ 0 - 1
core/mac/src/pe/lim/lim_scan_result_utils.c

@@ -44,7 +44,6 @@
 #include "rrm_api.h"
 #include "cds_utils.h"
 
-
 /**
  * lim_collect_bss_description()
  *

+ 39 - 0
core/mac/src/sys/legacy/src/utils/src/parser_api.c

@@ -2268,6 +2268,45 @@ void sir_copy_caps_info(tpAniSirGlobal mac_ctx, tDot11fFfCapabilities caps,
 	pProbeResp->capabilityInfo.immediateBA = caps.immediateBA;
 }
 
+#ifdef WLAN_FEATURE_FILS_SK
+void update_fils_data(struct sir_fils_indication *fils_ind,
+				 tDot11fIEfils_indication *fils_indication)
+{
+	uint8_t *data;
+
+	data = fils_indication->variable_data;
+	fils_ind->is_present = true;
+	fils_ind->is_ip_config_supported =
+			fils_indication->is_ip_config_supported;
+	fils_ind->is_fils_sk_auth_supported =
+			fils_indication->is_fils_sk_auth_supported;
+	fils_ind->is_fils_sk_auth_pfs_supported =
+			fils_indication->is_fils_sk_auth_pfs_supported;
+	fils_ind->is_pk_auth_supported =
+			fils_indication->is_pk_auth_supported;
+	if (fils_indication->is_cache_id_present) {
+		fils_ind->cache_identifier.is_present = true;
+		qdf_mem_copy(fils_ind->cache_identifier.identifier,
+				data, SIR_CACHE_IDENTIFIER_LEN);
+		data = data + SIR_CACHE_IDENTIFIER_LEN;
+	}
+	if (fils_indication->is_hessid_present) {
+		fils_ind->hessid.is_present = true;
+		qdf_mem_copy(fils_ind->hessid.hessid,
+				data, SIR_HESSID_LEN);
+		data = data + SIR_HESSID_LEN;
+	}
+	if (fils_indication->realm_identifiers_cnt) {
+		fils_ind->realm_identifier.is_present = true;
+		fils_ind->realm_identifier.realm_cnt =
+			fils_indication->realm_identifiers_cnt;
+		qdf_mem_copy(fils_ind->realm_identifier.realm,
+			data, fils_ind->realm_identifier.realm_cnt *
+					SIR_REALM_LEN);
+	}
+}
+#endif
+
 tSirRetStatus sir_convert_probe_frame2_struct(tpAniSirGlobal pMac,
 					      uint8_t *pFrame,
 					      uint32_t nFrame,

+ 47 - 1
core/sme/src/csr/csr_api_scan.c

@@ -5556,6 +5556,52 @@ static QDF_STATUS csr_prepare_scan_filter(tpAniSirGlobal mac_ctx,
 	return QDF_STATUS_SUCCESS;
 }
 
+#ifdef WLAN_FEATURE_FILS_SK
+/**
+ * csr_update_bss_with_fils_data: Fill FILS params in bss desc from scan entry
+ * @mac_ctx: mac context
+ * @scan_entry: scan entry
+ * @bss_descr: bss description
+ */
+static void csr_update_bss_with_fils_data(tpAniSirGlobal mac_ctx,
+					  struct scan_cache_entry *scan_entry,
+					  tSirBssDescription *bss_descr)
+{
+	tDot11fIEfils_indication fils_indication;
+	struct sir_fils_indication fils_ind;
+
+	if (!scan_entry->ie_list.fils_indication)
+		return;
+
+	dot11f_unpack_ie_fils_indication(mac_ctx,
+				scan_entry->ie_list.fils_indication,
+				*(scan_entry->ie_list.fils_indication + 1),
+				&fils_indication, false);
+
+	update_fils_data(&fils_ind, &fils_indication);
+	if (fils_ind.realm_identifier.realm_cnt > SIR_MAX_REALM_COUNT)
+		fils_ind.realm_identifier.realm_cnt = SIR_MAX_REALM_COUNT;
+
+	bss_descr->fils_info_element.realm_cnt =
+		fils_ind.realm_identifier.realm_cnt;
+	qdf_mem_copy(bss_descr->fils_info_element.realm,
+			fils_ind.realm_identifier.realm,
+			bss_descr->fils_info_element.realm_cnt * SIR_REALM_LEN);
+	if (fils_ind.cache_identifier.is_present) {
+		bss_descr->fils_info_element.is_cache_id_present = true;
+		qdf_mem_copy(bss_descr->fils_info_element.cache_id,
+			fils_ind.cache_identifier.identifier, CACHE_ID_LEN);
+	}
+	if (fils_ind.is_fils_sk_auth_supported)
+		bss_descr->fils_info_element.is_fils_sk_supported = true;
+}
+#else
+static void csr_update_bss_with_fils_data(tpAniSirGlobal mac_ctx,
+					  struct scan_cache_entry *scan_entry,
+					  tSirBssDescription *bss_descr)
+{ }
+#endif
+
 static QDF_STATUS csr_fill_bss_from_scan_entry(tpAniSirGlobal mac_ctx,
 	struct scan_cache_entry *scan_entry,
 	tCsrScanResult **p_result)
@@ -5675,7 +5721,7 @@ static QDF_STATUS csr_fill_bss_from_scan_entry(tpAniSirGlobal mac_ctx,
 			bcn_ies->QBSSLoad.avail;
 	}
 #endif
-
+	csr_update_bss_with_fils_data(mac_ctx, scan_entry, bss_desc);
 	if (scan_entry->alt_wcn_ie.ptr) {
 		bss_desc->WscIeLen = scan_entry->alt_wcn_ie.len;
 		qdf_mem_copy(bss_desc->WscIeProbeRsp,