From d40d1d1df4bf6a0d91c32fb4d2fb7fc777b51e5a Mon Sep 17 00:00:00 2001 From: Anurag Chouhan Date: Mon, 11 Sep 2017 14:56:30 +0530 Subject: [PATCH] qcacmn: Add wmi interface command to support debug stats Add wmi interface command to support set/get NUD debug stats. Change-Id: I2c5e9e2f6b0bb2e7b7b0a6404e939b33bffa3f18 CRs-Fixed: 2011463 --- os_if/linux/qca_vendor.h | 2 + wmi/inc/wmi_unified_api.h | 4 ++ wmi/inc/wmi_unified_param.h | 25 ++++++++ wmi/inc/wmi_unified_priv.h | 6 ++ wmi/src/wmi_unified_api.c | 38 +++++++++++++ wmi/src/wmi_unified_tlv.c | 110 ++++++++++++++++++++++++++++++++++++ 6 files changed, 185 insertions(+) diff --git a/os_if/linux/qca_vendor.h b/os_if/linux/qca_vendor.h index e1bb30843e..b6b91f91a2 100644 --- a/os_if/linux/qca_vendor.h +++ b/os_if/linux/qca_vendor.h @@ -677,6 +677,7 @@ enum qca_wlan_vendor_attr_get_station_info { * P2P listen offload index * @QCA_NL80211_VENDOR_SUBCMD_SAP_CONDITIONAL_CHAN_SWITCH_INDEX: SAP * conditional channel switch index + * @QCA_NL80211_VENDOR_SUBCMD_NUD_STATS_GET_INDEX: NUD DEBUG Stats index */ enum qca_nl80211_vendor_subcmds_index { @@ -755,6 +756,7 @@ enum qca_nl80211_vendor_subcmds_index { QCA_NL80211_VENDOR_SUBCMD_SAP_CONDITIONAL_CHAN_SWITCH_INDEX, QCA_NL80211_VENDOR_SUBCMD_UPDATE_EXTERNAL_ACS_CONFIG, QCA_NL80211_VENDOR_SUBCMD_PWR_SAVE_FAIL_DETECTED_INDEX, + QCA_NL80211_VENDOR_SUBCMD_NUD_STATS_GET_INDEX, }; /** diff --git a/wmi/inc/wmi_unified_api.h b/wmi/inc/wmi_unified_api.h index cc94f23925..26e5f48c1d 100644 --- a/wmi/inc/wmi_unified_api.h +++ b/wmi/inc/wmi_unified_api.h @@ -1536,4 +1536,8 @@ QDF_STATUS wmi_unified_send_dbs_scan_sel_params_cmd(void *wmi_hdl, QDF_STATUS wmi_unified_send_limit_off_chan_cmd(void *wmi_hdl, struct wmi_limit_off_chan_param *wmi_param); +QDF_STATUS wmi_unified_set_arp_stats_req(void *wmi_hdl, + struct set_arp_stats *req_buf); +QDF_STATUS wmi_unified_get_arp_stats_req(void *wmi_hdl, + struct get_arp_stats *req_buf); #endif /* _WMI_UNIFIED_API_H_ */ diff --git a/wmi/inc/wmi_unified_param.h b/wmi/inc/wmi_unified_param.h index bc8e9994d9..8d6922de07 100644 --- a/wmi/inc/wmi_unified_param.h +++ b/wmi/inc/wmi_unified_param.h @@ -5150,6 +5150,7 @@ typedef enum { wmi_dfs_radar_detection_event_id, wmi_ext_tbttoffset_update_event_id, wmi_11d_new_country_event_id, + wmi_get_arp_stats_req_id, wmi_events_max, } wmi_conv_event_id; @@ -7563,4 +7564,28 @@ struct wmi_mawc_roam_params { uint8_t rssi_stationary_low_adjust; }; +/** + * struct set_arp_stats - set/reset arp stats + * @vdev_id: session id + * @flag: enable/disable stats + * @pkt_type: type of packet(1 - arp) + * @ip_addr: subnet ipv4 address in case of encrypted packets + */ +struct set_arp_stats { + uint32_t vdev_id; + uint8_t flag; + uint8_t pkt_type; + uint32_t ip_addr; +}; + +/** + * struct get_arp_stats - get arp stats from firmware + * @pkt_type: packet type(1 - ARP) + * @vdev_id: session id + */ +struct get_arp_stats { + uint8_t pkt_type; + uint32_t vdev_id; +}; + #endif /* _WMI_UNIFIED_PARAM_H_ */ diff --git a/wmi/inc/wmi_unified_priv.h b/wmi/inc/wmi_unified_priv.h index 2a5cd02125..372b328716 100644 --- a/wmi/inc/wmi_unified_priv.h +++ b/wmi/inc/wmi_unified_priv.h @@ -750,6 +750,12 @@ QDF_STATUS (*send_roam_scan_offload_rssi_change_cmd)(wmi_unified_t wmi_handle, QDF_STATUS (*send_per_roam_config_cmd)(wmi_unified_t wmi_handle, struct wmi_per_roam_config_req *req_buf); +QDF_STATUS (*send_set_arp_stats_req_cmd)(wmi_unified_t wmi_handle, + struct set_arp_stats *req_buf); + +QDF_STATUS (*send_get_arp_stats_req_cmd)(wmi_unified_t wmi_handle, + struct get_arp_stats *req_buf); + QDF_STATUS (*send_get_buf_extscan_hotlist_cmd)(wmi_unified_t wmi_handle, struct ext_scan_setbssi_hotlist_params * photlist, int *buf_len); diff --git a/wmi/src/wmi_unified_api.c b/wmi/src/wmi_unified_api.c index d8dfda53a5..3a644478eb 100644 --- a/wmi/src/wmi_unified_api.c +++ b/wmi/src/wmi_unified_api.c @@ -3283,6 +3283,44 @@ QDF_STATUS wmi_unified_set_per_roam_config(void *wmi_hdl, return QDF_STATUS_E_FAILURE; } +/** + * wmi_unified_set_arp_stats_req() - set arp stats request + * @wmi_hdl: wmi handle + * @req_buf: pointer to set_arp_stats + * + * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure + */ +QDF_STATUS wmi_unified_set_arp_stats_req(void *wmi_hdl, + struct set_arp_stats *req_buf) +{ + wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl; + + if (wmi_handle->ops->send_set_arp_stats_req_cmd) + return wmi_handle->ops->send_set_arp_stats_req_cmd(wmi_handle, + req_buf); + + return QDF_STATUS_E_FAILURE; +} + +/** + * wmi_unified_get_arp_stats_req() - get arp stats request + * @wmi_hdl: wmi handle + * @req_buf: pointer to get_arp_stats + * + * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure + */ +QDF_STATUS wmi_unified_get_arp_stats_req(void *wmi_hdl, + struct get_arp_stats *req_buf) +{ + wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl; + + if (wmi_handle->ops->send_get_arp_stats_req_cmd) + return wmi_handle->ops->send_get_arp_stats_req_cmd(wmi_handle, + req_buf); + + return QDF_STATUS_E_FAILURE; +} + /** * wmi_unified_get_buf_extscan_hotlist_cmd() - prepare hotlist command * @wmi_hdl: wmi handle diff --git a/wmi/src/wmi_unified_tlv.c b/wmi/src/wmi_unified_tlv.c index d8c6e24c77..4e4c4c1620 100644 --- a/wmi/src/wmi_unified_tlv.c +++ b/wmi/src/wmi_unified_tlv.c @@ -18862,6 +18862,113 @@ QDF_STATUS send_limit_off_chan_cmd_tlv(wmi_unified_t wmi_handle, return QDF_STATUS_SUCCESS; } +/** + * send_set_arp_stats_req_cmd_tlv() - send wmi cmd to set arp stats request + * @wmi_handle: wmi handler + * @req_buf: set arp stats request buffer + * + * Return: 0 for success and non zero for failure + */ +static QDF_STATUS send_set_arp_stats_req_cmd_tlv(wmi_unified_t wmi_handle, + struct set_arp_stats *req_buf) +{ + wmi_buf_t buf = NULL; + QDF_STATUS status; + int len; + uint8_t *buf_ptr; + wmi_vdev_set_arp_stats_cmd_fixed_param *wmi_set_arp; + + len = sizeof(wmi_vdev_set_arp_stats_cmd_fixed_param); + buf = wmi_buf_alloc(wmi_handle, len); + if (!buf) { + WMI_LOGE("%s : wmi_buf_alloc failed", __func__); + return QDF_STATUS_E_NOMEM; + } + + buf_ptr = (uint8_t *) wmi_buf_data(buf); + wmi_set_arp = + (wmi_vdev_set_arp_stats_cmd_fixed_param *) buf_ptr; + WMITLV_SET_HDR(&wmi_set_arp->tlv_header, + WMITLV_TAG_STRUC_wmi_vdev_set_arp_stats_cmd_fixed_param, + WMITLV_GET_STRUCT_TLVLEN + (wmi_vdev_set_arp_stats_cmd_fixed_param)); + + /* fill in per roam config values */ + wmi_set_arp->vdev_id = req_buf->vdev_id; + + wmi_set_arp->set_clr = req_buf->flag; + wmi_set_arp->pkt_type = req_buf->pkt_type; + wmi_set_arp->ipv4 = req_buf->ip_addr; + + /* Send per roam config parameters */ + status = wmi_unified_cmd_send(wmi_handle, buf, + len, WMI_VDEV_SET_ARP_STAT_CMDID); + if (QDF_IS_STATUS_ERROR(status)) { + WMI_LOGE("WMI_SET_ARP_STATS_CMDID failed, Error %d", + status); + goto error; + } + + WMI_LOGI(FL("set arp stats flag=%d, vdev=%d"), + req_buf->flag, req_buf->vdev_id); + return QDF_STATUS_SUCCESS; +error: + wmi_buf_free(buf); + + return status; +} + +/** + * send_get_arp_stats_req_cmd_tlv() - send wmi cmd to get arp stats request + * @wmi_handle: wmi handler + * @req_buf: get arp stats request buffer + * + * Return: 0 for success and non zero for failure + */ +static QDF_STATUS send_get_arp_stats_req_cmd_tlv(wmi_unified_t wmi_handle, + struct get_arp_stats *req_buf) +{ + wmi_buf_t buf = NULL; + QDF_STATUS status; + int len; + uint8_t *buf_ptr; + wmi_vdev_get_arp_stats_cmd_fixed_param *get_arp_stats; + + len = sizeof(wmi_vdev_get_arp_stats_cmd_fixed_param); + buf = wmi_buf_alloc(wmi_handle, len); + if (!buf) { + WMI_LOGE("%s : wmi_buf_alloc failed", __func__); + return QDF_STATUS_E_NOMEM; + } + + buf_ptr = (uint8_t *) wmi_buf_data(buf); + get_arp_stats = + (wmi_vdev_get_arp_stats_cmd_fixed_param *) buf_ptr; + WMITLV_SET_HDR(&get_arp_stats->tlv_header, + WMITLV_TAG_STRUC_wmi_vdev_get_arp_stats_cmd_fixed_param, + WMITLV_GET_STRUCT_TLVLEN + (wmi_vdev_get_arp_stats_cmd_fixed_param)); + + /* fill in arp stats req cmd values */ + get_arp_stats->vdev_id = req_buf->vdev_id; + + WMI_LOGI(FL("vdev=%d"), req_buf->vdev_id); + /* Send per roam config parameters */ + status = wmi_unified_cmd_send(wmi_handle, buf, + len, WMI_VDEV_GET_ARP_STAT_CMDID); + if (QDF_IS_STATUS_ERROR(status)) { + WMI_LOGE("WMI_GET_ARP_STATS_CMDID failed, Error %d", + status); + goto error; + } + + return QDF_STATUS_SUCCESS; +error: + wmi_buf_free(buf); + + return status; +} + struct wmi_ops tlv_ops = { .send_vdev_create_cmd = send_vdev_create_cmd_tlv, .send_vdev_delete_cmd = send_vdev_delete_cmd_tlv, @@ -19252,6 +19359,8 @@ struct wmi_ops tlv_ops = { send_limit_off_chan_cmd_tlv, .extract_reg_ch_avoid_event = extract_reg_ch_avoid_event_tlv, + .send_set_arp_stats_req_cmd = send_set_arp_stats_req_cmd_tlv, + .send_get_arp_stats_req_cmd = send_get_arp_stats_req_cmd_tlv, }; /** @@ -19483,6 +19592,7 @@ static void populate_tlv_events_id(uint32_t *event_ids) event_ids[wmi_tt_stats_event_id] = WMI_THERM_THROT_STATS_EVENTID; event_ids[wmi_11d_new_country_event_id] = WMI_11D_NEW_COUNTRY_EVENTID; event_ids[wmi_pdev_tpc_event_id] = WMI_PDEV_TPC_EVENTID; + event_ids[wmi_get_arp_stats_req_id] = WMI_VDEV_GET_ARP_STAT_EVENTID; } #ifndef CONFIG_MCL