Explorar o código

Merge "qcacmn: Add APIs to get IE by EID and Ext ID"

Linux Build Service Account %!s(int64=7) %!d(string=hai) anos
pai
achega
e09994c0ed

+ 11 - 1
target_if/scan/src/target_if_scan.c

@@ -239,7 +239,17 @@ static QDF_STATUS
 target_if_pno_start(struct wlan_objmgr_psoc *psoc,
 	struct pno_scan_req_params *req)
 {
-	return wmi_unified_pno_start_cmd(GET_WMI_HDL_FROM_PSOC(psoc), req);
+	QDF_STATUS status;
+
+	status = wmi_unified_pno_start_cmd(GET_WMI_HDL_FROM_PSOC(psoc), req);
+	if (status == QDF_STATUS_SUCCESS) {
+		if (req->mawc_params.enable)
+			status = wmi_unified_nlo_mawc_cmd(
+					GET_WMI_HDL_FROM_PSOC(psoc),
+					&req->mawc_params);
+	}
+
+	return status;
 }
 
 static QDF_STATUS

+ 1 - 0
umac/cmn_services/inc/wlan_cmn.h

@@ -91,6 +91,7 @@
 #define WLAN_CHAN_170_FREQ      (5852)
 
 #define WLAN_MAC_EID_VENDOR     221
+#define WLAN_MAC_EID_EXT        255
 
 /**
  * enum wlan_umac_comp_id - UMAC component id

+ 34 - 2
umac/cmn_services/utils/inc/wlan_utility.h

@@ -62,6 +62,19 @@ bool wlan_is_dsrc_channel(uint16_t center_freq);
  */
 uint8_t wlan_freq_to_chan(uint32_t freq);
 
+/**
+ * wlan_get_ie_ptr_from_eid() - Find out ie from eid
+ * @eid: element id
+ * @ie: source ie address
+ * @ie_len: source ie length
+ *
+ * Return: vendor ie address - success
+ *         NULL - failure
+ */
+const uint8_t *wlan_get_ie_ptr_from_eid(uint8_t eid,
+					const uint8_t *ie,
+					int ie_len);
+
 /**
  * wlan_get_vendor_ie_ptr_from_oui() - Find out vendor ie
  * @oui: oui buffer
@@ -74,8 +87,27 @@ uint8_t wlan_freq_to_chan(uint32_t freq);
  * Return: vendor ie address - success
  *         NULL - failure
  */
-uint8_t *wlan_get_vendor_ie_ptr_from_oui(uint8_t *oui,
-	uint8_t oui_size, uint8_t *ie, uint16_t ie_len);
+const uint8_t *wlan_get_vendor_ie_ptr_from_oui(const uint8_t *oui,
+					       uint8_t oui_size,
+					       const uint8_t *ie,
+					       uint16_t ie_len);
+
+/**
+ * wlan_get_ext_ie_ptr_from_ext_id() - Find out ext ie
+ * @oui: oui buffer
+ * @oui_size: oui size
+ * @ie: source ie address
+ * @ie_len: source ie length
+ *
+ * This function find out ext ie from ext id (passed oui)
+ *
+ * Return: vendor ie address - success
+ *         NULL - failure
+ */
+const uint8_t *wlan_get_ext_ie_ptr_from_ext_id(const uint8_t *oui,
+					       uint8_t oui_size,
+					       const uint8_t *ie,
+					       uint16_t ie_len);
 
 /**
  * wlan_is_emulation_platform() - check if platform is emulation based

+ 46 - 5
umac/cmn_services/utils/src/wlan_utility.c

@@ -72,21 +72,37 @@ uint8_t wlan_freq_to_chan(uint32_t freq)
 	return chan;
 }
 
-uint8_t *wlan_get_vendor_ie_ptr_from_oui(uint8_t *oui,
-	uint8_t oui_size, uint8_t *ie, uint16_t ie_len)
+static const uint8_t *wlan_get_ie_ptr_from_eid_n_oui(uint8_t eid,
+						     const uint8_t *oui,
+						     uint8_t oui_size,
+						     const uint8_t *ie,
+						     uint16_t ie_len)
 {
 	int32_t left = ie_len;
-	uint8_t *ptr = ie;
+	const uint8_t *ptr = ie;
 	uint8_t elem_id, elem_len;
 
 	while (left >= 2) {
 		elem_id  = ptr[0];
 		elem_len = ptr[1];
 		left -= 2;
+
 		if (elem_len > left)
 			return NULL;
-		if (WLAN_MAC_EID_VENDOR == elem_id) {
-			if (memcmp(&ptr[2], oui, oui_size) == 0)
+
+		if (eid == elem_id) {
+			/* if oui is not provide eid match is enough */
+			if (!oui)
+				return ptr;
+
+			/*
+			 * if oui is provided and oui_size is more than left
+			 * bytes, then we cannot have match
+			 */
+			if (oui_size > left)
+				return NULL;
+
+			if (qdf_mem_cmp(&ptr[2], oui, oui_size) == 0)
 				return ptr;
 		}
 
