diff --git a/dp/inc/cdp_txrx_ctrl.h b/dp/inc/cdp_txrx_ctrl.h index e177b55320..c1d53e8c2a 100644 --- a/dp/inc/cdp_txrx_ctrl.h +++ b/dp/inc/cdp_txrx_ctrl.h @@ -485,6 +485,40 @@ static inline void cdp_txrx_set_pdev_param(ol_txrx_soc_handle soc, (pdev, type, val); } +/** + * cdp_enable_peer_based_pktlog()- Set flag in peer structure + * + * @soc: pointer to the soc + * @pdev: the data physical device object + * @enable: enable or disable peer based filter based pktlog + * @peer_macaddr: Mac address of peer which needs to be + * filtered + * + * This function will set flag in peer structure if peer based filtering + * is enabled for pktlog + * + * Return: int + */ +static inline int +cdp_enable_peer_based_pktlog(ol_txrx_soc_handle soc, + struct cdp_pdev *pdev, char *peer_macaddr, + uint8_t enable) +{ + if (!soc || !soc->ops) { + QDF_TRACE_ERROR(QDF_MODULE_ID_DP, + "%s invalid instance", __func__); + QDF_BUG(0); + return 0; + } + + if (!soc->ops->ctrl_ops || + !soc->ops->ctrl_ops->enable_peer_based_pktlog) + return 0; + + return soc->ops->ctrl_ops->enable_peer_based_pktlog + (pdev, peer_macaddr, enable); +} + /** * @brief Subscribe to a specified WDI event. * @details diff --git a/dp/inc/cdp_txrx_ops.h b/dp/inc/cdp_txrx_ops.h index 88169fa7b3..0d97f18c2f 100644 --- a/dp/inc/cdp_txrx_ops.h +++ b/dp/inc/cdp_txrx_ops.h @@ -618,6 +618,9 @@ struct cdp_ctrl_ops { uint32_t (*txrx_get_vdev_param)(struct cdp_vdev *vdev, enum cdp_vdev_param_type param); + int (*enable_peer_based_pktlog)(struct cdp_pdev + *txrx_pdev_handle, char *macaddr, uint8_t enb_dsb); + }; struct cdp_me_ops { diff --git a/dp/wifi3.0/dp_main.c b/dp/wifi3.0/dp_main.c index 81e2133b54..b2cb3b46fa 100644 --- a/dp/wifi3.0/dp_main.c +++ b/dp/wifi3.0/dp_main.c @@ -8694,6 +8694,37 @@ static QDF_STATUS dp_config_for_nac_rssi(struct cdp_vdev *vdev_handle, } #endif +/** + * dp_enable_peer_based_pktlog() - Set Flag for peer based filtering + * for pktlog + * @txrx_pdev_handle: cdp_pdev handle + * @enb_dsb: Enable or disable peer based filtering + * + * Return: QDF_STATUS + */ +static int +dp_enable_peer_based_pktlog( + struct cdp_pdev *txrx_pdev_handle, + char *mac_addr, uint8_t enb_dsb) +{ + struct dp_peer *peer; + uint8_t local_id; + struct dp_pdev *pdev = (struct dp_pdev *)txrx_pdev_handle; + + peer = (struct dp_peer *)dp_find_peer_by_addr(txrx_pdev_handle, + mac_addr, &local_id); + + if (!peer) { + dp_err("Invalid Peer"); + return QDF_STATUS_E_FAILURE; + } + + peer->peer_based_pktlog_filter = enb_dsb; + pdev->dp_peer_based_pktlog = enb_dsb; + + return QDF_STATUS_SUCCESS; +} + static QDF_STATUS dp_peer_map_attach_wifi3(struct cdp_soc_t *soc_hdl, uint32_t max_peers, bool peer_map_unmap_v2) @@ -8894,6 +8925,7 @@ static struct cdp_ctrl_ops dp_ops_ctrl = { #endif .set_key = dp_set_michael_key, .txrx_get_vdev_param = dp_get_vdev_param, + .enable_peer_based_pktlog = dp_enable_peer_based_pktlog, }; static struct cdp_me_ops dp_ops_me = { diff --git a/dp/wifi3.0/dp_rx_mon_status.c b/dp/wifi3.0/dp_rx_mon_status.c index b3c60f6a20..a6425dd49e 100644 --- a/dp/wifi3.0/dp_rx_mon_status.c +++ b/dp/wifi3.0/dp_rx_mon_status.c @@ -442,6 +442,43 @@ dp_rx_handle_ppdu_stats(struct dp_soc *soc, struct dp_pdev *pdev, } #endif +/** +* dp_rx_process_peer_based_pktlog() - Process Rx pktlog if peer based +* filtering enabled +* @soc: core txrx main context +* @ppdu_info: Structure for rx ppdu info +* @status_nbuf: Qdf nbuf abstraction for linux skb +* @mac_id: mac_id/pdev_id correspondinggly for MCL and WIN +* +* Return: none +*/ +static inline void +dp_rx_process_peer_based_pktlog(struct dp_soc *soc, + struct hal_rx_ppdu_info *ppdu_info, + qdf_nbuf_t status_nbuf, uint32_t mac_id) +{ + struct dp_peer *peer; + struct dp_ast_entry *ast_entry; + uint32_t ast_index; + + ast_index = ppdu_info->rx_status.ast_index; + if (ast_index < (WLAN_UMAC_PSOC_MAX_PEERS * 2)) { + ast_entry = soc->ast_table[ast_index]; + if (ast_entry) { + peer = ast_entry->peer; + if (peer && (peer->peer_ids[0] != HTT_INVALID_PEER)) { + if (peer->peer_based_pktlog_filter) { + dp_wdi_event_handler( + WDI_EVENT_RX_DESC, soc, + status_nbuf, + peer->peer_ids[0], + WDI_NO_VAL, mac_id); + } + } + } + } +} + /** * dp_rx_mon_status_process_tlv() - Process status TLV in status * buffer on Rx status Queue posted by status SRNG processing. @@ -476,12 +513,6 @@ dp_rx_mon_status_process_tlv(struct dp_soc *soc, uint32_t mac_id, rx_tlv = qdf_nbuf_data(status_nbuf); rx_tlv_start = rx_tlv; -#ifndef REMOVE_PKT_LOG -#if defined(WDI_EVENT_ENABLE) - dp_wdi_event_handler(WDI_EVENT_RX_DESC, soc, - status_nbuf, HTT_INVALID_PEER, WDI_NO_VAL, mac_id); -#endif -#endif if ((pdev->monitor_vdev != NULL) || (pdev->enhanced_stats_en) || pdev->mcopy_mode) { @@ -499,7 +530,14 @@ dp_rx_mon_status_process_tlv(struct dp_soc *soc, uint32_t mac_id, } while (tlv_status == HAL_TLV_STATUS_PPDU_NOT_DONE); } - + if (pdev->dp_peer_based_pktlog) { + dp_rx_process_peer_based_pktlog(soc, ppdu_info, + status_nbuf, mac_id); + } else { + dp_wdi_event_handler(WDI_EVENT_RX_DESC, soc, + status_nbuf, HTT_INVALID_PEER, + WDI_NO_VAL, mac_id); + } if (ppdu_info->rx_status.monitor_direct_used && pdev->neighbour_peers_added && pdev->monitor_vdev) { smart_mesh_status = dp_rx_handle_smart_mesh_mode(soc, diff --git a/dp/wifi3.0/dp_types.h b/dp/wifi3.0/dp_types.h index 384405a913..90f63f26ef 100644 --- a/dp/wifi3.0/dp_types.h +++ b/dp/wifi3.0/dp_types.h @@ -1338,6 +1338,10 @@ struct dp_pdev { union dp_rx_desc_list_elem_t *free_list_head; union dp_rx_desc_list_elem_t *free_list_tail; + /* Pdev level flag to check peer based pktlog enabled or + * disabled + */ + uint8_t dp_peer_based_pktlog; }; struct dp_peer; @@ -1604,6 +1608,10 @@ struct dp_peer { */ uint8_t kill_256_sessions; qdf_atomic_t is_default_route_set; + /* Peer level flag to check peer based pktlog enabled or + * disabled + */ + uint8_t peer_based_pktlog_filter; }; #ifdef CONFIG_WIN diff --git a/wmi/inc/wmi_unified_api.h b/wmi/inc/wmi_unified_api.h index 941afcbd5a..6eab215b9c 100644 --- a/wmi/inc/wmi_unified_api.h +++ b/wmi/inc/wmi_unified_api.h @@ -545,6 +545,22 @@ QDF_STATUS wmi_unified_wow_remove_wakeup_pattern_send(void *wmi_hdl, #ifndef CONFIG_MCL QDF_STATUS wmi_unified_packet_log_enable_send(void *wmi_hdl, WMI_HOST_PKTLOG_EVENT PKTLOG_EVENT, uint8_t mac_id); + +/** + * wmi_unified_peer_based_pktlog_send() - WMI request enable peer + * based filtering + * @wmi_handle: handle to WMI. + * @macaddr: PEER mac address to be filtered + * @mac_id: Mac id + * @enb_dsb: Enable or Disable peer based pktlog + * filtering + * + * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure + */ +QDF_STATUS wmi_unified_peer_based_pktlog_send(void *wmi_hdl, + uint8_t *macaddr, + uint8_t mac_id, + uint8_t enb_dsb); #else QDF_STATUS wmi_unified_packet_log_enable_send(void *wmi_hdl, uint8_t macaddr[IEEE80211_ADDR_LEN], diff --git a/wmi/inc/wmi_unified_priv.h b/wmi/inc/wmi_unified_priv.h index 0f33121320..7fc833dade 100644 --- a/wmi/inc/wmi_unified_priv.h +++ b/wmi/inc/wmi_unified_priv.h @@ -797,6 +797,11 @@ QDF_STATUS (*send_obss_color_collision_cfg_cmd)(wmi_unified_t wmi_handle, QDF_STATUS (*extract_obss_color_collision_info)(uint8_t *evt_buf, struct wmi_obss_color_collision_info *info); +QDF_STATUS (*send_peer_based_pktlog_cmd)(wmi_unified_t wmi_handle, + uint8_t *macaddr, + uint8_t mac_id, + uint8_t enb_dsb); + #ifdef WMI_STA_SUPPORT QDF_STATUS (*send_del_ts_cmd)(wmi_unified_t wmi_handle, uint8_t vdev_id, uint8_t ac); diff --git a/wmi/src/wmi_unified_api.c b/wmi/src/wmi_unified_api.c index 0ac2041804..bd3ebd21dd 100644 --- a/wmi/src/wmi_unified_api.c +++ b/wmi/src/wmi_unified_api.c @@ -735,6 +735,30 @@ QDF_STATUS wmi_unified_packet_log_enable_send(void *wmi_hdl, return QDF_STATUS_E_FAILURE; } +/** + * wmi_unified_peer_based_pktlog_send() - WMI request enable peer + * based filtering + * @wmi_handle: handle to WMI. + * @macaddr: PEER mac address to be filtered + * @mac_id: Mac id + * @enb_dsb: Enable or Disable peer based pktlog + * filtering + * + * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure + */ +QDF_STATUS wmi_unified_peer_based_pktlog_send(void *wmi_hdl, + uint8_t *macaddr, + uint8_t mac_id, + uint8_t enb_dsb) +{ + wmi_unified_t wmi_handle = (wmi_unified_t)wmi_hdl; + + if (wmi_handle->ops->send_peer_based_pktlog_cmd) + return wmi_handle->ops->send_peer_based_pktlog_cmd + (wmi_handle, macaddr, mac_id, enb_dsb); + + return QDF_STATUS_E_FAILURE; +} #endif /** * wmi_unified_packet_log_disable__send() - WMI pktlog disable function diff --git a/wmi/src/wmi_unified_tlv.c b/wmi/src/wmi_unified_tlv.c index 8b147abb43..565e85d0ce 100644 --- a/wmi/src/wmi_unified_tlv.c +++ b/wmi/src/wmi_unified_tlv.c @@ -1710,6 +1710,70 @@ static QDF_STATUS send_stats_request_cmd_tlv(wmi_unified_t wmi_handle, } #ifdef CONFIG_WIN + +/** + * send_peer_based_pktlog_cmd() - Send WMI command to enable packet-log + * @wmi_handle: handle to WMI. + * @macaddr: Peer mac address to be filter + * @mac_id: mac id to have radio context + * @enb_dsb: Enable MAC based filtering or Disable + * + * Return: QDF_STATUS + */ +static QDF_STATUS send_peer_based_pktlog_cmd(wmi_unified_t wmi_handle, + uint8_t *macaddr, + uint8_t mac_id, + uint8_t enb_dsb) +{ + int32_t ret; + wmi_pdev_pktlog_filter_cmd_fixed_param *cmd; + wmi_pdev_pktlog_filter_info *mac_info; + wmi_buf_t buf; + uint8_t *buf_ptr; + uint16_t len = sizeof(wmi_pdev_pktlog_filter_cmd_fixed_param) + + sizeof(wmi_pdev_pktlog_filter_info) + WMI_TLV_HDR_SIZE; + + 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); + cmd = (wmi_pdev_pktlog_filter_cmd_fixed_param *)buf_ptr; + WMITLV_SET_HDR(&cmd->tlv_header, + WMITLV_TAG_STRUC_wmi_pdev_pktlog_filter_cmd_fixed_param, + WMITLV_GET_STRUCT_TLVLEN + (wmi_pdev_pktlog_filter_cmd_fixed_param)); + cmd->pdev_id = mac_id; + cmd->enable = enb_dsb; + cmd->num_of_mac_addresses = 1; + wmi_mtrace(WMI_PDEV_PKTLOG_FILTER_CMDID, cmd->pdev_id, 0); + + buf_ptr += sizeof(*cmd); + WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, + sizeof(wmi_pdev_pktlog_filter_info)); + buf_ptr += WMI_TLV_HDR_SIZE; + + mac_info = (wmi_pdev_pktlog_filter_info *)(buf_ptr); + + WMITLV_SET_HDR(&mac_info->tlv_header, + WMITLV_TAG_STRUC_wmi_pdev_pktlog_filter_info, + WMITLV_GET_STRUCT_TLVLEN + (wmi_pdev_pktlog_filter_info)); + + WMI_CHAR_ARRAY_TO_MAC_ADDR(macaddr, &mac_info->peer_mac_address); + ret = wmi_unified_cmd_send(wmi_handle, buf, len, + WMI_PDEV_PKTLOG_FILTER_CMDID); + if (ret) { + WMI_LOGE("Failed to send peer based pktlog command to FW =%d" + , ret); + wmi_buf_free(buf); + } + + return ret; +} + /** * send_packet_log_enable_cmd_tlv() - Send WMI command to enable packet-log * @param wmi_handle : handle to WMI. @@ -1795,13 +1859,30 @@ static QDF_STATUS send_packet_log_disable_cmd_tlv(wmi_unified_t wmi_handle, * @param macaddr : MAC address * @param param : pointer to hold stats request parameter * - * Return: 0 on success and -ve on failure. + * Return: QDF_STATUS. */ static QDF_STATUS send_packet_log_enable_cmd_tlv(wmi_unified_t wmi_handle, uint8_t macaddr[IEEE80211_ADDR_LEN], struct packet_enable_params *param) { - return 0; + return QDF_STATUS_SUCCESS; +} + +/** + * send_peer_based_pktlog_cmd() - Send WMI command to enable packet-log + * @wmi_handle: handle to WMI. + * @macaddr: Peer mac address to be filter + * @mac_id: mac id to have radio context + * @enb_dsb: Enable MAC based filtering or Disable + * + * Return: QDF_STATUS + */ +static QDF_STATUS send_peer_based_pktlog_cmd(wmi_unified_t wmi_handle, + uint8_t *macaddr, + uint8_t mac_id, + uint8_t enb_dsb) +{ + return QDF_STATUS_SUCCESS; } /** * send_packet_log_disable_cmd_tlv() - Send WMI command to disable @@ -1809,12 +1890,12 @@ static QDF_STATUS send_packet_log_enable_cmd_tlv(wmi_unified_t wmi_handle, * @param wmi_handle : handle to WMI. * @mac_id: mac id to have radio context * - * Return: 0 on success and -ve on failure. + * Return: QDF_STATUS. */ static QDF_STATUS send_packet_log_disable_cmd_tlv(wmi_unified_t wmi_handle, uint8_t mac_id) { - return 0; + return QDF_STATUS_SUCCESS; } #endif @@ -11120,6 +11201,7 @@ struct wmi_ops tlv_ops = { .send_vdev_set_param_cmd = send_vdev_set_param_cmd_tlv, .send_stats_request_cmd = send_stats_request_cmd_tlv, .send_packet_log_enable_cmd = send_packet_log_enable_cmd_tlv, + .send_peer_based_pktlog_cmd = send_peer_based_pktlog_cmd, .send_time_stamp_sync_cmd = send_time_stamp_sync_cmd_tlv, .send_packet_log_disable_cmd = send_packet_log_disable_cmd_tlv, .send_beacon_tmpl_send_cmd = send_beacon_tmpl_send_cmd_tlv,