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
This commit is contained in:
Arun Khandavalli
2016-08-17 10:20:29 +05:30
committed by qcabuildsw
parent c67110c9b2
commit 3dd06deb03
5 changed files with 27 additions and 4 deletions

View File

@@ -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_set_reset_bpf_offload - Post set/reset bpf to SME
* @hdd_ctx: Hdd context * @hdd_ctx: Hdd context
* @tb: Length of @data * @tb: Length of @data
* @session_id: Session identifier * @adapter: pointer to adapter struct
* *
* Return: 0 on success; errno on failure * Return: 0 on success; errno on failure
*/ */
static int hdd_set_reset_bpf_offload(hdd_context_t *hdd_ctx, static int hdd_set_reset_bpf_offload(hdd_context_t *hdd_ctx,
struct nlattr **tb, struct nlattr **tb,
uint8_t session_id) hdd_adapter_t *adapter)
{ {
struct sir_bpf_set_offload *bpf_set_offload; struct sir_bpf_set_offload *bpf_set_offload;
QDF_STATUS status; QDF_STATUS status;
@@ -6088,6 +6088,15 @@ static int hdd_set_reset_bpf_offload(hdd_context_t *hdd_ctx,
ENTER(); 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)); bpf_set_offload = qdf_mem_malloc(sizeof(*bpf_set_offload));
if (bpf_set_offload == NULL) { if (bpf_set_offload == NULL) {
hdd_err("qdf_mem_malloc failed for bpf_set_offload"); 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; bpf_set_offload->current_length = prog_len;
nla_memcpy(bpf_set_offload->program, tb[BPF_PROGRAM], 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 */ /* Parse and fetch filter Id */
if (!tb[BPF_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); return hdd_get_bpf_offload(hdd_ctx);
else else
return hdd_set_reset_bpf_offload(hdd_ctx, tb, return hdd_set_reset_bpf_offload(hdd_ctx, tb,
pAdapter->sessionId); pAdapter);
} }
/** /**

View File

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

View File

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

View File

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

View File

@@ -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);
wma_handle->max_frag_entry = wma_handle->max_frag_entry =
tgt_cap->wlan_resource_config.max_frag_entries; 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;
} }
/** /**