Răsfoiți Sursa

qcacmn: Store and retrieve TPE IE in scan cache

Declare a TPE pointer to store the TPE IE in the scan cache ie list.
Write a function to obtain the TPE IE stored in the scan cache ie list.

Declare a minimum TPE IE length as 2 Bytes and use that to check the
sanity of the received TPE IE before storing it. Discard the TPE IE if the
length check fails.

Change-Id: If5b06604b03d07dd5fb26a62f90fb7202ce4eff0
CRs-Fixed: 2826300
Vignesh U 4 ani în urmă
părinte
comite
1a80505918

+ 2 - 0
umac/cmn_services/cmn_defs/inc/wlan_cmn_ieee80211.h

@@ -142,6 +142,8 @@
 #define WLAN_REQUEST_IE_MAX_LEN                  255
 #define WLAN_RM_CAPABILITY_IE_MAX_LEN            5
 #define WLAN_RNR_IE_MIN_LEN                      5
+#define WLAN_TPE_IE_MIN_LEN                      2
+#define WLAN_MAX_NUM_TPE_IE                      2
 
 /* HT capability flags */
 #define WLAN_HTCAP_C_ADVCODING             0x0001

+ 2 - 0
umac/scan/dispatcher/inc/wlan_scan_public_structs.h

@@ -111,6 +111,7 @@ struct channel_info {
  * @vhtcap:     pointer to vhtcap ie
  * @vhtop:      pointer to vhtop ie
  * @opmode:     pointer to opmode ie
+ * @tpe:        array of pointers to transmit power envelope ie
  * @cswrp:      pointer to channel switch announcement wrapper ie
  * @widebw:     pointer to wide band channel switch sub ie
  * @txpwrenvlp: pointer to tx power envelop sub ie
@@ -158,6 +159,7 @@ struct ie_list {
 	uint8_t *vhtcap;
 	uint8_t *vhtop;
 	uint8_t *opmode;
+	uint8_t *tpe[WLAN_MAX_NUM_TPE_IE];
 	uint8_t *cswrp;
 	uint8_t *widebw;
 	uint8_t *txpwrenvlp;

+ 17 - 0
umac/scan/dispatcher/inc/wlan_scan_utils_api.h

@@ -656,6 +656,7 @@ util_scan_copy_beacon_data(struct scan_cache_entry *new_entry,
 {
 	u_int8_t *new_ptr, *old_ptr;
 	struct ie_list *ie_lst;
+	uint8_t i;
 
 	new_entry->raw_frame.ptr =
 		qdf_mem_malloc_atomic(scan_entry->raw_frame.len);
@@ -708,6 +709,8 @@ util_scan_copy_beacon_data(struct scan_cache_entry *new_entry,
 	ie_lst->vhtop = conv_ptr(ie_lst->vhtop, old_ptr, new_ptr);
 	ie_lst->opmode = conv_ptr(ie_lst->opmode, old_ptr, new_ptr);
 	ie_lst->cswrp = conv_ptr(ie_lst->cswrp, old_ptr, new_ptr);
+	for (i = 0; i < WLAN_MAX_NUM_TPE_IE; i++)
+		ie_lst->tpe[i] = conv_ptr(ie_lst->tpe[i], old_ptr, new_ptr);
 	ie_lst->widebw = conv_ptr(ie_lst->widebw, old_ptr, new_ptr);
 	ie_lst->txpwrenvlp = conv_ptr(ie_lst->txpwrenvlp, old_ptr, new_ptr);
 	ie_lst->bwnss_map = conv_ptr(ie_lst->bwnss_map, old_ptr, new_ptr);
@@ -1495,6 +1498,20 @@ util_scan_entry_heop(struct scan_cache_entry *scan_entry)
 	return scan_entry->ie_list.heop;
 }
 
+/**
+ * util_scan_entry_tpe() - function to read tpe ie
+ * @scan_entry: scan entry
+ *
+ * API, function to read tpe ie
+ *
+ * Return, tpe ie or NULL if ie is not present
+ */
+static inline uint8_t**
+util_scan_entry_tpe(struct scan_cache_entry *scan_entry)
+{
+	return scan_entry->ie_list.tpe;
+}
+
 /**
  * util_scan_entry_muedca() - function to read MU-EDCA IE
  * @scan_entry: scan entry

+ 8 - 0
umac/scan/dispatcher/src/wlan_scan_utils_api.c

@@ -901,6 +901,7 @@ util_scan_populate_bcn_ie_list(struct wlan_objmgr_pdev *pdev,
 	uint8_t chan_idx;
 	struct wlan_scan_obj *scan_obj;
 	struct wlan_objmgr_psoc *psoc;
+	uint8_t tpe_idx = 0;
 
 	psoc = wlan_pdev_get_psoc(pdev);
 	if (!psoc) {
@@ -1094,6 +1095,13 @@ util_scan_populate_bcn_ie_list(struct wlan_objmgr_pdev *pdev,
 			if (QDF_IS_STATUS_ERROR(status))
 				goto err_status;
 			break;
+		case WLAN_ELEMID_VHT_TX_PWR_ENVLP:
+			if (ie->ie_len < WLAN_TPE_IE_MIN_LEN)
+				goto err;
+			if (tpe_idx >= WLAN_MAX_NUM_TPE_IE)
+				goto err;
+			scan_params->ie_list.tpe[tpe_idx++] = (uint8_t *)ie;
+			break;
 		case WLAN_ELEMID_CHAN_SWITCH_WRAP:
 			scan_params->ie_list.cswrp = (uint8_t *)ie;
 			/* Go to next sub IE */