From d8c3f1045498976b68b66204be750d2bf96d907e Mon Sep 17 00:00:00 2001 From: Abhishek Singh Date: Sat, 29 Jul 2017 14:10:37 +0530 Subject: [PATCH] qcacld-3.0: Add support for ESP IE The Estimated Service Parameters element is used by a AP to provide information to another STA which can then use the information as input to an algorithm to generate an estimate of throughput between the two STAs. The ESP Information List field contains from 1 to 4 ESP Information fields(each field 24 bits), each corresponding to an access category for which estimated service parameters information is provided. Change-Id: I4d299ffbf0700574c0b207893dbbfc4fd3911849 CRs-Fixed: 2079816 --- core/mac/src/cfg/cfgUtil/dot11f.frms | 8 + core/mac/src/include/dot11f.h | 46 +++++- .../mac/src/sys/legacy/src/utils/src/dot11f.c | 139 +++++++++++++++--- 3 files changed, 172 insertions(+), 21 deletions(-) diff --git a/core/mac/src/cfg/cfgUtil/dot11f.frms b/core/mac/src/cfg/cfgUtil/dot11f.frms index 6923da062e61..3d9641409107 100644 --- a/core/mac/src/cfg/cfgUtil/dot11f.frms +++ b/core/mac/src/cfg/cfgUtil/dot11f.frms @@ -2581,6 +2581,10 @@ IE QCN_IE (EID_VENDOR_SPECIFIC) OUI ( 0x8C, 0xFD, 0xF0, 0x01 ) version[4]; } +IE esp_information (EID_EXTN_ID_ELEMENT) OUI ( 0x0B ) +{ + data[0..96]; +} IE fils_indication (EID_FILS_INDICATION) { // FILS Information element @@ -3378,6 +3382,7 @@ FRAME Beacon // C.f. Sec. 7.2.3.1 OPTIE vendor_he_op; OPTIE bss_color_change; OPTIE mu_edca_param_set; + OPTIE esp_information; } // End frame Beacon. // Ok, here's the story on Beacon1 & Beacon2. We presumably beacon a lot @@ -3472,6 +3477,7 @@ FRAME Beacon2 OPTIE vendor_he_op; OPTIE bss_color_change; OPTIE mu_edca_param_set; + OPTIE esp_information; } // This frame is just Beacon with its Fixed Fields stripped out. It's handy @@ -3543,6 +3549,7 @@ FRAME BeaconIEs OPTIE vendor_he_op; OPTIE bss_color_change; OPTIE mu_edca_param_set; + OPTIE esp_information; } // End frame BeaconIEs. FRAME Disassociation // 7.3.3.3 @@ -3795,6 +3802,7 @@ FRAME ProbeResponse // 7.2.3.9 OPTIE vendor_he_op; OPTIE bss_color_change; OPTIE mu_edca_param_set; + OPTIE esp_information; } // End frame ProbeResponse. FRAME Authentication // 7.2.3.10 diff --git a/core/mac/src/include/dot11f.h b/core/mac/src/include/dot11f.h index 8ee738c46d3a..49b5e9263692 100644 --- a/core/mac/src/include/dot11f.h +++ b/core/mac/src/include/dot11f.h @@ -35,7 +35,7 @@ * * * This file was automatically generated by 'framesc' - * Fri Jul 14 12:29:59 2017 from the following file(s): + * Sat Jul 29 13:54:52 2017 from the following file(s): * * dot11f.frms * @@ -8222,6 +8222,46 @@ uint32_t dot11f_get_packed_ie_bss_color_change( }; /* End extern "C". */ #endif /* C++ */ +/* EID 255 (0xff) Extended EID 11 (0x0b) */ +typedef struct sDot11fIEesp_information { + uint8_t present; + uint8_t num_data; + uint8_t data[96]; +} tDot11fIEesp_information; + +#define DOT11F_EID_ESP_INFORMATION (255) + +/* N.B. These #defines do *not* include the EID & length */ +#define DOT11F_IE_ESP_INFORMATION_MIN_LEN (0) + +#define DOT11F_IE_ESP_INFORMATION_MAX_LEN (96) + +#ifdef __cplusplus +extern "C" { +#endif /* C++ */ +uint32_t dot11f_unpack_ie_esp_information( + tpAniSirGlobal, + uint8_t *, + uint8_t, + tDot11fIEesp_information*, + bool); + +uint32_t dot11f_pack_ie_esp_information( + tpAniSirGlobal, + tDot11fIEesp_information *, + uint8_t *, + uint32_t, + uint32_t*); + +uint32_t dot11f_get_packed_ie_esp_information( + tpAniSirGlobal, + tDot11fIEesp_information *, + uint32_t*); + +#ifdef __cplusplus +}; /* End extern "C". */ +#endif /* C++ */ + /* EID 60 (0x3c) */ typedef struct sDot11fIEext_chan_switch_ann { uint8_t present; @@ -9414,6 +9454,7 @@ typedef struct sDot11fBeacon{ tDot11fIEvendor_he_op vendor_he_op; tDot11fIEbss_color_change bss_color_change; tDot11fIEmu_edca_param_set mu_edca_param_set; + tDot11fIEesp_information esp_information; } tDot11fBeacon; #define DOT11F_BEACON (6) @@ -9514,6 +9555,7 @@ typedef struct sDot11fBeacon2{ tDot11fIEvendor_he_op vendor_he_op; tDot11fIEbss_color_change bss_color_change; tDot11fIEmu_edca_param_set mu_edca_param_set; + tDot11fIEesp_information esp_information; } tDot11fBeacon2; #define DOT11F_BEACON2 (8) @@ -9596,6 +9638,7 @@ typedef struct sDot11fBeaconIEs{ tDot11fIEvendor_he_op vendor_he_op; tDot11fIEbss_color_change bss_color_change; tDot11fIEmu_edca_param_set mu_edca_param_set; + tDot11fIEesp_information esp_information; } tDot11fBeaconIEs; #define DOT11F_BEACONIES (9) @@ -10016,6 +10059,7 @@ typedef struct sDot11fProbeResponse{ tDot11fIEvendor_he_op vendor_he_op; tDot11fIEbss_color_change bss_color_change; tDot11fIEmu_edca_param_set mu_edca_param_set; + tDot11fIEesp_information esp_information; } tDot11fProbeResponse; #define DOT11F_PROBERESPONSE (22) diff --git a/core/mac/src/sys/legacy/src/utils/src/dot11f.c b/core/mac/src/sys/legacy/src/utils/src/dot11f.c index 5acb9367c99f..0063b17bdba7 100644 --- a/core/mac/src/sys/legacy/src/utils/src/dot11f.c +++ b/core/mac/src/sys/legacy/src/utils/src/dot11f.c @@ -33,7 +33,7 @@ * * * This file was automatically generated by 'framesc' - * Wed Jul 26 14:38:34 2017 from the following file(s): + * Sat Jul 29 13:54:52 2017 from the following file(s): * * dot11f.frms * @@ -6269,6 +6269,31 @@ uint32_t dot11f_unpack_ie_bss_color_change(tpAniSirGlobal pCtx, #define SigIebss_color_change (0x007e) +uint32_t dot11f_unpack_ie_esp_information(tpAniSirGlobal pCtx, + uint8_t *pBuf, + uint8_t ielen, + tDot11fIEesp_information *pDst, + bool append_ie) +{ + uint32_t status = DOT11F_PARSE_SUCCESS; + (void) pBuf; (void)ielen; /* Shutup the compiler */ + if (pDst->present) + status = DOT11F_DUPLICATE_IE; + pDst->present = 1; + pDst->num_data = (uint8_t)(ielen); + if (ielen > 96) { + pDst->present = 0; + return DOT11F_SKIPPED_BAD_IE; + } + + DOT11F_MEMCPY(pCtx, pDst->data, pBuf, (ielen)); + (void)pCtx; + return status; +} /* End dot11f_unpack_ie_esp_information. */ + +#define SigIeesp_information (0x007f) + + uint32_t dot11f_unpack_ie_ext_chan_switch_ann(tpAniSirGlobal pCtx, uint8_t *pBuf, uint8_t ielen, @@ -6294,7 +6319,7 @@ uint32_t dot11f_unpack_ie_ext_chan_switch_ann(tpAniSirGlobal pCtx, return status; } /* End dot11f_unpack_ie_ext_chan_switch_ann. */ -#define SigIeext_chan_switch_ann (0x007f) +#define SigIeext_chan_switch_ann (0x0080) uint32_t dot11f_unpack_ie_fils_assoc_delay_info(tpAniSirGlobal pCtx, @@ -6313,7 +6338,7 @@ uint32_t dot11f_unpack_ie_fils_assoc_delay_info(tpAniSirGlobal pCtx, return status; } /* End dot11f_unpack_ie_fils_assoc_delay_info. */ -#define SigIefils_assoc_delay_info (0x0080) +#define SigIefils_assoc_delay_info (0x0081) uint32_t dot11f_unpack_ie_fils_hlp_container(tpAniSirGlobal pCtx, @@ -6339,7 +6364,7 @@ uint32_t dot11f_unpack_ie_fils_hlp_container(tpAniSirGlobal pCtx, return status; } /* End dot11f_unpack_ie_fils_hlp_container. */ -#define SigIefils_hlp_container (0x0081) +#define SigIefils_hlp_container (0x0082) uint32_t dot11f_unpack_ie_fils_indication(tpAniSirGlobal pCtx, @@ -6372,7 +6397,7 @@ uint32_t dot11f_unpack_ie_fils_indication(tpAniSirGlobal pCtx, return status; } /* End dot11f_unpack_ie_fils_indication. */ -#define SigIefils_indication (0x0082) +#define SigIefils_indication (0x0083) uint32_t dot11f_unpack_ie_fils_kde(tpAniSirGlobal pCtx, @@ -6395,7 +6420,7 @@ uint32_t dot11f_unpack_ie_fils_kde(tpAniSirGlobal pCtx, return status; } /* End dot11f_unpack_ie_fils_kde. */ -#define SigIefils_kde (0x0083) +#define SigIefils_kde (0x0084) uint32_t dot11f_unpack_ie_fils_key_confirmation(tpAniSirGlobal pCtx, @@ -6415,7 +6440,7 @@ uint32_t dot11f_unpack_ie_fils_key_confirmation(tpAniSirGlobal pCtx, return status; } /* End dot11f_unpack_ie_fils_key_confirmation. */ -#define SigIefils_key_confirmation (0x0084) +#define SigIefils_key_confirmation (0x0085) uint32_t dot11f_unpack_ie_fils_nonce(tpAniSirGlobal pCtx, @@ -6434,7 +6459,7 @@ uint32_t dot11f_unpack_ie_fils_nonce(tpAniSirGlobal pCtx, return status; } /* End dot11f_unpack_ie_fils_nonce. */ -#define SigIefils_nonce (0x0085) +#define SigIefils_nonce (0x0086) uint32_t dot11f_unpack_ie_fils_public_key(tpAniSirGlobal pCtx, @@ -6457,7 +6482,7 @@ uint32_t dot11f_unpack_ie_fils_public_key(tpAniSirGlobal pCtx, return status; } /* End dot11f_unpack_ie_fils_public_key. */ -#define SigIefils_public_key (0x0086) +#define SigIefils_public_key (0x0087) uint32_t dot11f_unpack_ie_fils_session(tpAniSirGlobal pCtx, @@ -6476,7 +6501,7 @@ uint32_t dot11f_unpack_ie_fils_session(tpAniSirGlobal pCtx, return status; } /* End dot11f_unpack_ie_fils_session. */ -#define SigIefils_session (0x0087) +#define SigIefils_session (0x0088) uint32_t dot11f_unpack_ie_fils_wrapped_data(tpAniSirGlobal pCtx, @@ -6496,7 +6521,7 @@ uint32_t dot11f_unpack_ie_fils_wrapped_data(tpAniSirGlobal pCtx, return status; } /* End dot11f_unpack_ie_fils_wrapped_data. */ -#define SigIefils_wrapped_data (0x0088) +#define SigIefils_wrapped_data (0x0089) uint32_t dot11f_unpack_ie_hs20vendor_ie(tpAniSirGlobal pCtx, @@ -6538,7 +6563,7 @@ uint32_t dot11f_unpack_ie_hs20vendor_ie(tpAniSirGlobal pCtx, return status; } /* End dot11f_unpack_ie_hs20vendor_ie. */ -#define SigIehs20vendor_ie (0x0089) +#define SigIehs20vendor_ie (0x008a) uint32_t dot11f_unpack_ie_ht2040_bss_coexistence(tpAniSirGlobal pCtx, @@ -6564,7 +6589,7 @@ uint32_t dot11f_unpack_ie_ht2040_bss_coexistence(tpAniSirGlobal pCtx, return status; } /* End dot11f_unpack_ie_ht2040_bss_coexistence. */ -#define SigIeht2040_bss_coexistence (0x008a) +#define SigIeht2040_bss_coexistence (0x008b) uint32_t dot11f_unpack_ie_ht2040_bss_intolerant_report(tpAniSirGlobal pCtx, @@ -6592,7 +6617,7 @@ uint32_t dot11f_unpack_ie_ht2040_bss_intolerant_report(tpAniSirGlobal pCtx, return status; } /* End dot11f_unpack_ie_ht2040_bss_intolerant_report. */ -#define SigIeht2040_bss_intolerant_report (0x008b) +#define SigIeht2040_bss_intolerant_report (0x008c) uint32_t dot11f_unpack_ie_mu_edca_param_set(tpAniSirGlobal pCtx, @@ -6679,7 +6704,7 @@ uint32_t dot11f_unpack_ie_mu_edca_param_set(tpAniSirGlobal pCtx, return status; } /* End dot11f_unpack_ie_mu_edca_param_set. */ -#define SigIemu_edca_param_set (0x008c) +#define SigIemu_edca_param_set (0x008d) uint32_t dot11f_unpack_ie_osen_ie(tpAniSirGlobal pCtx, @@ -6699,7 +6724,7 @@ uint32_t dot11f_unpack_ie_osen_ie(tpAniSirGlobal pCtx, return status; } /* End dot11f_unpack_ie_osen_ie. */ -#define SigIeosen_ie (0x008d) +#define SigIeosen_ie (0x008e) uint32_t dot11f_unpack_ie_sec_chan_offset_ele(tpAniSirGlobal pCtx, @@ -6718,7 +6743,7 @@ uint32_t dot11f_unpack_ie_sec_chan_offset_ele(tpAniSirGlobal pCtx, return status; } /* End dot11f_unpack_ie_sec_chan_offset_ele. */ -#define SigIesec_chan_offset_ele (0x008e) +#define SigIesec_chan_offset_ele (0x008f) static const tFFDefn FFS_vendor_he_cap[] = { @@ -6849,7 +6874,7 @@ uint32_t dot11f_unpack_ie_vendor_he_cap(tpAniSirGlobal pCtx, return status; } /* End dot11f_unpack_ie_vendor_he_cap. */ -#define SigIevendor_he_cap (0x008f) +#define SigIevendor_he_cap (0x0090) static const tFFDefn FFS_vendor_he_op[] = { @@ -6902,7 +6927,7 @@ uint32_t dot11f_unpack_ie_vendor_he_op(tpAniSirGlobal pCtx, return status; } /* End dot11f_unpack_ie_vendor_he_op. */ -#define SigIevendor_he_op (0x0090) +#define SigIevendor_he_op (0x0091) static const tFFDefn FFS_vendor_vht_ie[] = { @@ -6949,7 +6974,7 @@ uint32_t dot11f_unpack_ie_vendor_vht_ie(tpAniSirGlobal pCtx, return status; } /* End dot11f_unpack_ie_vendor_vht_ie. */ -#define SigIevendor_vht_ie (0x0091) +#define SigIevendor_vht_ie (0x0092) static const tFFDefn FFS_AddTSRequest[] = { @@ -7664,6 +7689,10 @@ static const tIEDefn IES_Beacon[] = { offsetof(tDot11fIEmu_edca_param_set, present), 0, "mu_edca_param_set", 0, 19, 19, SigIemu_edca_param_set, {0, 19, 116, 4, 0}, 4, DOT11F_EID_MU_EDCA_PARAM_SET, 0, 0, }, + { offsetof(tDot11fBeacon, esp_information), + offsetof(tDot11fIEesp_information, present), 0, "esp_information", + 0, 2, 98, SigIeesp_information, {0, 0, 0, 0, 0}, + 0, DOT11F_EID_ESP_INFORMATION, 11, 0, }, {0, 0, 0, NULL, 0, 0, 0, 0, {0, 0, 0, 0, 0}, 0, 0xff, 0, },}; uint32_t dot11f_unpack_beacon(tpAniSirGlobal pCtx, @@ -7887,6 +7916,10 @@ static const tIEDefn IES_Beacon2[] = { offsetof(tDot11fIEmu_edca_param_set, present), 0, "mu_edca_param_set", 0, 19, 19, SigIemu_edca_param_set, {0, 19, 116, 4, 0}, 4, DOT11F_EID_MU_EDCA_PARAM_SET, 0, 0, }, + { offsetof(tDot11fBeacon2, esp_information), + offsetof(tDot11fIEesp_information, present), 0, "esp_information", + 0, 2, 98, SigIeesp_information, {0, 0, 0, 0, 0}, + 0, DOT11F_EID_ESP_INFORMATION, 11, 0, }, {0, 0, 0, NULL, 0, 0, 0, 0, {0, 0, 0, 0, 0}, 0, 0xff, 0, },}; uint32_t dot11f_unpack_beacon2(tpAniSirGlobal pCtx, @@ -8111,6 +8144,10 @@ static const tIEDefn IES_BeaconIEs[] = { offsetof(tDot11fIEmu_edca_param_set, present), 0, "mu_edca_param_set", 0, 19, 19, SigIemu_edca_param_set, {0, 19, 116, 4, 0}, 4, DOT11F_EID_MU_EDCA_PARAM_SET, 0, 0, }, + { offsetof(tDot11fBeaconIEs, esp_information), + offsetof(tDot11fIEesp_information, present), 0, "esp_information", + 0, 2, 98, SigIeesp_information, {0, 0, 0, 0, 0}, + 0, DOT11F_EID_ESP_INFORMATION, 11, 0, }, {0, 0, 0, NULL, 0, 0, 0, 0, {0, 0, 0, 0, 0}, 0, 0xff, 0, },}; uint32_t dot11f_unpack_beacon_i_es(tpAniSirGlobal pCtx, @@ -8755,6 +8792,10 @@ static const tIEDefn IES_ProbeResponse[] = { offsetof(tDot11fIEmu_edca_param_set, present), 0, "mu_edca_param_set", 0, 19, 19, SigIemu_edca_param_set, {0, 19, 116, 4, 0}, 4, DOT11F_EID_MU_EDCA_PARAM_SET, 0, 0, }, + { offsetof(tDot11fProbeResponse, esp_information), + offsetof(tDot11fIEesp_information, present), 0, "esp_information", + 0, 2, 98, SigIeesp_information, {0, 0, 0, 0, 0}, + 0, DOT11F_EID_ESP_INFORMATION, 11, 0, }, {0, 0, 0, NULL, 0, 0, 0, 0, {0, 0, 0, 0, 0}, 0, 0xff, 0, },}; uint32_t dot11f_unpack_probe_response(tpAniSirGlobal pCtx, @@ -11755,6 +11796,16 @@ static uint32_t unpack_core(tpAniSirGlobal pCtx, countOffset), append_ie); break; + case SigIeesp_information: + status |= + dot11f_unpack_ie_esp_information( + pCtx, pBufRemaining, len, + (tDot11fIEesp_information *) + (pFrm + pIe->offset + + sizeof(tDot11fIEesp_information) * + countOffset), + append_ie); + break; case SigIeext_chan_switch_ann: status |= dot11f_unpack_ie_ext_chan_switch_ann( @@ -14783,6 +14834,15 @@ static uint32_t get_packed_size_core(tpAniSirGlobal pCtx, (pFrm + pIe->offset + offset * i))-> present; break; + case SigIeesp_information: + offset = sizeof(tDot11fIEesp_information); + byteCount = ((tDot11fIEesp_information *) + (pFrm + pIe->offset + offset * i))-> + num_data; + pIePresent = ((tDot11fIEesp_information *) + (pFrm + pIe->offset + offset * i))-> + present; + break; case SigIeext_chan_switch_ann: offset = sizeof(tDot11fIEext_chan_switch_ann); byteCount = 4; @@ -22820,6 +22880,37 @@ uint32_t dot11f_pack_ie_bss_color_change(tpAniSirGlobal pCtx, return DOT11F_PARSE_SUCCESS; } /* End dot11f_pack_ie_bss_color_change. */ +uint32_t dot11f_pack_ie_esp_information(tpAniSirGlobal pCtx, + tDot11fIEesp_information *pSrc, + uint8_t *pBuf, + uint32_t nBuf, + uint32_t *pnConsumed) +{ + uint8_t *pIeLen = 0; + uint32_t nConsumedOnEntry = *pnConsumed; + uint32_t nNeeded = 0U; + nNeeded += pSrc->num_data; + while (pSrc->present) { + if (nNeeded > nBuf) + return DOT11F_BUFFER_OVERFLOW; + *pBuf = 255; + ++pBuf; ++(*pnConsumed); + pIeLen = pBuf; + ++pBuf; ++(*pnConsumed); + *pBuf = 11; + ++pBuf; ++(*pnConsumed); + DOT11F_MEMCPY(pCtx, pBuf, &(pSrc->data), pSrc->num_data); + *pnConsumed += pSrc->num_data; + /* fieldsEndFlag = 1 */ + break; + } + (void)pCtx; + if (pIeLen) { + *pIeLen = *pnConsumed - nConsumedOnEntry - 2; + } + return DOT11F_PARSE_SUCCESS; +} /* End dot11f_pack_ie_esp_information. */ + uint32_t dot11f_pack_ie_ext_chan_switch_ann(tpAniSirGlobal pCtx, tDot11fIEext_chan_switch_ann *pSrc, uint8_t *pBuf, @@ -25764,6 +25855,14 @@ static uint32_t pack_core(tpAniSirGlobal pCtx, sizeof(tDot11fIEbss_color_change) * i), pBufRemaining, nBufRemaining, &len); break; + case SigIeesp_information: + status |= + dot11f_pack_ie_esp_information( + pCtx, (tDot11fIEesp_information *) + (pSrc + pIe->offset + + sizeof(tDot11fIEesp_information) * i), + pBufRemaining, nBufRemaining, &len); + break; case SigIeext_chan_switch_ann: status |= dot11f_pack_ie_ext_chan_switch_ann(