diff options
| author | Dundi Raviteja <dundi@codeaurora.org> | 2018-05-22 13:24:18 +0530 |
|---|---|---|
| committer | nshrivas <nshrivas@codeaurora.org> | 2018-05-25 04:39:06 -0700 |
| commit | 231ff0545dca083f68a3003535ee5561defbba0d (patch) | |
| tree | be32e4575f1da1a56526fb1b8eebcb292078e157 | |
| parent | 36abdbd5a601304201525f2489e4cabacf4bee54 (diff) | |
qcacld-3.0: Use request manager to get NUD stats
Use request manager for handling get NUD stats
Change-Id: Ie1a15de440803d007d16568138d4a8e7692a30d4
CRs-Fixed: 2246435
| -rw-r--r-- | core/hdd/inc/wlan_hdd_main.h | 35 | ||||
| -rw-r--r-- | core/hdd/src/wlan_hdd_cfg80211.c | 53 | ||||
| -rw-r--r-- | core/hdd/src/wlan_hdd_main.c | 34 | ||||
| -rw-r--r-- | core/sme/inc/sme_api.h | 3 | ||||
| -rw-r--r-- | core/sme/inc/sme_internal.h | 3 | ||||
| -rw-r--r-- | core/sme/src/common/sme_api.c | 7 | ||||
| -rw-r--r-- | core/wma/src/wma_features.c | 3 |
7 files changed, 74 insertions, 64 deletions
diff --git a/core/hdd/inc/wlan_hdd_main.h b/core/hdd/inc/wlan_hdd_main.h index 3c547b39997f..90912004e47c 100644 --- a/core/hdd/inc/wlan_hdd_main.h +++ b/core/hdd/inc/wlan_hdd_main.h @@ -1782,14 +1782,6 @@ struct suspend_resume_stats { }; /** - * struct hdd_nud_stats_context - hdd NUD stats context - * @response_event: NUD stats request wait event - */ -struct hdd_nud_stats_context { - qdf_event_t response_event; -}; - -/** * struct hdd_scan_chan_info - channel info * @freq: radio frequence * @cmd flag: cmd flag @@ -2186,7 +2178,6 @@ struct hdd_context_s { uint8_t curr_band; uint32_t no_of_probe_req_ouis; uint32_t *probe_req_voui; - struct hdd_nud_stats_context nud_stats_context; uint8_t bt_a2dp_active:1; uint8_t bt_vo_active:1; #ifdef FEATURE_SPECTRAL_SCAN @@ -2879,19 +2870,6 @@ void wlan_hdd_start_sap(hdd_adapter_t *ap_adapter, bool reinit); void hdd_set_rx_mode_rps(hdd_context_t *hdd_ctx, void *padapter, bool enable); /** - * hdd_init_nud_stats_ctx() - initialize NUD stats context - * @hdd_ctx: Pointer to hdd context - * - * Return: none - */ -static inline void hdd_init_nud_stats_ctx(hdd_context_t *hdd_ctx) -{ - if (qdf_event_create(&hdd_ctx->nud_stats_context.response_event) != - QDF_STATUS_SUCCESS) - hdd_err("NUD stats response event init failed!"); -} - -/** * hdd_dbs_scan_selection_init() - initialization for DBS scan selection config * @hdd_ctx: HDD context * @@ -3145,4 +3123,17 @@ uint32_t hdd_wlan_get_version(hdd_context_t *hdd_ctx, */ void hdd_update_hw_sw_info(hdd_context_t *hdd_ctx); +/** + * hdd_get_nud_stats_cb() - callback api to update the stats received from FW + * @data: pointer to hdd context. + * @rsp: pointer to data received from FW. + * @context: callback context + * + * This is called when wlan driver received response event for + * get arp stats to firmware. + * + * Return: None + */ +void hdd_get_nud_stats_cb(void *data, struct rsp_stats *rsp, void *context); + #endif /* end #if !defined(WLAN_HDD_MAIN_H) */ diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c index 710c51a98b6e..bd63676230fd 100644 --- a/core/hdd/src/wlan_hdd_cfg80211.c +++ b/core/hdd/src/wlan_hdd_cfg80211.c @@ -11613,13 +11613,18 @@ static int __wlan_hdd_cfg80211_get_nud_stats(struct wiphy *wiphy, const void *data, int data_len) { int err = 0; - struct hdd_nud_stats_context *context; struct net_device *dev = wdev->netdev; hdd_adapter_t *adapter = WLAN_HDD_GET_PRIV_PTR(dev); hdd_context_t *hdd_ctx = wiphy_priv(wiphy); struct get_arp_stats_params arp_stats_params; uint32_t pkt_type_bitmap; struct sk_buff *skb; + struct hdd_request *request = NULL; + static const struct hdd_request_params params = { + .priv_size = 0, + .timeout_ms = WLAN_WAIT_TIME_NUD_STATS, + }; + void *cookie = NULL; ENTER(); @@ -11642,13 +11647,17 @@ static int __wlan_hdd_cfg80211_get_nud_stats(struct wiphy *wiphy, return -EINVAL; } + request = hdd_request_alloc(¶ms); + if (!request) { + hdd_err("Request allocation failure"); + return -ENOMEM; + } + + cookie = hdd_request_cookie(request); + arp_stats_params.pkt_type = WLAN_NUD_STATS_ARP_PKT_TYPE; arp_stats_params.vdev_id = adapter->sessionId; - spin_lock(&hdd_context_lock); - context = &hdd_ctx->nud_stats_context; - qdf_event_reset(&context->response_event); - spin_unlock(&hdd_context_lock); pkt_type_bitmap = adapter->pkt_type_bitmap; @@ -11661,18 +11670,26 @@ static int __wlan_hdd_cfg80211_get_nud_stats(struct wiphy *wiphy, 0xFF, 0XFF, DATA_STALL_LOG_RECOVERY_TRIGGER_PDR); + if (sme_set_nud_debug_stats_cb(hdd_ctx->hHal, hdd_get_nud_stats_cb, + cookie) != QDF_STATUS_SUCCESS) { + hdd_err("Setting NUD debug stats callback failure"); + err = -EINVAL; + goto exit; + } + if (QDF_STATUS_SUCCESS != sme_get_nud_debug_stats(hdd_ctx->hHal, &arp_stats_params)) { QDF_TRACE(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_ERROR, "%s STATS_SET_START CMD Failed!!", __func__); - return -EINVAL; + err = -EINVAL; + goto exit; } - if (qdf_wait_for_event_completion(&context->response_event, - WLAN_WAIT_TIME_NUD_STATS) != - QDF_STATUS_SUCCESS) { - hdd_err("Target response timed out request "); - return -ETIMEDOUT; + err = hdd_request_wait_for_response(request); + if (err) { + hdd_err("SME timedout while retrieving NUD stats"); + err = -ETIMEDOUT; + goto exit; } skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, @@ -11680,7 +11697,8 @@ static int __wlan_hdd_cfg80211_get_nud_stats(struct wiphy *wiphy, if (!skb) { hdd_err("%s: cfg80211_vendor_cmd_alloc_reply_skb failed", __func__); - return -ENOMEM; + err = -ENOMEM; + goto exit; } if (nla_put_u16(skb, COUNT_FROM_NETDEV, @@ -11702,7 +11720,8 @@ static int __wlan_hdd_cfg80211_get_nud_stats(struct wiphy *wiphy, rx_host_drop_reorder)) { hdd_err("nla put fail"); kfree_skb(skb); - return -EINVAL; + err = -EINVAL; + goto exit; } if (adapter->con_status) nla_put_flag(skb, AP_LINK_ACTIVE); @@ -11713,11 +11732,15 @@ static int __wlan_hdd_cfg80211_get_nud_stats(struct wiphy *wiphy, pkt_type_bitmap &= ~CONNECTIVITY_CHECK_SET_ARP; if (pkt_type_bitmap) { - if (hdd_populate_connectivity_check_stats_info(adapter, skb)) - return -EINVAL; + if (hdd_populate_connectivity_check_stats_info(adapter, skb)) { + err = -EINVAL; + goto exit; + } } cfg80211_vendor_cmd_reply(skb); +exit: + hdd_request_put(request); return err; } diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index c35272715f69..98c37fec4a2d 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -8529,7 +8529,6 @@ static int hdd_context_init(hdd_context_t *hdd_ctx) hdd_ctx->max_intf_count = CSR_ROAM_SESSION_MAX; hdd_init_ll_stats_ctx(); - hdd_init_nud_stats_ctx(hdd_ctx); init_completion(&hdd_ctx->chain_rssi_context.response_event); init_completion(&hdd_ctx->mc_sus_event_var); @@ -11039,23 +11038,12 @@ void hdd_wlan_update_target_info(hdd_context_t *hdd_ctx, void *context) hdd_ctx->target_type = tgt_info->target_type; } -/** - * hdd_get_nud_stats_cb() - callback api to update the stats - * received from the firmware - * @data: pointer to adapter. - * @rsp: pointer to data received from FW. - * - * This is called when wlan driver received response event for - * get arp stats to firmware. - * - * Return: None - */ -static void hdd_get_nud_stats_cb(void *data, struct rsp_stats *rsp) +void hdd_get_nud_stats_cb(void *data, struct rsp_stats *rsp, void *context) { hdd_context_t *hdd_ctx = (hdd_context_t *)data; - struct hdd_nud_stats_context *context; int status; hdd_adapter_t *adapter = NULL; + struct hdd_request *request = NULL; ENTER(); @@ -11065,12 +11053,19 @@ static void hdd_get_nud_stats_cb(void *data, struct rsp_stats *rsp) } status = wlan_hdd_validate_context(hdd_ctx); - if (0 != status) + if (status != 0) return; + request = hdd_request_get(context); + if (!request) { + hdd_err("obselete request"); + return; + } + adapter = hdd_get_adapter_by_vdev(hdd_ctx, rsp->vdev_id); if ((NULL == adapter) || (WLAN_HDD_ADAPTER_MAGIC != adapter->magic)) { hdd_err("Invalid adapter or adapter has invalid magic"); + hdd_request_put(request); return; } @@ -11098,10 +11093,8 @@ static void hdd_get_nud_stats_cb(void *data, struct rsp_stats *rsp) rsp->icmpv4_rsp_recvd; } - spin_lock(&hdd_context_lock); - context = &hdd_ctx->nud_stats_context; - qdf_event_set(&context->response_event); - spin_unlock(&hdd_context_lock); + hdd_request_complete(request); + hdd_request_put(request); EXIT(); } @@ -11155,9 +11148,6 @@ int hdd_register_cb(hdd_context_t *hdd_ctx) sme_set_rssi_threshold_breached_cb(hdd_ctx->hHal, hdd_rssi_threshold_breached); - sme_set_nud_debug_stats_cb(hdd_ctx->hHal, - hdd_get_nud_stats_cb); - status = sme_apf_offload_register_callback(hdd_ctx->hHal, hdd_get_apf_capabilities_cb); if (!QDF_IS_STATUS_SUCCESS(status)) { diff --git a/core/sme/inc/sme_api.h b/core/sme/inc/sme_api.h index dc7ff7f2e1da..43186c34be3a 100644 --- a/core/sme/inc/sme_api.h +++ b/core/sme/inc/sme_api.h @@ -1745,7 +1745,8 @@ QDF_STATUS sme_get_nud_debug_stats(tHalHandle hal, struct get_arp_stats_params *get_stats_param); QDF_STATUS sme_set_nud_debug_stats_cb(tHalHandle hal, - void (*cb)(void *, struct rsp_stats *)); + void (*cb)(void *, struct rsp_stats *, void *context), + void *context); #ifdef WLAN_FEATURE_UDP_RESPONSE_OFFLOAD diff --git a/core/sme/inc/sme_internal.h b/core/sme/inc/sme_internal.h index 00538791e003..3c88d387cdee 100644 --- a/core/sme/inc/sme_internal.h +++ b/core/sme/inc/sme_internal.h @@ -265,7 +265,8 @@ typedef struct tagSmeStruct { struct sir_lost_link_info *lost_link_info); void (*rso_cmd_status_cb)(void *hdd_context, struct rso_cmd_status *rso_status); - void (*get_arp_stats_cb)(void *, struct rsp_stats *); + void *get_arp_stats_context; + void (*get_arp_stats_cb)(void *, struct rsp_stats *, void *); void (*bt_activity_info_cb)(void *context, uint32_t bt_activity); void (*chip_power_save_fail_cb)(void *, struct chip_pwr_save_fail_detected_params *); diff --git a/core/sme/src/common/sme_api.c b/core/sme/src/common/sme_api.c index 373577c6b637..1d0516333961 100644 --- a/core/sme/src/common/sme_api.c +++ b/core/sme/src/common/sme_api.c @@ -15847,13 +15847,15 @@ QDF_STATUS sme_set_rssi_threshold_breached_cb(tHalHandle h_hal, * sme_set_nud_debug_stats_cb() - set nud debug stats callback * @hal: global hal handle * @cb: callback function pointer + * @context: callback context * - * This function stores nud debug stats callback function. + * This function stores nud debug stats callback function and context * * Return: QDF_STATUS enumeration. */ QDF_STATUS sme_set_nud_debug_stats_cb(tHalHandle hal, - void (*cb)(void *, struct rsp_stats *)) + void (*cb)(void *, struct rsp_stats *, void *), + void *context) { QDF_STATUS status = QDF_STATUS_SUCCESS; tpAniSirGlobal mac; @@ -15874,6 +15876,7 @@ QDF_STATUS sme_set_nud_debug_stats_cb(tHalHandle hal, } mac->sme.get_arp_stats_cb = cb; + mac->sme.get_arp_stats_context = context; sme_release_global_lock(&mac->sme); return status; } diff --git a/core/wma/src/wma_features.c b/core/wma/src/wma_features.c index eeb1c085c7b3..043ae5ad0cbd 100644 --- a/core/wma/src/wma_features.c +++ b/core/wma/src/wma_features.c @@ -11004,7 +11004,8 @@ int wma_get_arp_stats_handler(void *handle, uint8_t *data, connect_stats_event->icmpv4_rsp_recvd); } - mac->sme.get_arp_stats_cb(mac->hHdd, &rsp); + mac->sme.get_arp_stats_cb(mac->hHdd, &rsp, + mac->sme.get_arp_stats_context); EXIT(); |
