Ver código fonte

qcacld-3.0: BPF fixes for check connection state, set maxwow filter

qcacld-2.0 to qcacld-3.0 propagation

* Set BPF filter only if the station/p2p client is in the connected
  state.
* Depending on the BPF service enabled in firmware dynamically
  configure the number of wow filters.
    - If bpf enabled maxwowfilter is 2.
    - If bpf is disabled maxwowfilter is read from ini.

Change-Id: I14c722c9a1189f4ba4fbc2c8a554ae85b7a61fa8
CRs-Fixed: 967535
Arun Khandavalli 8 anos atrás
pai
commit
3dd06deb03

+ 13 - 4
core/hdd/src/wlan_hdd_cfg80211.c

@@ -6073,13 +6073,13 @@ static int hdd_get_bpf_offload(hdd_context_t *hdd_ctx)
  * hdd_set_reset_bpf_offload - Post set/reset bpf to SME
  * @hdd_ctx: Hdd context
  * @tb: Length of @data
- * @session_id: Session identifier
+ * @adapter: pointer to adapter struct
  *
  * Return: 0 on success; errno on failure
  */
 static int hdd_set_reset_bpf_offload(hdd_context_t *hdd_ctx,
 				     struct nlattr **tb,
-				     uint8_t session_id)
+				     hdd_adapter_t *adapter)
 {
 	struct sir_bpf_set_offload *bpf_set_offload;
 	QDF_STATUS status;
@@ -6088,6 +6088,15 @@ static int hdd_set_reset_bpf_offload(hdd_context_t *hdd_ctx,
 
 	ENTER();
 
+	if (adapter->device_mode == QDF_STA_MODE ||
+	    adapter->device_mode == QDF_P2P_CLIENT_MODE) {
+		if (!hdd_conn_is_connected(
+		    WLAN_HDD_GET_STATION_CTX_PTR(adapter))) {
+			hdd_err("Not in Connected state!");
+			return -ENOTSUPP;
+		}
+	}
+
 	bpf_set_offload = qdf_mem_malloc(sizeof(*bpf_set_offload));
 	if (bpf_set_offload == NULL) {
 		hdd_err("qdf_mem_malloc failed for bpf_set_offload");
@@ -6126,7 +6135,7 @@ static int hdd_set_reset_bpf_offload(hdd_context_t *hdd_ctx,
 
 	bpf_set_offload->current_length = prog_len;
 	nla_memcpy(bpf_set_offload->program, tb[BPF_PROGRAM], prog_len);
-	bpf_set_offload->session_id = session_id;
+	bpf_set_offload->session_id = adapter->sessionId;
 
 	/* Parse and fetch filter Id */
 	if (!tb[BPF_FILTER_ID]) {
@@ -6221,7 +6230,7 @@ __wlan_hdd_cfg80211_bpf_offload(struct wiphy *wiphy,
 		return hdd_get_bpf_offload(hdd_ctx);
 	else
 		return hdd_set_reset_bpf_offload(hdd_ctx, tb,
-						 pAdapter->sessionId);
+						 pAdapter);
 }
 
 /**

+ 4 - 0
core/hdd/src/wlan_hdd_main.c

@@ -1496,6 +1496,10 @@ void hdd_update_tgt_cfg(void *context, void *param)
 		cfg->bpf_enabled, hdd_ctx->config->bpf_packet_filter_enable);
 	hdd_ctx->bpf_enabled = (cfg->bpf_enabled &&
 				hdd_ctx->config->bpf_packet_filter_enable);
+
+	if (hdd_ctx->bpf_enabled)
+		hdd_ctx->config->maxWoWFilters = MAX_WOW_FILTERS;
+
 	/* Configure NAN datapath features */
 	hdd_nan_datapath_target_config(hdd_ctx, cfg);
 }

+ 2 - 0
core/wma/inc/wma_types.h

@@ -475,6 +475,8 @@
 /* Bit 6 will be used to control BD rate for Management frames */
 #define HAL_USE_BD_RATE2_FOR_MANAGEMENT_FRAME 0x40
 
+#define MAX_WOW_FILTERS 2
+
 #define wma_tx_frame(hHal, pFrmBuf, frmLen, frmType, txDir, tid, pCompFunc, \
 		   pData, txFlag, sessionid, channel_freq) \
 	(QDF_STATUS)( wma_tx_packet( \

+ 2 - 0
core/wma/src/wma_features.c

@@ -2357,6 +2357,8 @@ static const u8 *wma_wow_wake_reason_str(A_INT32 wake_reason)
 		return "REASSOC_RES_RECV";
 	case WOW_REASON_ACTION_FRAME_RECV:
 		return "ACTION_FRAME_RECV";
+	case WOW_REASON_BPF_ALLOW:
+		return "WOW_REASON_BPF_ALLOW";
 	}
 	return "unknown";
 }

+ 6 - 0
core/wma/src/wma_main.c

@@ -3319,6 +3319,12 @@ static void wma_update_fw_config(tp_wma_handle wma_handle,
 						wma_handle->max_frag_entry);
 	wma_handle->max_frag_entry =
 		tgt_cap->wlan_resource_config.max_frag_entries;
+
+	/* Update no. of maxWoWFilters depending on BPF service */
+	if (WMI_SERVICE_IS_ENABLED(wma_handle->wmi_service_bitmap,
+				   WMI_SERVICE_BPF_OFFLOAD))
+		tgt_cap->wlan_resource_config.num_wow_filters =
+					MAX_WOW_FILTERS;
 }
 
 /**