wlan: AGE IE in scan results (GPS requirement)
GPS application needs accurate age info per scan entry
Change-Id: I4899343c63c386bdbd97265dcfc4e199b6a1f96f
CR-Fixed: 403216
diff --git a/CORE/HDD/inc/wlan_hdd_cfg80211.h b/CORE/HDD/inc/wlan_hdd_cfg80211.h
index 122f156..a56a5af 100644
--- a/CORE/HDD/inc/wlan_hdd_cfg80211.h
+++ b/CORE/HDD/inc/wlan_hdd_cfg80211.h
@@ -70,6 +70,26 @@
#define BASIC_RATE_MASK 0x80
#define RATE_MASK 0x7f
+#ifdef WLAN_ENABLE_AGEIE_ON_SCAN_RESULTS
+/* GPS application requirement */
+#define QCOM_VENDOR_IE_ID 221
+#define QCOM_OUI1 0x00
+#define QCOM_OUI2 0xA0
+#define QCOM_OUI3 0xC6
+#define QCOM_VENDOR_IE_AGE_TYPE 0x100
+#define QCOM_VENDOR_IE_AGE_LEN 4
+
+typedef struct {
+ u8 element_id;
+ u8 len;
+ u8 oui_1;
+ u8 oui_2;
+ u8 oui_3;
+ u32 type;
+ u32 age;
+}__attribute__((packed)) qcom_ie_age ;
+#endif
+
struct cfg80211_bss* wlan_hdd_cfg80211_update_bss_db( hdd_adapter_t *pAdapter,
tCsrRoamInfo *pRoamInfo
);
diff --git a/CORE/HDD/src/wlan_hdd_cfg80211.c b/CORE/HDD/src/wlan_hdd_cfg80211.c
index 77ba092..e921703 100644
--- a/CORE/HDD/src/wlan_hdd_cfg80211.c
+++ b/CORE/HDD/src/wlan_hdd_cfg80211.c
@@ -3292,7 +3292,12 @@
struct wireless_dev *wdev = dev->ieee80211_ptr;
struct wiphy *wiphy = wdev->wiphy;
int chan_no = bss_desc->channelId;
+#ifdef WLAN_ENABLE_AGEIE_ON_SCAN_RESULTS
+ qcom_ie_age *qie_age = NULL;
+ int ie_length = GET_IE_LEN_IN_BSS_DESC( bss_desc->length ) + sizeof(qcom_ie_age);
+#else
int ie_length = GET_IE_LEN_IN_BSS_DESC( bss_desc->length );
+#endif
const char *ie =
((ie_length != 0) ? (const char *)&bss_desc->ieFields: NULL);
unsigned int freq;
@@ -3328,6 +3333,21 @@
mgmt->u.probe_resp.beacon_int = bss_desc->beaconInterval;
mgmt->u.probe_resp.capab_info = bss_desc->capabilityInfo;
+
+#ifdef WLAN_ENABLE_AGEIE_ON_SCAN_RESULTS
+ /* GPS Requirement: need age ie per entry. Using vendor specific. */
+ /* Assuming this is the last IE, copy at the end */
+ ie_length -=sizeof(qcom_ie_age);
+ qie_age = (qcom_ie_age *)(mgmt->u.probe_resp.variable + ie_length);
+ qie_age->element_id = QCOM_VENDOR_IE_ID;
+ qie_age->len = QCOM_VENDOR_IE_AGE_LEN;
+ qie_age->oui_1 = QCOM_OUI1;
+ qie_age->oui_2 = QCOM_OUI2;
+ qie_age->oui_3 = QCOM_OUI3;
+ qie_age->type = QCOM_VENDOR_IE_AGE_TYPE;
+ qie_age->age = vos_timer_get_system_ticks() - bss_desc->nReceivedTime;
+#endif
+
memcpy(mgmt->u.probe_resp.variable, ie, ie_length);
mgmt->frame_control |=
diff --git a/Makefile b/Makefile
index 124c93a..32e3ddb 100644
--- a/Makefile
+++ b/Makefile
@@ -528,7 +528,8 @@
CDEFINES += -DWLAN_FEATURE_11AC
CDEFINES += -DWLAN_FEATURE_11AC_HIGH_TP
-CDEFINED += -DWLAN_FEATURE_P2P_DEBUG
+CDEFINES += -DWLAN_FEATURE_P2P_DEBUG
+CDEFINES += -DWLAN_ENABLE_AGEIE_ON_SCAN_RESULTS
CDEFINES += -DWLAN_OPEN_SOURCE