@@ -97,6 +113,31 @@ uint8_t *wlan_get_vendor_ie_ptr_from_oui(uint8_t *oui,
 	return NULL;
 }
 
+const uint8_t *wlan_get_ie_ptr_from_eid(uint8_t eid,
+					const uint8_t *ie,
+					int ie_len)
+{
+	return wlan_get_ie_ptr_from_eid_n_oui(eid, NULL, 0, ie, ie_len);
+}
+
+const uint8_t *wlan_get_vendor_ie_ptr_from_oui(const uint8_t *oui,
+					       uint8_t oui_size,
+					       const uint8_t *ie,
+					       uint16_t ie_len)
+{
+	return wlan_get_ie_ptr_from_eid_n_oui(WLAN_MAC_EID_VENDOR,
+					      oui, oui_size, ie, ie_len);
+}
+
+const uint8_t *wlan_get_ext_ie_ptr_from_ext_id(const uint8_t *oui,
+					       uint8_t oui_size,
+					       const uint8_t *ie,
+					       uint16_t ie_len)
+{
+	return wlan_get_ie_ptr_from_eid_n_oui(WLAN_MAC_EID_EXT,
+					      oui, oui_size, ie, ie_len);
+}
+
 bool wlan_is_emulation_platform(uint32_t phy_version)
 {
 	if ((phy_version == 0xABC0) || (phy_version == 0xABC1) ||

+ 12 - 12
umac/p2p/core/src/wlan_p2p_off_chan_tx.c

@@ -121,7 +121,7 @@ static QDF_STATUS p2p_vdev_check_valid(struct tx_action_context *tx_ctx)
  *
  * Return: pointer to p2p ie
  */
-static uint8_t *p2p_get_p2pie_ptr(uint8_t *ie, uint16_t ie_len)
+static const uint8_t *p2p_get_p2pie_ptr(const uint8_t *ie, uint16_t ie_len)
 {
 	return wlan_get_vendor_ie_ptr_from_oui(P2P_OUI,
 			P2P_OUI_SIZE, ie, ie_len);
@@ -137,12 +137,12 @@ static uint8_t *p2p_get_p2pie_ptr(uint8_t *ie, uint16_t ie_len)
  *
  * Return: pointer to p2p ie
  */
-static uint8_t *p2p_get_p2pie_from_probe_rsp(
+static const uint8_t *p2p_get_p2pie_from_probe_rsp(
 	struct tx_action_context *tx_ctx)
 {
-	uint8_t *ie;
-	uint8_t *p2p_ie;
-	uint8_t *tmp_p2p_ie;
+	const uint8_t *ie;
+	const uint8_t *p2p_ie;
+	const uint8_t *tmp_p2p_ie;
 	uint16_t ie_len;
 
 	ie = tx_ctx->buf + PROBE_RSP_IE_OFFSET;
@@ -176,10 +176,10 @@ static uint8_t *p2p_get_p2pie_from_probe_rsp(
  *
  * Return: pointer to noa attr
  */
-static uint8_t *p2p_get_presence_noa_attr(uint8_t *pies, int length)
+static const uint8_t *p2p_get_presence_noa_attr(const uint8_t *pies, int length)
 {
 	int left = length;
-	uint8_t *ptr = pies;
+	const uint8_t *ptr = pies;
 	uint8_t elem_id;
 	uint16_t elem_len;
 
@@ -387,7 +387,7 @@ static uint8_t p2p_get_noa_attr_stream(
  * Return: noa stream length
  */
 static uint16_t p2p_update_noa_stream(struct tx_action_context *tx_ctx,
-	uint8_t *p2p_ie, uint8_t *noa_attr, uint32_t *total_len,
+	uint8_t *p2p_ie, const uint8_t *noa_attr, uint32_t *total_len,
 	uint8_t *noa_stream)
 {
 	uint16_t noa_len;
@@ -1231,24 +1231,24 @@ static QDF_STATUS p2p_execute_tx_action_frame(
 	uint8_t noa_len = 0;
 	uint8_t noa_stream[P2P_NOA_STREAM_ARR_SIZE];
 	uint8_t orig_len = 0;
-	uint8_t *ie;
+	const uint8_t *ie;
 	uint8_t ie_len;
 	uint8_t *p2p_ie = NULL;
-	uint8_t *presence_noa_attr = NULL;
+	const uint8_t *presence_noa_attr = NULL;
 	uint32_t nbytes_copy;
 	uint32_t buf_len = tx_ctx->buf_len;
 	struct p2p_frame_info *frame_info;
 
 	frame_info = &(tx_ctx->frame_info);
 	if (frame_info->sub_type == P2P_MGMT_PROBE_RSP) {
-		p2p_ie = p2p_get_p2pie_from_probe_rsp(tx_ctx);
+		p2p_ie = (uint8_t *)p2p_get_p2pie_from_probe_rsp(tx_ctx);
 	} else if (frame_info->action_type ==
 			P2P_ACTION_PRESENCE_RSP) {
 		ie = tx_ctx->buf +
 			P2P_PUBLIC_ACTION_FRAME_TYPE_OFFSET;
 		ie_len = tx_ctx->buf_len -
 			P2P_PUBLIC_ACTION_FRAME_TYPE_OFFSET;
-		p2p_ie = p2p_get_p2pie_ptr(ie, ie_len);
+		p2p_ie = (uint8_t *)p2p_get_p2pie_ptr(ie, ie_len);
 		if (p2p_ie) {
 			/* extract the presence of NoA attribute inside
 			 * P2P IE */

+ 2 - 0
umac/scan/core/src/wlan_scan_main.h

@@ -188,6 +188,7 @@ struct scan_vdev_obj {
  * to be triggered.
  * @pno_wake_lock: pno wake lock
  * @pno_cb: callback to call on PNO completion
+ * @mawc_params: Configuration parameters for NLO MAWC.
  */
 struct pno_def_config {
 	bool channel_prediction;
@@ -197,6 +198,7 @@ struct pno_def_config {
 	uint32_t channel_prediction_full_scan;
 	qdf_wake_lock_t pno_wake_lock;
 	struct cb_handler pno_cb;
+	struct nlo_mawc_params mawc_params;
 };
 
 

+ 26 - 17
umac/scan/dispatcher/inc/wlan_scan_public_structs.h

@@ -883,6 +883,11 @@ enum scan_cb_type {
 #define SCAN_STATIONARY_THRESHOLD 10
 #define SCAN_CHANNEL_PREDICTION_FULL_SCAN_MS 60000
 #define SCAN_ADAPTIVE_PNOSCAN_DWELL_MODE 0
+#define SCAN_MAWC_NLO_ENABLED 1
+#define SCAN_MAWC_NLO_EXP_BACKOFF_RATIO 3
+#define SCAN_MAWC_NLO_INIT_SCAN_INTERVAL 10000
+#define SCAN_MAWC_NLO_MAX_SCAN_INTERVAL 60000
+
 
 /**
  * enum ssid_bc_type - SSID broadcast type
@@ -927,6 +932,23 @@ struct cpno_band_rssi_pref {
 	int8_t rssi;
 };
 
+/**
+ * struct nlo_mawc_params - Motion Aided Wireless Connectivity based
+ *                          Network List Offload configuration
+ * @vdev_id: VDEV ID on which the configuration needs to be applied
+ * @enable: flag to enable or disable
+ * @exp_backoff_ratio: ratio of exponential backoff
+ * @init_scan_interval: initial scan interval(msec)
+ * @max_scan_interval:  max scan interval(msec)
+ */
+struct nlo_mawc_params {
+	uint8_t vdev_id;
+	bool enable;
+	uint32_t exp_backoff_ratio;
+	uint32_t init_scan_interval;
+	uint32_t max_scan_interval;
+};
+
 /**
  * struct pno_scan_req_params - PNO Scan request structure
  * @networks_cnt: Number of networks
@@ -957,6 +979,7 @@ struct cpno_band_rssi_pref {
  *	{ fast_scan_period=120, fast_scan_max_cycles=2,
  *	  slow_scan_period=1800, scan_backoff_multiplier=2 }
  *	Result: 120s x2, 240s x2, 480s x2, 960s x2, 1800s xN
+ * @mawc_params: Configuration parameters for NLO MAWC.
  */
 struct pno_scan_req_params {
 	uint32_t networks_cnt;
@@ -979,23 +1002,7 @@ struct pno_scan_req_params {
 	bool relative_rssi_set;
 	int8_t relative_rssi;
 	struct cpno_band_rssi_pref band_rssi_pref;
-};
-
-/**
- * struct nlo_mawc_params - Motion Aided Wireless Connectivity based
- *                          Network List Offload configuration
- * @vdev_id: VDEV ID on which the configuration needs to be applied
- * @enable: flag to enable or disable
- * @exp_backoff_ratio: ratio of exponential backoff
- * @init_scan_interval: initial scan interval(msec)
- * @max_scan_interval:  max scan interval(msec)
- */
-struct nlo_mawc_params {
-	uint8_t vdev_id;
-	bool enable;
-	uint32_t exp_backoff_ratio;
-	uint32_t init_scan_interval;
-	uint32_t max_scan_interval;
+	struct nlo_mawc_params mawc_params;
 };
 
 /**
@@ -1007,6 +1014,7 @@ struct nlo_mawc_params {
  * @pnoscan_adaptive_dwell_mode: def adaptive dwelltime mode for pno scan
  * @channel_prediction_full_scan: def periodic timer upon which full scan needs
  * to be triggered.
+ * @mawc_params: Configuration parameters for NLO MAWC.
  */
 struct pno_user_cfg {
 	bool channel_prediction;
@@ -1014,6 +1022,7 @@ struct pno_user_cfg {
 	uint8_t stationary_thresh;
 	enum scan_dwelltime_adaptive_mode adaptive_dwell_mode;
 	uint32_t channel_prediction_full_scan;
+	struct nlo_mawc_params mawc_params;
 };
 
 /**

+ 12 - 0
umac/scan/dispatcher/src/wlan_scan_ucfg_api.c

@@ -227,13 +227,20 @@ bool ucfg_scan_get_pno_match(struct wlan_objmgr_vdev *vdev)
 static QDF_STATUS
 wlan_pno_global_init(struct pno_def_config *pno_def)
 {
+	struct nlo_mawc_params *mawc_cfg;
+
 	qdf_wake_lock_create(&pno_def->pno_wake_lock, "wlan_pno_wl");
+	mawc_cfg = &pno_def->mawc_params;
 	pno_def->channel_prediction = SCAN_PNO_CHANNEL_PREDICTION;
 	pno_def->top_k_num_of_channels = SCAN_TOP_K_NUM_OF_CHANNELS;
 	pno_def->stationary_thresh = SCAN_STATIONARY_THRESHOLD;
 	pno_def->channel_prediction_full_scan =
 			SCAN_CHANNEL_PREDICTION_FULL_SCAN_MS;
 	pno_def->adaptive_dwell_mode = SCAN_ADAPTIVE_PNOSCAN_DWELL_MODE;
+	mawc_cfg->enable = SCAN_MAWC_NLO_ENABLED;
+	mawc_cfg->exp_backoff_ratio = SCAN_MAWC_NLO_EXP_BACKOFF_RATIO;
+	mawc_cfg->init_scan_interval = SCAN_MAWC_NLO_INIT_SCAN_INTERVAL;
+	mawc_cfg->max_scan_interval = SCAN_MAWC_NLO_MAX_SCAN_INTERVAL;
 
 	return QDF_STATUS_SUCCESS;
 }
@@ -273,6 +280,9 @@ ucfg_scan_get_pno_def_params(struct wlan_objmgr_vdev *vdev,
 	req->stationary_thresh = pno_def->stationary_thresh;
 	req->channel_prediction_full_scan =
 			pno_def->channel_prediction_full_scan;
+	req->mawc_params.vdev_id = wlan_vdev_get_id(vdev);
+	qdf_mem_copy(&req->mawc_params, &pno_def->mawc_params,
+			sizeof(req->mawc_params));
 
 	return QDF_STATUS_SUCCESS;
 }
@@ -286,6 +296,8 @@ static QDF_STATUS ucfg_scan_update_pno_config(struct pno_def_config *pno,
 	pno->adaptive_dwell_mode = pno_cfg->adaptive_dwell_mode;
 	pno->channel_prediction_full_scan =
 		pno_cfg->channel_prediction_full_scan;
+	qdf_mem_copy(&pno->mawc_params, &pno_cfg->mawc_params,
+			sizeof(pno->mawc_params));
 
 	return QDF_STATUS_SUCCESS;
 }