mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-25 06:03:36 -04:00
qcacld-3.0: Use request manager to get NUD stats
Use request manager for handling get NUD stats Change-Id: Ie1a15de440803d007d16568138d4a8e7692a30d4 CRs-Fixed: 2246435
This commit is contained in:
parent
396dbdfe01
commit
3bcf3a89e3
7 changed files with 74 additions and 63 deletions
|
|
@ -1582,14 +1582,6 @@ enum hdd_sta_smps_param {
|
|||
HDD_STA_SMPS_PARAM_DTIM_1CHRX_ENABLE = 5
|
||||
};
|
||||
|
||||
/**
|
||||
* struct hdd_nud_stats_context - hdd NUD stats context
|
||||
* @response_event: NUD stats request wait event
|
||||
*/
|
||||
struct hdd_nud_stats_context {
|
||||
struct completion response_event;
|
||||
};
|
||||
|
||||
/**
|
||||
* tos - Type of service requested by the application
|
||||
* TOS_BK: Back ground traffic
|
||||
|
|
@ -1881,7 +1873,6 @@ struct hdd_context {
|
|||
#endif
|
||||
uint8_t bt_a2dp_active:1;
|
||||
uint8_t bt_vo_active:1;
|
||||
struct hdd_nud_stats_context nud_stats_context;
|
||||
enum band_info curr_band;
|
||||
bool imps_enabled;
|
||||
int user_configured_pkt_filter_rules;
|
||||
|
|
@ -2425,17 +2416,6 @@ wlan_hdd_check_custom_con_channel_rules(struct hdd_adapter *sta_adapter,
|
|||
void wlan_hdd_stop_sap(struct hdd_adapter *ap_adapter);
|
||||
void wlan_hdd_start_sap(struct hdd_adapter *ap_adapter, bool reinit);
|
||||
|
||||
/**
|
||||
* 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(struct hdd_context *hdd_ctx)
|
||||
{
|
||||
init_completion(&hdd_ctx->nud_stats_context.response_event);
|
||||
}
|
||||
|
||||
void wlan_hdd_soc_set_antenna_mode_cb(enum set_antenna_mode_status status);
|
||||
|
||||
#ifdef QCA_CONFIG_SMP
|
||||
|
|
@ -3227,4 +3207,17 @@ uint32_t hdd_wlan_get_version(struct hdd_context *hdd_ctx,
|
|||
*/
|
||||
void hdd_update_hw_sw_info(struct hdd_context *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) */
|
||||
|
|
|
|||
|
|
@ -13319,8 +13319,6 @@ static int __wlan_hdd_cfg80211_get_nud_stats(struct wiphy *wiphy,
|
|||
const void *data, int data_len)
|
||||
{
|
||||
int err = 0;
|
||||
unsigned long rc;
|
||||
struct hdd_nud_stats_context *context;
|
||||
struct net_device *dev = wdev->netdev;
|
||||
struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
|
||||
struct hdd_context *hdd_ctx = wiphy_priv(wiphy);
|
||||
|
|
@ -13328,6 +13326,12 @@ static int __wlan_hdd_cfg80211_get_nud_stats(struct wiphy *wiphy,
|
|||
void *soc = cds_get_context(QDF_MODULE_ID_SOC);
|
||||
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;
|
||||
|
||||
hdd_enter();
|
||||
|
||||
|
|
@ -13349,14 +13353,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->session_id;
|
||||
|
||||
spin_lock(&hdd_context_lock);
|
||||
context = &hdd_ctx->nud_stats_context;
|
||||
INIT_COMPLETION(context->response_event);
|
||||
spin_unlock(&hdd_context_lock);
|
||||
|
||||
pkt_type_bitmap = adapter->pkt_type_bitmap;
|
||||
|
||||
/* send NUD failure event only when ARP tracking is enabled. */
|
||||
|
|
@ -13368,18 +13375,25 @@ 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)) {
|
||||
hdd_err("STATS_SET_START CMD Failed!");
|
||||
return -EINVAL;
|
||||
err = -EINVAL;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
rc = wait_for_completion_timeout(&context->response_event,
|
||||
msecs_to_jiffies(
|
||||
WLAN_WAIT_TIME_NUD_STATS));
|
||||
if (!rc) {
|
||||
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,
|
||||
|
|
@ -13387,7 +13401,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,
|
||||
|
|
@ -13409,7 +13424,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);
|
||||
|
|
@ -13420,11 +13436,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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8535,7 +8535,6 @@ static int hdd_context_init(struct hdd_context *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->mc_sus_event_var);
|
||||
init_completion(&hdd_ctx->ready_to_suspend);
|
||||
|
|
@ -10902,23 +10901,12 @@ void hdd_wlan_update_target_info(struct hdd_context *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)
|
||||
{
|
||||
struct hdd_context *hdd_ctx = (struct hdd_context *)data;
|
||||
struct hdd_nud_stats_context *context;
|
||||
int status;
|
||||
struct hdd_adapter *adapter = NULL;
|
||||
struct hdd_request *request = NULL;
|
||||
|
||||
hdd_enter();
|
||||
|
||||
|
|
@ -10928,12 +10916,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;
|
||||
}
|
||||
|
||||
|
|
@ -10961,10 +10956,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;
|
||||
complete(&context->response_event);
|
||||
spin_unlock(&hdd_context_lock);
|
||||
hdd_request_complete(request);
|
||||
hdd_request_put(request);
|
||||
|
||||
hdd_exit();
|
||||
}
|
||||
|
|
@ -11005,8 +10998,6 @@ int hdd_register_cb(struct hdd_context *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);
|
||||
|
||||
sme_set_link_layer_stats_ind_cb(hdd_ctx->hHal,
|
||||
wlan_hdd_cfg80211_link_layer_stats_callback);
|
||||
|
||||
|
|
|
|||
|
|
@ -1469,7 +1469,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);
|
||||
|
||||
/**
|
||||
* sme_set_chan_info_callback() - Register chan info callback
|
||||
|
|
|
|||
|
|
@ -249,7 +249,8 @@ typedef struct tagSmeStruct {
|
|||
void (*chip_power_save_fail_cb)(void *,
|
||||
struct chip_pwr_save_fail_detected_params *);
|
||||
void (*bt_activity_info_cb)(void *context, uint32_t bt_activity);
|
||||
void (*get_arp_stats_cb)(void *, struct rsp_stats *);
|
||||
void *get_arp_stats_context;
|
||||
void (*get_arp_stats_cb)(void *, struct rsp_stats *, void *);
|
||||
get_chain_rssi_callback get_chain_rssi_cb;
|
||||
void *get_chain_rssi_context;
|
||||
void (*tx_queue_cb)(void *, uint32_t vdev_id,
|
||||
|
|
|
|||
|
|
@ -13108,13 +13108,15 @@ int sme_update_he_ldpc_supp(tHalHandle hal, uint8_t session_id,
|
|||
* 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.
|
||||
*
|
||||
* 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;
|
||||
|
|
@ -13135,6 +13137,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;
|
||||
}
|
||||
|
|
@ -13143,6 +13146,7 @@ QDF_STATUS sme_set_nud_debug_stats_cb(tHalHandle hal,
|
|||
* sme_set_rssi_threshold_breached_cb() - set rssi threshold breached callback
|
||||
* @h_hal: global hal handle
|
||||
* @cb: callback function pointer
|
||||
* @context: callback context
|
||||
*
|
||||
* This function stores the rssi threshold breached callback function.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -5317,7 +5317,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);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue