diff --git a/dp/inc/cdp_txrx_cmn_struct.h b/dp/inc/cdp_txrx_cmn_struct.h index d34920d29c29..e220818fe843 100644 --- a/dp/inc/cdp_txrx_cmn_struct.h +++ b/dp/inc/cdp_txrx_cmn_struct.h @@ -184,6 +184,7 @@ enum htt_cmn_dbg_stats_type { * @TXRX_RX_HOST_STATS: Print host Rx stats * @TXRX_CLEAR_STATS: clear all host stats * @TXRX_SRNG_PTR_STATS: Print SRNG pointer stats + * @TXRX_RX_MON_STATS: Print monitor mode stats */ enum cdp_host_txrx_stats { TXRX_HOST_STATS_INVALID = -1, @@ -194,6 +195,7 @@ enum cdp_host_txrx_stats { TXRX_RX_HOST_STATS = 4, TXRX_AST_STATS = 5, TXRX_SRNG_PTR_STATS = 6, + TXRX_RX_MON_STATS = 7, TXRX_HOST_STATS_MAX, }; @@ -1179,7 +1181,7 @@ struct cdp_config_params { * @param1: opaque argument 1 to be passed to htt * @param2: opaque argument 2 to be passed to htt * @param3: opaque argument 3 to be passed to htt - * @channel_param: Channel Information + * @mac id: mac_id */ struct cdp_txrx_stats_req { enum cdp_stats stats; @@ -1188,7 +1190,7 @@ struct cdp_txrx_stats_req { uint32_t param2; uint32_t param3; uint32_t cookie_val; - uint8_t channel; + uint8_t mac_id; }; /** diff --git a/dp/inc/cdp_txrx_host_stats.h b/dp/inc/cdp_txrx_host_stats.h index 6ac24b724669..179dd785e649 100644 --- a/dp/inc/cdp_txrx_host_stats.h +++ b/dp/inc/cdp_txrx_host_stats.h @@ -405,7 +405,8 @@ static inline void cdp_get_dp_htt_stats(ol_txrx_soc_handle soc, struct cdp_pdev *pdev, void *data, uint32_t data_len) { - if (soc->ops->host_stats_ops->get_htt_stats) + if (soc && soc->ops && soc->ops->host_stats_ops && + soc->ops->host_stats_ops->get_htt_stats) return soc->ops->host_stats_ops->get_htt_stats (pdev, data, data_len); return; diff --git a/dp/inc/cdp_txrx_mon_struct.h b/dp/inc/cdp_txrx_mon_struct.h index 9023b67ead87..7fbc75886ef1 100644 --- a/dp/inc/cdp_txrx_mon_struct.h +++ b/dp/inc/cdp_txrx_mon_struct.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 The Linux Foundation. All rights reserved. + * Copyright (c) 2017-2018 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -196,4 +196,34 @@ struct cdp_mon_status { }; +enum { + CDP_MON_PPDU_START = 0, + CDP_MON_PPDU_END, +}; + +/** + * struct cdp_pdev_mon_stats + * @status_ppdu_state: state on PPDU start and end + * @status_ppdu_start: status ring PPDU start TLV count + * @status_ppdu_end: status ring PPDU end TLV count + * @status_ppdu_compl: status ring matching start and end count on PPDU + * @status_ppdu_start_mis: status ring missing start TLV count on PPDU + * @status_ppdu_end_mis: status ring missing end TLV count on PPDU + * @status_ppdu_done: status ring PPDU done TLV count + * @dest_ppdu_done: destination ring PPDU count + * @dest_mpdu_done: destination ring MPDU count + */ +struct cdp_pdev_mon_stats { +#ifndef REMOVE_MON_DBG_STATS + uint32_t status_ppdu_state; + uint32_t status_ppdu_start; + uint32_t status_ppdu_end; + uint32_t status_ppdu_compl; + uint32_t status_ppdu_start_mis; + uint32_t status_ppdu_end_mis; +#endif + uint32_t status_ppdu_done; + uint32_t dest_ppdu_done; + uint32_t dest_mpdu_done; +}; #endif diff --git a/dp/wifi3.0/dp_htt.c b/dp/wifi3.0/dp_htt.c index aaec3f94537f..15e8b0f98def 100644 --- a/dp/wifi3.0/dp_htt.c +++ b/dp/wifi3.0/dp_htt.c @@ -3065,31 +3065,6 @@ htt_soc_detach(void *htt_soc) qdf_mem_free(soc); } -/* - * dp_get_pdev_mask_for_channel_id() - Retrieve pdev_id mask based on channel - * information - * @pdev - DP PDEV Handle - * @channel - frequency - * - * Return - Pdev_id mask - */ -static inline -uint8_t dp_get_pdev_mask_for_channel_id(struct dp_pdev *pdev, uint8_t channel) -{ - uint8_t pdev_mask = 0; - - if (!channel) - return 1 << (pdev->pdev_id + 1); - - else if (channel && WLAN_CHAN_IS_5GHZ(channel)) - pdev_mask = 0; - - else if (channel && WLAN_CHAN_IS_2GHZ(channel)) - pdev_mask = 1; - - return 1 << (pdev_mask + 1); -} - /** * dp_h2t_ext_stats_msg_send(): function to contruct HTT message to pass to FW * @pdev: DP PDEV handle @@ -3098,6 +3073,7 @@ uint8_t dp_get_pdev_mask_for_channel_id(struct dp_pdev *pdev, uint8_t channel) * @config_param_1: extra configuration parameters * @config_param_2: extra configuration parameters * @config_param_3: extra configuration parameters + * @mac_id: mac number * * return: QDF STATUS */ @@ -3105,7 +3081,7 @@ QDF_STATUS dp_h2t_ext_stats_msg_send(struct dp_pdev *pdev, uint32_t stats_type_upload_mask, uint32_t config_param_0, uint32_t config_param_1, uint32_t config_param_2, uint32_t config_param_3, int cookie_val, int cookie_msb, - uint8_t channel) + uint8_t mac_id) { struct htt_soc *soc = pdev->soc->htt_handle; struct dp_htt_htc_pkt *pkt; @@ -3127,8 +3103,9 @@ QDF_STATUS dp_h2t_ext_stats_msg_send(struct dp_pdev *pdev, * Bit 2: Pdev stats for pdev id 1 * Bit 3: Pdev stats for pdev id 2 */ - pdev_mask = dp_get_pdev_mask_for_channel_id(pdev, channel); + mac_id = dp_get_mac_id_for_pdev(mac_id, pdev->pdev_id); + pdev_mask = 1 << DP_SW2HW_MACID(mac_id); /* * Set the length of the message. * The contribution from the HTC_HDR_ALIGNMENT_PADDING is added diff --git a/dp/wifi3.0/dp_internal.h b/dp/wifi3.0/dp_internal.h index 53ffbb30cff6..c279eef37b13 100644 --- a/dp/wifi3.0/dp_internal.h +++ b/dp/wifi3.0/dp_internal.h @@ -399,7 +399,7 @@ QDF_STATUS dp_h2t_ext_stats_msg_send(struct dp_pdev *pdev, uint32_t stats_type_upload_mask, uint32_t config_param_0, uint32_t config_param_1, uint32_t config_param_2, uint32_t config_param_3, int cookie, int cookie_msb, - uint8_t channel); + uint8_t mac_id); void dp_htt_stats_print_tag(uint8_t tag_type, uint32_t *tag_buf); void dp_htt_stats_copy_tag(struct dp_pdev *pdev, uint8_t tag_type, uint32_t *tag_buf); void dp_peer_rxtid_stats(struct dp_peer *peer, void (*callback_fn), diff --git a/dp/wifi3.0/dp_main.c b/dp/wifi3.0/dp_main.c index 41b0f0dad73d..daa64d58ce7e 100644 --- a/dp/wifi3.0/dp_main.c +++ b/dp/wifi3.0/dp_main.c @@ -284,6 +284,7 @@ const int dp_stats_mapping_table[][STATS_TYPE_MAX] = { {TXRX_FW_STATS_INVALID, TXRX_RX_HOST_STATS}, {TXRX_FW_STATS_INVALID, TXRX_AST_STATS}, {TXRX_FW_STATS_INVALID, TXRX_SRNG_PTR_STATS}, + {TXRX_FW_STATS_INVALID, TXRX_RX_MON_STATS}, }; static int dp_peer_add_ast_wifi3(struct cdp_soc_t *soc_hdl, @@ -5197,6 +5198,31 @@ dp_print_pdev_rx_stats(struct dp_pdev *pdev) } +/** + * dp_print_pdev_rx_mon_stats(): Print Pdev level RX monitor stats + * @pdev: DP_PDEV Handle + * + * Return: void + */ +static inline void +dp_print_pdev_rx_mon_stats(struct dp_pdev *pdev) +{ + struct cdp_pdev_mon_stats *rx_mon_stats; + + rx_mon_stats = &pdev->rx_mon_stats; + + DP_PRINT_STATS("PDEV Rx Monitor Stats:\n"); + + dp_rx_mon_print_dbg_ppdu_stats(rx_mon_stats); + + DP_PRINT_STATS("status_ppdu_done_cnt = %d", + rx_mon_stats->status_ppdu_done); + DP_PRINT_STATS("dest_ppdu_done_cnt = %d", + rx_mon_stats->dest_ppdu_done); + DP_PRINT_STATS("dest_mpdu_done_cnt = %d", + rx_mon_stats->dest_mpdu_done); +} + /** * dp_print_soc_tx_stats(): Print SOC level stats * @soc DP_SOC Handle @@ -5810,8 +5836,11 @@ dp_print_host_stats(struct cdp_vdev *vdev_handle, enum cdp_host_txrx_stats type) dp_print_peer_table(vdev); break; case TXRX_SRNG_PTR_STATS: - dp_print_ring_stats(pdev); - break; + dp_print_ring_stats(pdev); + break; + case TXRX_RX_MON_STATS: + dp_print_pdev_rx_mon_stats(pdev); + break; default: DP_TRACE(FATAL, "Wrong Input For TxRx Host Stats"); break; @@ -6253,7 +6282,7 @@ static int dp_fw_stats_process(struct cdp_vdev *vdev_handle, struct dp_vdev *vdev = (struct dp_vdev *)vdev_handle; struct dp_pdev *pdev = NULL; uint32_t stats = req->stats; - uint8_t channel = req->channel; + uint8_t mac_id = req->mac_id; if (!vdev) { DP_TRACE(NONE, "VDEV not found"); @@ -6280,7 +6309,7 @@ static int dp_fw_stats_process(struct cdp_vdev *vdev_handle, return dp_h2t_ext_stats_msg_send(pdev, stats, req->param0, req->param1, req->param2, req->param3, - 0, 0, channel); + 0, 0, mac_id); } /** diff --git a/dp/wifi3.0/dp_rx.h b/dp/wifi3.0/dp_rx.h index f1c9d556f193..7d616332cd30 100644 --- a/dp/wifi3.0/dp_rx.h +++ b/dp/wifi3.0/dp_rx.h @@ -672,22 +672,27 @@ static inline bool check_qwrap_multicast_loopback(struct dp_vdev *vdev, { struct dp_vdev *psta_vdev; struct dp_pdev *pdev = vdev->pdev; + struct dp_soc *soc = pdev->soc; uint8_t *data = qdf_nbuf_data(nbuf); + uint8_t i; - if (qdf_unlikely(vdev->proxysta_vdev)) { - /* In qwrap isolation mode, allow loopback packets as all - * packets go to RootAP and Loopback on the mpsta. - */ - if (vdev->isolation_vdev) - return false; - TAILQ_FOREACH(psta_vdev, &pdev->vdev_list, vdev_list_elem) { - if (qdf_unlikely(psta_vdev->proxysta_vdev && - !qdf_mem_cmp(psta_vdev->mac_addr.raw, - &data[DP_MAC_ADDR_LEN], DP_MAC_ADDR_LEN))) { - /* Drop packet if source address is equal to - * any of the vdev addresses. - */ - return true; + for (i = 0; i < MAX_PDEV_CNT && soc->pdev_list[i]; i++) { + pdev = soc->pdev_list[i]; + if (qdf_unlikely(vdev->proxysta_vdev)) { + /* In qwrap isolation mode, allow loopback packets as all + * packets go to RootAP and Loopback on the mpsta. + */ + if (vdev->isolation_vdev) + return false; + TAILQ_FOREACH(psta_vdev, &pdev->vdev_list, vdev_list_elem) { + if (qdf_unlikely(psta_vdev->proxysta_vdev && + !qdf_mem_cmp(psta_vdev->mac_addr.raw, + &data[DP_MAC_ADDR_LEN], DP_MAC_ADDR_LEN))) { + /* Drop packet if source address is equal to + * any of the vdev addresses. + */ + return true; + } } } } diff --git a/dp/wifi3.0/dp_rx_mon.h b/dp/wifi3.0/dp_rx_mon.h index 52fb06437de8..8269c3445026 100644 --- a/dp/wifi3.0/dp_rx_mon.h +++ b/dp/wifi3.0/dp_rx_mon.h @@ -50,4 +50,101 @@ QDF_STATUS dp_rx_mon_deliver(struct dp_soc *soc, uint32_t mac_id, uint32_t dp_rxdma_err_process(struct dp_soc *soc, uint32_t mac_id, uint32_t quota); + +#ifndef REMOVE_MON_DBG_STATS +/* + * dp_rx_mon_update_dbg_ppdu_stats() - Update status ring TLV count + * @ppdu_info: HAL RX PPDU info retrieved from status ring TLV + * @rx_mon_stats: monitor mode status/destination ring PPDU and MPDU count + * + * Update status ring PPDU start and end count. Keep track TLV state on + * PPDU start and end to find out if start and end is matching. Keep + * track missing PPDU start and end count. Keep track matching PPDU + * start and end count. + * + * Return: None + */ +static inline void +dp_rx_mon_update_dbg_ppdu_stats(struct hal_rx_ppdu_info *ppdu_info, + struct cdp_pdev_mon_stats *rx_mon_stats) +{ + if (ppdu_info->rx_state == + HAL_RX_MON_PPDU_START) { + rx_mon_stats->status_ppdu_start++; + if (rx_mon_stats->status_ppdu_state + != CDP_MON_PPDU_END) + rx_mon_stats->status_ppdu_end_mis++; + rx_mon_stats->status_ppdu_state + = CDP_MON_PPDU_START; + } else if (ppdu_info->rx_state == + HAL_RX_MON_PPDU_END) { + rx_mon_stats->status_ppdu_end++; + if (rx_mon_stats->status_ppdu_state + != CDP_MON_PPDU_START) + rx_mon_stats->status_ppdu_start_mis++; + else + rx_mon_stats->status_ppdu_compl++; + rx_mon_stats->status_ppdu_state + = CDP_MON_PPDU_END; + } +} + +/* + * dp_rx_mon_init_dbg_ppdu_stats() - initialization for monitor mode stats + * @ppdu_info: HAL RX PPDU info retrieved from status ring TLV + * @rx_mon_stats: monitor mode status/destination ring PPDU and MPDU count + * + * Return: None + */ +static inline void +dp_rx_mon_init_dbg_ppdu_stats(struct hal_rx_ppdu_info *ppdu_info, + struct cdp_pdev_mon_stats *rx_mon_stats) +{ + ppdu_info->rx_state = HAL_RX_MON_PPDU_END; + rx_mon_stats->status_ppdu_state + = CDP_MON_PPDU_END; +} + +/* + * dp_rx_mon_dbg_dbg_ppdu_stats() - Print monitor mode status ring stats + * @ppdu_info: HAL RX PPDU info retrieved from status ring TLV + * @rx_mon_stats: monitor mode status/destination ring PPDU and MPDU count + * + * Print monitor mode PPDU start and end TLV count + * Return: None + */ +static inline void +dp_rx_mon_print_dbg_ppdu_stats(struct cdp_pdev_mon_stats *rx_mon_stats) +{ + DP_PRINT_STATS("status_ppdu_compl_cnt = %d", + rx_mon_stats->status_ppdu_compl); + DP_PRINT_STATS("status_ppdu_start_cnt = %d", + rx_mon_stats->status_ppdu_start); + DP_PRINT_STATS("status_ppdu_end_cnt = %d", + rx_mon_stats->status_ppdu_end); + DP_PRINT_STATS("status_ppdu_start_mis_cnt = %d", + rx_mon_stats->status_ppdu_start_mis); + DP_PRINT_STATS("status_ppdu_end_mis_cnt = %d", + rx_mon_stats->status_ppdu_end_mis); +} + +#else +static inline void +dp_rx_mon_update_dbg_ppdu_stats(struct hal_rx_ppdu_info *ppdu_info, + struct cdp_pdev_mon_stats *rx_mon_stats) +{ +} + +static inline void +dp_rx_mon_init_dbg_ppdu_stats(struct hal_rx_ppdu_info *ppdu_info, + struct cdp_pdev_mon_stats *rx_mon_stats) +{ +} + +static inline void +dp_rx_mon_print_dbg_ppdu_stats(struct hal_rx_ppdu_info *ppdu_info, + struct cdp_pdev_mon_stats *rx_mon_stats) +{ +} +#endif #endif diff --git a/dp/wifi3.0/dp_rx_mon_dest.c b/dp/wifi3.0/dp_rx_mon_dest.c index a3408e52a397..d3401db9dfe4 100644 --- a/dp/wifi3.0/dp_rx_mon_dest.c +++ b/dp/wifi3.0/dp_rx_mon_dest.c @@ -742,6 +742,7 @@ void dp_rx_mon_dest_process(struct dp_soc *soc, uint32_t mac_id, uint32_t quota) uint32_t ppdu_id; uint32_t rx_bufs_used; int mac_for_pdev = dp_get_mac_id_for_mac(soc, mac_id); + struct cdp_pdev_mon_stats *rx_mon_stats; mon_dst_srng = pdev->rxdma_mon_dst_ring[mac_for_pdev].hal_srng; @@ -771,6 +772,7 @@ void dp_rx_mon_dest_process(struct dp_soc *soc, uint32_t mac_id, uint32_t quota) ppdu_id = pdev->ppdu_info.com_info.ppdu_id; rx_bufs_used = 0; + rx_mon_stats = &pdev->rx_mon_stats; while (qdf_likely(rxdma_dst_ring_desc = hal_srng_dst_peek(hal_soc, mon_dst_srng))) { @@ -804,6 +806,8 @@ void dp_rx_mon_dest_process(struct dp_soc *soc, uint32_t mac_id, uint32_t quota) __func__, __LINE__); break; } + + rx_mon_stats->dest_mpdu_done++; dp_rx_mon_deliver(soc, mac_id, head_msdu, tail_msdu); rxdma_dst_ring_desc = hal_srng_dst_get_next(hal_soc, @@ -814,6 +818,7 @@ void dp_rx_mon_dest_process(struct dp_soc *soc, uint32_t mac_id, uint32_t quota) qdf_spin_unlock_bh(&pdev->mon_lock); if (rx_bufs_used) { + rx_mon_stats->dest_ppdu_done++; dp_rx_buffers_replenish(soc, mac_id, &pdev->rxdma_mon_buf_ring[mac_for_pdev], &soc->rx_desc_mon[mac_id], rx_bufs_used, &head, &tail); diff --git a/dp/wifi3.0/dp_rx_mon_status.c b/dp/wifi3.0/dp_rx_mon_status.c index 20d022bfb8d5..70431df62c8b 100644 --- a/dp/wifi3.0/dp_rx_mon_status.c +++ b/dp/wifi3.0/dp_rx_mon_status.c @@ -332,8 +332,10 @@ dp_rx_mon_status_process_tlv(struct dp_soc *soc, uint32_t mac_id, uint8_t *rx_tlv_start; uint32_t tlv_status = HAL_TLV_STATUS_BUF_DONE; QDF_STATUS m_copy_status = QDF_STATUS_SUCCESS; + struct cdp_pdev_mon_stats *rx_mon_stats; ppdu_info = &pdev->ppdu_info; + rx_mon_stats = &pdev->rx_mon_stats; if (pdev->mon_ppdu_status != DP_PPDU_STATUS_START) return; @@ -356,6 +358,10 @@ dp_rx_mon_status_process_tlv(struct dp_soc *soc, uint32_t mac_id, do { tlv_status = hal_rx_status_get_tlv_info(rx_tlv, ppdu_info); + + dp_rx_mon_update_dbg_ppdu_stats(ppdu_info, + rx_mon_stats); + rx_tlv = hal_rx_status_get_next_tlv(rx_tlv); if ((rx_tlv - rx_tlv_start) >= RX_BUFFER_SIZE) @@ -374,6 +380,7 @@ dp_rx_mon_status_process_tlv(struct dp_soc *soc, uint32_t mac_id, } if (tlv_status == HAL_TLV_STATUS_PPDU_DONE) { + rx_mon_stats->status_ppdu_done++; if (pdev->enhanced_stats_en || pdev->mcopy_mode) dp_rx_handle_ppdu_stats(soc, pdev, ppdu_info); @@ -831,8 +838,15 @@ dp_rx_pdev_mon_status_attach(struct dp_pdev *pdev, int ring_id) { pdev->mon_ppdu_status = DP_PPDU_STATUS_START; pdev->ppdu_info.com_info.last_ppdu_id = 0; + qdf_mem_zero(&(pdev->ppdu_info.rx_status), sizeof(pdev->ppdu_info.rx_status)); + qdf_mem_zero(&pdev->rx_mon_stats, + sizeof(pdev->rx_mon_stats)); + + dp_rx_mon_init_dbg_ppdu_stats(&pdev->ppdu_info, + &pdev->rx_mon_stats); + return QDF_STATUS_SUCCESS; } diff --git a/dp/wifi3.0/dp_types.h b/dp/wifi3.0/dp_types.h index 99adf72beec2..18dd6c038011 100644 --- a/dp/wifi3.0/dp_types.h +++ b/dp/wifi3.0/dp_types.h @@ -1102,6 +1102,8 @@ struct dp_pdev { qdf_nbuf_queue_t rx_status_q; uint32_t mon_ppdu_status; struct cdp_mon_status rx_mon_recv_status; + /* monitor mode status/destination ring PPDU and MPDU count */ + struct cdp_pdev_mon_stats rx_mon_stats; /* pool addr for mcast enhance buff */ struct { diff --git a/hal/wifi3.0/hal_api_mon.h b/hal/wifi3.0/hal_api_mon.h index 1b8454c501fb..9388f64515e0 100644 --- a/hal/wifi3.0/hal_api_mon.h +++ b/hal/wifi3.0/hal_api_mon.h @@ -388,6 +388,16 @@ enum { HAL_RX_TYPE_MU_OFDMA_MIMO, }; +/** + * enum + * @HAL_RX_MON_PPDU_START: PPDU start TLV is decoded in HAL + * @HAL_RX_MON_PPDU_END: PPDU end TLV is decided in HAL + */ +enum { + HAL_RX_MON_PPDU_START = 0, + HAL_RX_MON_PPDU_END, +}; + /** * hal_rx_mon_hw_desc_get_mpdu_status: Retrieve MPDU status * @@ -450,6 +460,8 @@ struct hal_rx_ppdu_info { struct hal_rx_ppdu_user_info user_info[HAL_MAX_UL_MU_USERS]; struct mon_rx_status rx_status; struct hal_rx_msdu_payload_info msdu_info; + /* status ring PPDU start and end state */ + uint32_t rx_state; }; static inline uint32_t @@ -508,6 +520,7 @@ hal_rx_status_get_tlv_info(void *rx_tlv, struct hal_rx_ppdu_info *ppdu_info) ppdu_info->com_info.ppdu_timestamp = HAL_RX_GET(rx_tlv, RX_PPDU_START_2, PPDU_START_TIMESTAMP); + ppdu_info->rx_state = HAL_RX_MON_PPDU_START; break; case WIFIRX_PPDU_START_USER_INFO_E: @@ -518,6 +531,7 @@ hal_rx_status_get_tlv_info(void *rx_tlv, struct hal_rx_ppdu_info *ppdu_info) "[%s][%d] ppdu_end_e len=%d", __func__, __LINE__, tlv_len); /* This is followed by sub-TLVs of PPDU_END */ + ppdu_info->rx_state = HAL_RX_MON_PPDU_END; break; case WIFIRXPCU_PPDU_END_INFO_E: diff --git a/init_deinit/dispatcher/src/dispatcher_init_deinit.c b/init_deinit/dispatcher/src/dispatcher_init_deinit.c index 6eb06b6ba9b9..f7ca4271b198 100644 --- a/init_deinit/dispatcher/src/dispatcher_init_deinit.c +++ b/init_deinit/dispatcher/src/dispatcher_init_deinit.c @@ -77,6 +77,10 @@ #include #endif +#ifdef QCA_SUPPORT_CP_STATS +#include +#endif + /** * DOC: This file provides various init/deinit trigger point for new * components. @@ -89,6 +93,68 @@ spectral_pdev_open_handler dispatcher_spectral_pdev_open_handler_cb; +#ifdef QCA_SUPPORT_CP_STATS +static QDF_STATUS dispatcher_init_cp_stats(void) +{ + return wlan_cp_stats_init(); +} + +static QDF_STATUS dispatcher_deinit_cp_stats(void) +{ + return wlan_cp_stats_deinit(); +} + +static QDF_STATUS cp_stats_psoc_open(struct wlan_objmgr_psoc *psoc) +{ + return wlan_cp_stats_open(psoc); +} + +static QDF_STATUS cp_stats_psoc_close(struct wlan_objmgr_psoc *psoc) +{ + return wlan_cp_stats_close(psoc); +} + +static QDF_STATUS cp_stats_psoc_enable(struct wlan_objmgr_psoc *psoc) +{ + return wlan_cp_stats_enable(psoc); +} + +static QDF_STATUS cp_stats_psoc_disable(struct wlan_objmgr_psoc *psoc) +{ + return wlan_cp_stats_disable(psoc); +} +#else +static QDF_STATUS dispatcher_init_cp_stats(void) +{ + return QDF_STATUS_SUCCESS; +} + +static QDF_STATUS dispatcher_deinit_cp_stats(void) +{ + return QDF_STATUS_SUCCESS; +} + +static QDF_STATUS cp_stats_psoc_open(struct wlan_objmgr_psoc *psoc) +{ + return QDF_STATUS_SUCCESS; +} + +static QDF_STATUS cp_stats_psoc_close(struct wlan_objmgr_psoc *psoc) +{ + return QDF_STATUS_SUCCESS; +} + +static QDF_STATUS cp_stats_psoc_enable(struct wlan_objmgr_psoc *psoc) +{ + return QDF_STATUS_SUCCESS; +} + +static QDF_STATUS cp_stats_psoc_disable(struct wlan_objmgr_psoc *psoc) +{ + return QDF_STATUS_SUCCESS; +} +#endif + #ifdef CONVERGED_P2P_ENABLE static QDF_STATUS p2p_init(void) { @@ -835,6 +901,9 @@ QDF_STATUS dispatcher_init(void) if (QDF_STATUS_SUCCESS != dispatcher_policy_mgr_init()) goto policy_mgr_init_fail; + if (QDF_STATUS_SUCCESS != dispatcher_init_cp_stats()) + goto cp_stats_init_fail; + if (QDF_STATUS_SUCCESS != dispatcher_init_atf()) goto atf_init_fail; @@ -911,6 +980,8 @@ wifi_pos_init_fail: sa_api_init_fail: dispatcher_deinit_atf(); atf_init_fail: + dispatcher_deinit_cp_stats(); +cp_stats_init_fail: dispatcher_policy_mgr_deinit(); policy_mgr_init_fail: dispatcher_deinit_crypto(); @@ -962,6 +1033,8 @@ QDF_STATUS dispatcher_deinit(void) QDF_BUG(QDF_STATUS_SUCCESS == dispatcher_deinit_atf()); + QDF_BUG(QDF_STATUS_SUCCESS == dispatcher_deinit_cp_stats()); + QDF_BUG(QDF_STATUS_SUCCESS == dispatcher_policy_mgr_deinit()); QDF_BUG(QDF_STATUS_SUCCESS == dispatcher_deinit_crypto()); @@ -1017,6 +1090,9 @@ QDF_STATUS dispatcher_psoc_open(struct wlan_objmgr_psoc *psoc) if (QDF_STATUS_SUCCESS != wlan_serialization_psoc_open(psoc)) goto serialization_psoc_open_fail; + if (QDF_STATUS_SUCCESS != cp_stats_psoc_open(psoc)) + goto cp_stats_psoc_open_fail; + if (QDF_STATUS_SUCCESS != atf_psoc_open(psoc)) goto atf_psoc_open_fail; @@ -1043,6 +1119,8 @@ regulatory_psoc_open_fail: policy_mgr_psoc_open_fail: atf_psoc_close(psoc); atf_psoc_open_fail: + cp_stats_psoc_close(psoc); +cp_stats_psoc_open_fail: wlan_serialization_psoc_close(psoc); serialization_psoc_open_fail: tdls_psoc_close(psoc); @@ -1070,6 +1148,8 @@ QDF_STATUS dispatcher_psoc_close(struct wlan_objmgr_psoc *psoc) QDF_BUG(QDF_STATUS_SUCCESS == atf_psoc_close(psoc)); + QDF_BUG(QDF_STATUS_SUCCESS == cp_stats_psoc_close(psoc)); + QDF_BUG(QDF_STATUS_SUCCESS == wlan_serialization_psoc_close(psoc)); QDF_BUG(QDF_STATUS_SUCCESS == tdls_psoc_close(psoc)); @@ -1101,6 +1181,9 @@ QDF_STATUS dispatcher_psoc_enable(struct wlan_objmgr_psoc *psoc) if (QDF_STATUS_SUCCESS != sa_api_psoc_enable(psoc)) goto sa_api_psoc_enable_fail; + if (QDF_STATUS_SUCCESS != cp_stats_psoc_enable(psoc)) + goto cp_stats_psoc_enable_fail; + if (QDF_STATUS_SUCCESS != atf_psoc_enable(psoc)) goto atf_psoc_enable_fail; @@ -1132,6 +1215,8 @@ nan_psoc_enable_fail: wifi_pos_psoc_enable_fail: atf_psoc_disable(psoc); atf_psoc_enable_fail: + cp_stats_psoc_disable(psoc); +cp_stats_psoc_enable_fail: sa_api_psoc_disable(psoc); sa_api_psoc_enable_fail: dispatcher_policy_mgr_psoc_disable(psoc); @@ -1161,6 +1246,8 @@ QDF_STATUS dispatcher_psoc_disable(struct wlan_objmgr_psoc *psoc) QDF_BUG(QDF_STATUS_SUCCESS == atf_psoc_disable(psoc)); + QDF_BUG(QDF_STATUS_SUCCESS == cp_stats_psoc_disable(psoc)); + QDF_BUG(QDF_STATUS_SUCCESS == sa_api_psoc_disable(psoc)); QDF_BUG(QDF_STATUS_SUCCESS == diff --git a/os_if/linux/nan/inc/os_if_nan.h b/os_if/linux/nan/inc/os_if_nan.h index 151c457bbfc5..338ea7462d45 100644 --- a/os_if/linux/nan/inc/os_if_nan.h +++ b/os_if/linux/nan/inc/os_if_nan.h @@ -32,91 +32,6 @@ struct wlan_objmgr_vdev; #ifdef WLAN_FEATURE_NAN_CONVERGENCE -/** - * enum qca_wlan_vendor_attr_ndp_params - vendor attribute parameters - * @QCA_WLAN_VENDOR_ATTR_NDP_SUBCMD: NDP Sub command - * @QCA_WLAN_VENDOR_ATTR_NDP_TRANSACTION_ID: Transaction id reference - * @QCA_WLAN_VENDOR_ATTR_NDP_STATUS_ID: NDP status id - * @QCA_WLAN_VENDOR_ATTR_NDP_SERVICE_INSTANCE_ID: Service instance id - * @QCA_WLAN_VENDOR_ATTR_NDP_CHANNEL: Requested channel - * @QCA_WLAN_VENDOR_ATTR_NDP_PEER_DISCOVERY_MAC_ADDR: Peer discovery mac addr - * @QCA_WLAN_VENDOR_ATTR_NDP_IFACE_STR: Iface name - * @QCA_WLAN_VENDOR_ATTR_NDP_CONFIG_SECURITY: Security configuration - * @QCA_WLAN_VENDOR_ATTR_NDP_CONFIG_QOS: Qos configuration - * @QCA_WLAN_VENDOR_ATTR_NDP_APP_INFO: Application info - * @QCA_WLAN_VENDOR_ATTR_NDP_INSTANCE_ID: NDP instance id - * @QCA_WLAN_VENDOR_ATTR_NDP_INSTANCE_ID_ARRAY: NDP instance id array - * @QCA_WLAN_VENDOR_ATTR_NDP_RESPONSE_CODE: Schedule response - * @QCA_WLAN_VENDOR_ATTR_NDP_NDI_MAC_ADDR: NDI mac address - * @QCA_WLAN_VENDOR_ATTR_NDP_DRV_RESPONSE_STATUS_TYPE: Driver return status - * @QCA_WLAN_VENDOR_ATTR_NDP_DRV_RETURN_VALUE: Driver return value - * @QCA_WLAN_VENDOR_ATTR_NDP_CHANNEL_CONFIG: Channel config request type - * @QCA_WLAN_VENDOR_ATTR_NDP_NCS_SK_TYPE: Cipher Suit ID - * @QCA_WLAN_VENDOR_ATTR_NDP_PMK: Pairwise Master Key - * @QCA_WLAN_VENDOR_ATTR_NDP_SCID: Security Context ID - * @QCA_WLAN_VENDOR_ATTR_NDP_PASSPHRASE - pass phrase - * @QCA_WLAN_VENDOR_ATTR_NDP_SERVICE_NAME - service name - */ -enum qca_wlan_vendor_attr_ndp_params { - QCA_WLAN_VENDOR_ATTR_NDP_PARAM_INVALID = 0, - QCA_WLAN_VENDOR_ATTR_NDP_SUBCMD, - QCA_WLAN_VENDOR_ATTR_NDP_TRANSACTION_ID, - QCA_WLAN_VENDOR_ATTR_NDP_SERVICE_INSTANCE_ID, - QCA_WLAN_VENDOR_ATTR_NDP_CHANNEL, - QCA_WLAN_VENDOR_ATTR_NDP_PEER_DISCOVERY_MAC_ADDR, - QCA_WLAN_VENDOR_ATTR_NDP_IFACE_STR, - /* CONFIG_SECURITY is deprecated, use NCS_SK_TYPE/PMK/SCID instead */ - QCA_WLAN_VENDOR_ATTR_NDP_CONFIG_SECURITY, - QCA_WLAN_VENDOR_ATTR_NDP_CONFIG_QOS, - QCA_WLAN_VENDOR_ATTR_NDP_APP_INFO, - QCA_WLAN_VENDOR_ATTR_NDP_INSTANCE_ID, - QCA_WLAN_VENDOR_ATTR_NDP_INSTANCE_ID_ARRAY, - QCA_WLAN_VENDOR_ATTR_NDP_RESPONSE_CODE, - QCA_WLAN_VENDOR_ATTR_NDP_NDI_MAC_ADDR, - QCA_WLAN_VENDOR_ATTR_NDP_DRV_RESPONSE_STATUS_TYPE, - QCA_WLAN_VENDOR_ATTR_NDP_DRV_RETURN_VALUE, - QCA_WLAN_VENDOR_ATTR_NDP_CHANNEL_CONFIG, - QCA_WLAN_VENDOR_ATTR_NDP_NCS_SK_TYPE, - QCA_WLAN_VENDOR_ATTR_NDP_PMK, - QCA_WLAN_VENDOR_ATTR_NDP_SCID, - QCA_WLAN_VENDOR_ATTR_NDP_PASSPHRASE, - QCA_WLAN_VENDOR_ATTR_NDP_SERVICE_NAME, - - QCA_WLAN_VENDOR_ATTR_NDP_PARAMS_AFTER_LAST, - QCA_WLAN_VENDOR_ATTR_NDP_PARAMS_MAX = - QCA_WLAN_VENDOR_ATTR_NDP_PARAMS_AFTER_LAST - 1, -}; - -/** - * enum qca_wlan_vendor_attr_ndp_sub_cmd_value - NDP subcmd value - * @QCA_WLAN_VENDOR_ATTR_NDP_INVALID: Unused subcmd value - * @QCA_WLAN_VENDOR_ATTR_NDP_INTERFACE_CREATE: iface create - * @QCA_WLAN_VENDOR_ATTR_NDP_INTERFACE_DELETE: iface delete - * @QCA_WLAN_VENDOR_ATTR_NDP_INITIATOR_REQUEST: NDP initiator request - * @QCA_WLAN_VENDOR_ATTR_NDP_INITIATOR_RESPONSE: NDP initiator response - * @QCA_WLAN_VENDOR_ATTR_NDP_RESPONDER_REQUEST: NDP responder request - * @QCA_WLAN_VENDOR_ATTR_NDP_RESPONDER_RESPONSE: NDP responder response - * @QCA_WLAN_VENDOR_ATTR_NDP_END_REQUEST: NDP end request - * @QCA_WLAN_VENDOR_ATTR_NDP_END_RESPONSE: NDP end response - * @QCA_WLAN_VENDOR_ATTR_NDP_REQUEST_IND: NDP request indication - * @QCA_WLAN_VENDOR_ATTR_NDP_CONFIRM_IND: NDP confirm indication - * @QCA_WLAN_VENDOR_ATTR_NDP_END_IND: NDP End indication - */ -enum qca_wlan_vendor_attr_ndp_sub_cmd_value { - QCA_WLAN_VENDOR_ATTR_NDP_INVALID = 0, - QCA_WLAN_VENDOR_ATTR_NDP_INTERFACE_CREATE = 1, - QCA_WLAN_VENDOR_ATTR_NDP_INTERFACE_DELETE = 2, - QCA_WLAN_VENDOR_ATTR_NDP_INITIATOR_REQUEST = 3, - QCA_WLAN_VENDOR_ATTR_NDP_INITIATOR_RESPONSE = 4, - QCA_WLAN_VENDOR_ATTR_NDP_RESPONDER_REQUEST = 5, - QCA_WLAN_VENDOR_ATTR_NDP_RESPONDER_RESPONSE = 6, - QCA_WLAN_VENDOR_ATTR_NDP_END_REQUEST = 7, - QCA_WLAN_VENDOR_ATTR_NDP_END_RESPONSE = 8, - QCA_WLAN_VENDOR_ATTR_NDP_REQUEST_IND = 9, - QCA_WLAN_VENDOR_ATTR_NDP_CONFIRM_IND = 10, - QCA_WLAN_VENDOR_ATTR_NDP_END_IND = 11 -}; - /** * os_if_nan_process_ndp_cmd: os_if api to handle nan request message * @psoc: pointer to psoc object diff --git a/os_if/linux/nan/src/os_if_nan.c b/os_if/linux/nan/src/os_if_nan.c index b696cb8b8535..fc06c42f0a11 100644 --- a/os_if/linux/nan/src/os_if_nan.c +++ b/os_if/linux/nan/src/os_if_nan.c @@ -59,7 +59,7 @@ vendor_attr_policy[QCA_WLAN_VENDOR_ATTR_NDP_PARAMS_MAX + 1] = { .len = sizeof(uint32_t) }, [QCA_WLAN_VENDOR_ATTR_NDP_PEER_DISCOVERY_MAC_ADDR] = { - .type = NLA_BINARY, + .type = NLA_UNSPEC, .len = QDF_MAC_ADDR_SIZE }, [QCA_WLAN_VENDOR_ATTR_NDP_CONFIG_SECURITY] = { @@ -67,8 +67,8 @@ vendor_attr_policy[QCA_WLAN_VENDOR_ATTR_NDP_PARAMS_MAX + 1] = { .len = sizeof(uint16_t) }, [QCA_WLAN_VENDOR_ATTR_NDP_CONFIG_QOS] = { - .type = NLA_BINARY, - .len = NDP_QOS_INFO_LEN + .type = NLA_U32, + .len = sizeof(uint32_t) }, [QCA_WLAN_VENDOR_ATTR_NDP_APP_INFO] = { .type = NLA_BINARY, @@ -79,8 +79,8 @@ vendor_attr_policy[QCA_WLAN_VENDOR_ATTR_NDP_PARAMS_MAX + 1] = { .len = sizeof(uint32_t) }, [QCA_WLAN_VENDOR_ATTR_NDP_RESPONSE_CODE] = { - .type = NLA_U16, - .len = sizeof(uint16_t) + .type = NLA_U32, + .len = sizeof(uint32_t) }, [QCA_WLAN_VENDOR_ATTR_NDP_NDI_MAC_ADDR] = { .type = NLA_BINARY, @@ -94,7 +94,7 @@ vendor_attr_policy[QCA_WLAN_VENDOR_ATTR_NDP_PARAMS_MAX + 1] = { .type = NLA_U32, .len = sizeof(uint32_t) }, - [QCA_WLAN_VENDOR_ATTR_NDP_NCS_SK_TYPE] = { + [QCA_WLAN_VENDOR_ATTR_NDP_CSID] = { .type = NLA_U32, .len = sizeof(uint32_t) }, @@ -252,9 +252,9 @@ static int os_if_nan_parse_security_params(struct nlattr **tb, return -EINVAL; } - if (tb[QCA_WLAN_VENDOR_ATTR_NDP_NCS_SK_TYPE]) { + if (tb[QCA_WLAN_VENDOR_ATTR_NDP_CSID]) { *ncs_sk_type = - nla_get_u32(tb[QCA_WLAN_VENDOR_ATTR_NDP_NCS_SK_TYPE]); + nla_get_u32(tb[QCA_WLAN_VENDOR_ATTR_NDP_CSID]); } if (tb[QCA_WLAN_VENDOR_ATTR_NDP_PMK]) { @@ -309,7 +309,7 @@ static int os_if_nan_parse_security_params(struct nlattr **tb, * QCA_WLAN_VENDOR_ATTR_NDP_APP_INFO - optional * QCA_WLAN_VENDOR_ATTR_NDP_CONFIG_QOS - optional * QCA_WLAN_VENDOR_ATTR_NDP_PMK - optional - * QCA_WLAN_VENDOR_ATTR_NDP_NCS_SK_TYPE - optional + * QCA_WLAN_VENDOR_ATTR_NDP_CSID - optional * QCA_WLAN_VENDOR_ATTR_NDP_PASSPHRASE - optional * QCA_WLAN_VENDOR_ATTR_NDP_SERVICE_NAME - optional * @@ -441,7 +441,7 @@ initiator_req_failed: * QCA_WLAN_VENDOR_ATTR_NDP_APP_INFO - optional * QCA_WLAN_VENDOR_ATTR_NDP_CONFIG_QOS - optional * QCA_WLAN_VENDOR_ATTR_NDP_PMK - optional - * QCA_WLAN_VENDOR_ATTR_NDP_NCS_SK_TYPE - optional + * QCA_WLAN_VENDOR_ATTR_NDP_CSID - optional * QCA_WLAN_VENDOR_ATTR_NDP_PASSPHRASE - optional * QCA_WLAN_VENDOR_ATTR_NDP_SERVICE_NAME - optional * @@ -866,7 +866,7 @@ static inline uint32_t osif_ndp_get_ndp_req_ind_len( data_len += nla_total_size(vendor_attr_policy[ QCA_WLAN_VENDOR_ATTR_NDP_CONFIG_QOS].len); data_len += nla_total_size(vendor_attr_policy[ - QCA_WLAN_VENDOR_ATTR_NDP_NCS_SK_TYPE].len); + QCA_WLAN_VENDOR_ATTR_NDP_CSID].len); /* allocate space including NULL terminator */ data_len += nla_total_size(vendor_attr_policy[ QCA_WLAN_VENDOR_ATTR_NDP_IFACE_STR].len + 1); @@ -897,7 +897,7 @@ static inline uint32_t osif_ndp_get_ndp_req_ind_len( * QCA_WLAN_VENDOR_ATTR_NDP_INSTANCE_ID (4 bytes) * QCA_WLAN_VENDOR_ATTR_NDP_APP_INFO (ndp_app_info_len size) * QCA_WLAN_VENDOR_ATTR_NDP_CONFIG_QOS (4 bytes) - * QCA_WLAN_VENDOR_ATTR_NDP_NCS_SK_TYPE(4 bytes) + * QCA_WLAN_VENDOR_ATTR_NDP_CSID(4 bytes) * QCA_WLAN_VENDOR_ATTR_NDP_SCID(scid_len in size) * * Return: none @@ -997,7 +997,7 @@ static void os_if_ndp_indication_handler(struct wlan_objmgr_vdev *vdev, if (event->scid.scid_len) { if (nla_put_u32(vendor_event, - QCA_WLAN_VENDOR_ATTR_NDP_NCS_SK_TYPE, + QCA_WLAN_VENDOR_ATTR_NDP_CSID, event->ncs_sk_type)) goto ndp_indication_nla_failed; diff --git a/os_if/linux/qca_vendor.h b/os_if/linux/qca_vendor.h index 373b33b003b3..7749854c3f51 100644 --- a/os_if/linux/qca_vendor.h +++ b/os_if/linux/qca_vendor.h @@ -3557,6 +3557,123 @@ enum qca_wlan_vendor_attr_rssi_monitoring { QCA_WLAN_VENDOR_ATTR_RSSI_MONITORING_AFTER_LAST - 1, }; +/** + * enum qca_wlan_vendor_attr_ndp_params - Used by the vendor command + * QCA_NL80211_VENDOR_SUBCMD_NDP. + * @QCA_WLAN_VENDOR_ATTR_NDP_PARAM_INVALID + * @QCA_WLAN_VENDOR_ATTR_NDP_SUBCMD: sub commands values in qca_wlan_ndp_sub_cmd + * @QCA_WLAN_VENDOR_ATTR_NDP_TRANSACTION_ID: + * @QCA_WLAN_VENDOR_ATTR_NDP_SERVICE_INSTANCE_ID: indicats a service info + * @QCA_WLAN_VENDOR_ATTR_NDP_CHANNEL: channel frequency in MHz + * @QCA_WLAN_VENDOR_ATTR_NDP_PEER_DISCOVERY_MAC_ADDR: Interface Discovery MAC + * address + * @QCA_WLAN_VENDOR_ATTR_NDP_IFACE_STR: Interface name on which NDP is being + * created + * @QCA_WLAN_VENDOR_ATTR_NDP_CONFIG_SECURITY: CONFIG_SECURITY is deprecated, use + * NCS_SK_TYPE/PMK/SCID instead + * @QCA_WLAN_VENDOR_ATTR_NDP_CONFIG_QOS: value for QoS + * @QCA_WLAN_VENDOR_ATTR_NDP_APP_INFO: app info + * @QCA_WLAN_VENDOR_ATTR_NDP_INSTANCE_ID: NDP instance Id + * @QCA_WLAN_VENDOR_ATTR_NDP_INSTANCE_ID_ARRAY: Array of instance Ids + * @QCA_WLAN_VENDOR_ATTR_NDP_RESPONSE_CODE: initiator/responder NDP response + * code: accept/reject + * @QCA_WLAN_VENDOR_ATTR_NDP_NDI_MAC_ADDR: NDI MAC address + * @QCA_WLAN_VENDOR_ATTR_NDP_DRV_RESPONSE_STATUS_TYPE: errors types returned by + * driver + * @QCA_WLAN_VENDOR_ATTR_NDP_DRV_RETURN_VALUE: value error values returned by + * driver + * @QCA_WLAN_VENDOR_ATTR_NDP_CHANNEL_CONFIG: Channel setup configuration + * @QCA_WLAN_VENDOR_ATTR_NDP_CSID: Cipher Suite Shared Key Type + * @QCA_WLAN_VENDOR_ATTR_NDP_PMK: PMK_INFO + * @QCA_WLAN_VENDOR_ATTR_NDP_SCID: Security Context Identifier that contains the + * PMKID + * @QCA_WLAN_VENDOR_ATTR_NDP_PASSPHRASE: passphrase + * @QCA_WLAN_VENDOR_ATTR_NDP_SERVICE_NAME: service name + * @QCA_WLAN_VENDOR_ATTR_NDP_SCHEDULE_UPDATE_REASON: bitmap indicating schedule + * update: + * BIT_0: NSS Update + * BIT_1: Channel list update + * @QCA_WLAN_VENDOR_ATTR_NDP_NSS: nss + * @QCA_WLAN_VENDOR_ATTR_NDP_NUM_CHANNELS: NUMBER NDP CHANNEL + * @QCA_WLAN_VENDOR_ATTR_NDP_CHANNEL_WIDTH: CHANNEL BANDWIDTH: + * 0:20 MHz, + * 1:40 MHz, + * 2:80 MHz, + * 3:160 MHz + * @QCA_WLAN_VENDOR_ATTR_NDP_CHANNEL_INFO: Array of channel/band width + * @QCA_WLAN_VENDOR_ATTR_NDP_PARAMS_AFTER_LAST: id after last valid attribute + * @QCA_WLAN_VENDOR_ATTR_NDP_PARAMS_MAX: max value of this enum type +*/ +enum qca_wlan_vendor_attr_ndp_params { + QCA_WLAN_VENDOR_ATTR_NDP_PARAM_INVALID = 0, + QCA_WLAN_VENDOR_ATTR_NDP_SUBCMD, + QCA_WLAN_VENDOR_ATTR_NDP_TRANSACTION_ID, + QCA_WLAN_VENDOR_ATTR_NDP_SERVICE_INSTANCE_ID, + QCA_WLAN_VENDOR_ATTR_NDP_CHANNEL, + QCA_WLAN_VENDOR_ATTR_NDP_PEER_DISCOVERY_MAC_ADDR, + QCA_WLAN_VENDOR_ATTR_NDP_IFACE_STR, + QCA_WLAN_VENDOR_ATTR_NDP_CONFIG_SECURITY, + QCA_WLAN_VENDOR_ATTR_NDP_CONFIG_QOS, + QCA_WLAN_VENDOR_ATTR_NDP_APP_INFO, + QCA_WLAN_VENDOR_ATTR_NDP_INSTANCE_ID, + QCA_WLAN_VENDOR_ATTR_NDP_INSTANCE_ID_ARRAY, + QCA_WLAN_VENDOR_ATTR_NDP_RESPONSE_CODE, + QCA_WLAN_VENDOR_ATTR_NDP_NDI_MAC_ADDR, + QCA_WLAN_VENDOR_ATTR_NDP_DRV_RESPONSE_STATUS_TYPE, + QCA_WLAN_VENDOR_ATTR_NDP_DRV_RETURN_VALUE, + QCA_WLAN_VENDOR_ATTR_NDP_CHANNEL_CONFIG, + QCA_WLAN_VENDOR_ATTR_NDP_CSID, + QCA_WLAN_VENDOR_ATTR_NDP_PMK, + QCA_WLAN_VENDOR_ATTR_NDP_SCID, + QCA_WLAN_VENDOR_ATTR_NDP_PASSPHRASE, + QCA_WLAN_VENDOR_ATTR_NDP_SERVICE_NAME, + QCA_WLAN_VENDOR_ATTR_NDP_SCHEDULE_UPDATE_REASON, + QCA_WLAN_VENDOR_ATTR_NDP_NSS, + QCA_WLAN_VENDOR_ATTR_NDP_NUM_CHANNELS, + QCA_WLAN_VENDOR_ATTR_NDP_CHANNEL_WIDTH, + QCA_WLAN_VENDOR_ATTR_NDP_CHANNEL_INFO, + + /* keep last */ + QCA_WLAN_VENDOR_ATTR_NDP_PARAMS_AFTER_LAST, + QCA_WLAN_VENDOR_ATTR_NDP_PARAMS_MAX = + QCA_WLAN_VENDOR_ATTR_NDP_PARAMS_AFTER_LAST - 1, +}; + +/** + * enum qca_wlan_ndp_sub_cmd - NDP sub comands types for + * QCA_NL80211_VENDOR_SUBCMD_NDP. + * @QCA_WLAN_VENDOR_ATTR_NDP_INVALID: invalid value + * @QCA_WLAN_VENDOR_ATTR_NDP_INTERFACE_CREATE: create a ndi + * @QCA_WLAN_VENDOR_ATTR_NDP_INTERFACE_DELETE: delete a ndi + * @QCA_WLAN_VENDOR_ATTR_NDP_INITIATOR_REQUEST: initiate a ndp session + * @QCA_WLAN_VENDOR_ATTR_NDP_INITIATOR_RESPONSE: response for above + * @QCA_WLAN_VENDOR_ATTR_NDP_RESPONDER_REQUEST: respond to ndp session + * @QCA_WLAN_VENDOR_ATTR_NDP_RESPONDER_RESPONSE: response for above + * @QCA_WLAN_VENDOR_ATTR_NDP_END_REQUEST: initiate a ndp end + * @QCA_WLAN_VENDOR_ATTR_NDP_END_RESPONSE: response for above + * @QCA_WLAN_VENDOR_ATTR_NDP_REQUEST_IND: notify the peer about the end request + * @QCA_WLAN_VENDOR_ATTR_NDP_CONFIRM_IND: confirm the ndp session is complete + * @QCA_WLAN_VENDOR_ATTR_NDP_END_IND: indicate the peer about the end request + * being received + * @QCA_WLAN_VENDOR_ATTR_NDP_SCHEDULE_UPDATE_IND: indicate the peer of schedule + * update + */ +enum qca_wlan_ndp_sub_cmd { + QCA_WLAN_VENDOR_ATTR_NDP_INVALID = 0, + QCA_WLAN_VENDOR_ATTR_NDP_INTERFACE_CREATE = 1, + QCA_WLAN_VENDOR_ATTR_NDP_INTERFACE_DELETE = 2, + QCA_WLAN_VENDOR_ATTR_NDP_INITIATOR_REQUEST = 3, + QCA_WLAN_VENDOR_ATTR_NDP_INITIATOR_RESPONSE = 4, + QCA_WLAN_VENDOR_ATTR_NDP_RESPONDER_REQUEST = 5, + QCA_WLAN_VENDOR_ATTR_NDP_RESPONDER_RESPONSE = 6, + QCA_WLAN_VENDOR_ATTR_NDP_END_REQUEST = 7, + QCA_WLAN_VENDOR_ATTR_NDP_END_RESPONSE = 8, + QCA_WLAN_VENDOR_ATTR_NDP_REQUEST_IND = 9, + QCA_WLAN_VENDOR_ATTR_NDP_CONFIRM_IND = 10, + QCA_WLAN_VENDOR_ATTR_NDP_END_IND = 11, + QCA_WLAN_VENDOR_ATTR_NDP_SCHEDULE_UPDATE_IND = 12 +}; + /** * qca_wlan_vendor_external_acs_event_chan_info_attr: Represents per channel * information. These attributes are sent as part of @@ -5397,6 +5514,11 @@ enum qca_wlan_vendor_attr_spectral_cap { QCA_WLAN_VENDOR_ATTR_SPECTRAL_SCAN_CAP_SPECTRAL = 3, /* Flag attribute to indicate advanced spectral capability */ QCA_WLAN_VENDOR_ATTR_SPECTRAL_SCAN_CAP_ADVANCED_SPECTRAL = 4, + /* Spectral hardware generation. u32 attribute. + * It uses values defined in enum + * qca_wlan_vendor_spectral_scan_cap_hw_gen. + */ + QCA_WLAN_VENDOR_ATTR_SPECTRAL_SCAN_CAP_HW_GEN = 5, QCA_WLAN_VENDOR_ATTR_SPECTRAL_SCAN_CAP_AFTER_LAST, QCA_WLAN_VENDOR_ATTR_SPECTRAL_SCAN_CAP_MAX = @@ -5473,6 +5595,21 @@ enum qca_wlan_vendor_attr_spectral_scan_request_type { QCA_WLAN_VENDOR_ATTR_SPECTRAL_SCAN_REQUEST_TYPE_CONFIG, }; +/** + * qca_wlan_vendor_spectral_scan_cap_hw_gen: Attribute values for + * QCA_WLAN_VENDOR_ATTR_SPECTRAL_SCAN_CAP_HW_GEN to the vendor subcmd + * QCA_NL80211_VENDOR_SUBCMD_SPECTRAL_SCAN_GET_CAP_INFO. This represents the + * spectral hardware generation. + * @QCA_WLAN_VENDOR_SPECTRAL_SCAN_CAP_HW_GEN_1: generation 1 + * @QCA_WLAN_VENDOR_SPECTRAL_SCAN_CAP_HW_GEN_2: generation 2 + * @QCA_WLAN_VENDOR_SPECTRAL_SCAN_CAP_HW_GEN_3: generation 3 + */ +enum qca_wlan_vendor_spectral_scan_cap_hw_gen { + QCA_WLAN_VENDOR_SPECTRAL_SCAN_CAP_HW_GEN_1 = 0, + QCA_WLAN_VENDOR_SPECTRAL_SCAN_CAP_HW_GEN_2 = 1, + QCA_WLAN_VENDOR_SPECTRAL_SCAN_CAP_HW_GEN_3 = 2, +}; + /** * enum qca_wlan_vendor_attr_rropavail_info - Specifies whether Representative * RF Operating Parameter (RROP) information is available, and if so, at which diff --git a/os_if/linux/spectral/src/wlan_cfg80211_spectral.c b/os_if/linux/spectral/src/wlan_cfg80211_spectral.c index d317bf87cce4..4c7404b9f967 100644 --- a/os_if/linux/spectral/src/wlan_cfg80211_spectral.c +++ b/os_if/linux/spectral/src/wlan_cfg80211_spectral.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 The Linux Foundation. All rights reserved. + * Copyright (c) 2017-2018 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -549,7 +549,7 @@ int wlan_cfg80211_spectral_scan_get_cap(struct wiphy *wiphy, wlan_spectral_get_cap(pdev, &spectral_cap); - skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, 4 * sizeof(u32) + + skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, 5 * sizeof(u32) + NLA_HDRLEN + NLMSG_HDRLEN); if (!skb) { qdf_print(" reply skb alloc failed"); @@ -578,7 +578,14 @@ int wlan_cfg80211_spectral_scan_get_cap(struct wiphy *wiphy, skb, QCA_WLAN_VENDOR_ATTR_SPECTRAL_SCAN_CAP_ADVANCED_SPECTRAL)) goto fail; + + if (nla_put_u32(skb, + QCA_WLAN_VENDOR_ATTR_SPECTRAL_SCAN_CAP_HW_GEN, + spectral_cap.hw_gen)) + goto fail; + cfg80211_vendor_cmd_reply(skb); + return 0; fail: diff --git a/spectral/core/spectral_common.c b/spectral/core/spectral_common.c index e89ddfba96de..4b031547513c 100644 --- a/spectral/core/spectral_common.c +++ b/spectral/core/spectral_common.c @@ -57,7 +57,7 @@ spectral_get_vdev(struct wlan_objmgr_pdev *pdev) qdf_assert_always(pdev); - vdev = wlan_objmgr_get_vdev_by_id_from_pdev(pdev, 0, WLAN_SPECTRAL_ID); + vdev = wlan_objmgr_pdev_get_first_vdev(pdev, WLAN_SPECTRAL_ID); if (!vdev) { spectral_warn("Unable to get first vdev of pdev"); diff --git a/spectral/dispatcher/inc/wlan_spectral_public_structs.h b/spectral/dispatcher/inc/wlan_spectral_public_structs.h index 1ca5125b80ae..3217811bb6d8 100644 --- a/spectral/dispatcher/inc/wlan_spectral_public_structs.h +++ b/spectral/dispatcher/inc/wlan_spectral_public_structs.h @@ -102,7 +102,9 @@ #define SPECTRAL_SCAN_ACTIVE_DEFAULT (0) #define SPECTRAL_SCAN_ENABLE_DEFAULT (0) #define SPECTRAL_SCAN_COUNT_DEFAULT (0) -#define SPECTRAL_SCAN_PERIOD_DEFAULT (35) +#define SPECTRAL_SCAN_PERIOD_GEN_I_DEFAULT (35) +#define SPECTRAL_SCAN_PERIOD_GEN_II_DEFAULT (35) +#define SPECTRAL_SCAN_PERIOD_GEN_III_DEFAULT (224) #define SPECTRAL_SCAN_PRIORITY_DEFAULT (1) #define SPECTRAL_SCAN_FFT_SIZE_DEFAULT (7) #define SPECTRAL_SCAN_GC_ENA_DEFAULT (1) @@ -228,12 +230,14 @@ struct spectral_diag_stats { * @radar_cap: Radar detection capability * @spectral_cap: Spectral capability * @advncd_spectral_cap: Advanced spectral capability + * @hw_gen: Spectral hw generation */ struct spectral_caps { uint8_t phydiag_cap; uint8_t radar_cap; uint8_t spectral_cap; uint8_t advncd_spectral_cap; + uint32_t hw_gen; }; /** diff --git a/target_if/cp_stats/src/target_if_mc_cp_stats.c b/target_if/cp_stats/src/target_if_mc_cp_stats.c index 7d2fe71b73ef..7911bb058b94 100644 --- a/target_if/cp_stats/src/target_if_mc_cp_stats.c +++ b/target_if/cp_stats/src/target_if_mc_cp_stats.c @@ -54,6 +54,8 @@ static void target_if_cp_stats_free_stats_event(struct stats_event *ev) ev->pdev_stats = NULL; qdf_mem_free(ev->peer_stats); ev->peer_stats = NULL; + qdf_mem_free(ev->cca_stats); + ev->cca_stats = NULL; } static QDF_STATUS target_if_cp_stats_extract_pdev_stats( @@ -130,6 +132,33 @@ static QDF_STATUS target_if_cp_stats_extract_peer_stats( return QDF_STATUS_SUCCESS; } +static QDF_STATUS target_if_cp_stats_extract_cca_stats( + struct wmi_unified *wmi_hdl, + wmi_host_stats_event *stats_param, + struct stats_event *ev, uint8_t *data) +{ + QDF_STATUS status; + struct wmi_host_congestion_stats stats = {0}; + + status = wmi_extract_cca_stats(wmi_hdl, data, &stats); + if (QDF_IS_STATUS_ERROR(status)) { + cp_stats_debug("no congestion stats"); + return QDF_STATUS_SUCCESS; + } + + ev->cca_stats = qdf_mem_malloc(sizeof(*ev->cca_stats)); + if (!ev->cca_stats) { + cp_stats_err("malloc failed"); + return QDF_STATUS_E_NOMEM; + } + + + ev->cca_stats->vdev_id = stats.vdev_id; + ev->cca_stats->congestion = stats.congestion; + + return QDF_STATUS_SUCCESS; +} + static QDF_STATUS target_if_cp_stats_extract_event(struct wmi_unified *wmi_hdl, struct stats_event *ev, uint8_t *data) @@ -156,6 +185,11 @@ static QDF_STATUS target_if_cp_stats_extract_event(struct wmi_unified *wmi_hdl, if (QDF_IS_STATUS_ERROR(status)) return status; + status = target_if_cp_stats_extract_cca_stats(wmi_hdl, &stats_param, + ev, data); + if (QDF_IS_STATUS_ERROR(status)) + return status; + return QDF_STATUS_SUCCESS; } @@ -216,34 +250,77 @@ static void target_if_cp_stats_inc_wake_lock_stats(uint32_t reason, case WOW_REASON_UNSPECIFIED: (*unspecified_wake_count)++; break; + + case WOW_REASON_ASSOC_REQ_RECV: + stats->mgmt_assoc++; + break; + + case WOW_REASON_DISASSOC_RECVD: + stats->mgmt_disassoc++; + break; + + case WOW_REASON_ASSOC_RES_RECV: + stats->mgmt_assoc_resp++; + break; + + case WOW_REASON_REASSOC_REQ_RECV: + stats->mgmt_reassoc++; + break; + + case WOW_REASON_REASSOC_RES_RECV: + stats->mgmt_reassoc_resp++; + break; + + case WOW_REASON_AUTH_REQ_RECV: + stats->mgmt_auth++; + break; + + case WOW_REASON_DEAUTH_RECVD: + stats->mgmt_deauth++; + break; + + case WOW_REASON_ACTION_FRAME_RECV: + stats->mgmt_action++; + break; + case WOW_REASON_RA_MATCH: stats->ipv6_mcast_wake_up_count++; stats->ipv6_mcast_ra_stats++; stats->icmpv6_count++; break; + case WOW_REASON_NLOD: stats->pno_match_wake_up_count++; break; + case WOW_REASON_NLO_SCAN_COMPLETE: stats->pno_complete_wake_up_count++; break; + case WOW_REASON_LOW_RSSI: stats->low_rssi_wake_up_count++; break; + case WOW_REASON_EXTSCAN: stats->gscan_wake_up_count++; break; + case WOW_REASON_RSSI_BREACH_EVENT: stats->rssi_breach_wake_up_count++; break; + case WOW_REASON_OEM_RESPONSE_EVENT: stats->oem_response_wake_up_count++; + break; + case WOW_REASON_11D_SCAN: stats->scan_11d++; break; + case WOW_REASON_CHIP_POWER_FAILURE_DETECT: stats->pwr_save_fail_detected++; break; + default: break; } diff --git a/target_if/spectral/target_if_spectral.c b/target_if/spectral/target_if_spectral.c index cc29b3cefd44..1c4dd06533b1 100644 --- a/target_if/spectral/target_if_spectral.c +++ b/target_if/spectral/target_if_spectral.c @@ -214,7 +214,12 @@ target_if_spectral_info_init_defaults(struct target_if_spectral *spectral) /* Parameters */ info->osps_cache.osc_params.ss_count = SPECTRAL_SCAN_COUNT_DEFAULT; - info->osps_cache.osc_params.ss_period = SPECTRAL_SCAN_PERIOD_DEFAULT; + if (spectral->spectral_gen == SPECTRAL_GEN3) + info->osps_cache.osc_params.ss_period = + SPECTRAL_SCAN_PERIOD_GEN_III_DEFAULT; + else + info->osps_cache.osc_params.ss_period = + SPECTRAL_SCAN_PERIOD_GEN_II_DEFAULT; info->osps_cache.osc_params.ss_spectral_pri = SPECTRAL_SCAN_PRIORITY_DEFAULT; @@ -1332,6 +1337,7 @@ target_if_init_spectral_capability(struct target_if_spectral *spectral) pcap->radar_cap = 1; pcap->spectral_cap = 1; pcap->advncd_spectral_cap = 1; + pcap->hw_gen = spectral->spectral_gen; } #ifdef QCA_SUPPORT_SPECTRAL_SIMULATION @@ -1797,7 +1803,10 @@ target_if_spectral_init_param_defaults(struct target_if_spectral *spectral) struct spectral_config *params = &spectral->params; params->ss_count = SPECTRAL_SCAN_COUNT_DEFAULT; - params->ss_period = SPECTRAL_SCAN_PERIOD_DEFAULT; + if (spectral->spectral_gen == SPECTRAL_GEN3) + params->ss_period = SPECTRAL_SCAN_PERIOD_GEN_III_DEFAULT; + else + params->ss_period = SPECTRAL_SCAN_PERIOD_GEN_II_DEFAULT; params->ss_spectral_pri = SPECTRAL_SCAN_PRIORITY_DEFAULT; params->ss_fft_size = SPECTRAL_SCAN_FFT_SIZE_DEFAULT; params->ss_gc_ena = SPECTRAL_SCAN_GC_ENA_DEFAULT; @@ -1983,8 +1992,6 @@ target_if_pdev_spectral_init(struct wlan_objmgr_pdev *pdev) qdf_spinlock_create(&spectral->noise_pwr_reports_lock); target_if_spectral_clear_stats(spectral); - /* Set the default values for spectral parameters */ - target_if_spectral_init_param_defaults(spectral); #ifdef CONFIG_WIN if (target_type == TARGET_TYPE_QCA8074) { spectral->fftbin_size_war = 1; @@ -2012,6 +2019,10 @@ target_if_pdev_spectral_init(struct wlan_objmgr_pdev *pdev) spectral->tlvhdr_size = sizeof(struct spectral_phyerr_tlv_gen2); } + /* Set the default values for spectral parameters */ + target_if_spectral_init_param_defaults(spectral); + /* Init spectral capability */ + target_if_init_spectral_capability(spectral); if (target_if_spectral_attach_simulation(spectral) < 0) return NULL; diff --git a/umac/cmn_services/crypto/inc/wlan_crypto_global_def.h b/umac/cmn_services/crypto/inc/wlan_crypto_global_def.h index 31bee444b88b..b305e6af80bd 100644 --- a/umac/cmn_services/crypto/inc/wlan_crypto_global_def.h +++ b/umac/cmn_services/crypto/inc/wlan_crypto_global_def.h @@ -264,7 +264,7 @@ struct wlan_crypto_req_key { uint8_t pad; uint16_t keyix; uint8_t keylen; - uint8_t flags; + uint16_t flags; uint8_t macaddr[QDF_MAC_ADDR_SIZE]; uint64_t keyrsc; uint64_t keytsc; diff --git a/umac/cmn_services/crypto/src/wlan_crypto_global_api.c b/umac/cmn_services/crypto/src/wlan_crypto_global_api.c index 382b65f751ca..550c46dbd7a3 100644 --- a/umac/cmn_services/crypto/src/wlan_crypto_global_api.c +++ b/umac/cmn_services/crypto/src/wlan_crypto_global_api.c @@ -360,7 +360,7 @@ QDF_STATUS wlan_crypto_setkey(struct wlan_objmgr_vdev *vdev, return QDF_STATUS_E_INVAL; } - isbcast = qdf_is_macaddr_broadcast( + isbcast = qdf_is_macaddr_group( (struct qdf_mac_addr *)req_key->macaddr); if ((req_key->keylen == 0) && !IS_FILS_CIPHER(req_key->type)) { /* zero length keys, only set default key id if flags are set*/ @@ -1074,7 +1074,7 @@ QDF_STATUS wlan_crypto_encap(struct wlan_objmgr_vdev *vdev, if (peer) wlan_objmgr_peer_release_ref(peer, WLAN_CRYPTO_ID); - if (qdf_is_macaddr_broadcast((struct qdf_mac_addr *)mac_addr)) { + if (qdf_is_macaddr_group((struct qdf_mac_addr *)mac_addr)) { crypto_params = wlan_crypto_vdev_get_comp_params(vdev, &crypto_priv); if (crypto_priv == NULL) { @@ -1179,7 +1179,7 @@ QDF_STATUS wlan_crypto_decap(struct wlan_objmgr_vdev *vdev, if (peer) wlan_objmgr_peer_release_ref(peer, WLAN_CRYPTO_ID); - if (qdf_is_macaddr_broadcast((struct qdf_mac_addr *)mac_addr)) { + if (qdf_is_macaddr_group((struct qdf_mac_addr *)mac_addr)) { crypto_params = wlan_crypto_vdev_get_comp_params(vdev, &crypto_priv); if (crypto_priv == NULL) { diff --git a/umac/cmn_services/obj_mgr/inc/wlan_objmgr_cmn.h b/umac/cmn_services/obj_mgr/inc/wlan_objmgr_cmn.h index d504420213a2..38b17310a471 100644 --- a/umac/cmn_services/obj_mgr/inc/wlan_objmgr_cmn.h +++ b/umac/cmn_services/obj_mgr/inc/wlan_objmgr_cmn.h @@ -216,6 +216,7 @@ typedef void (*wlan_objmgr_peer_status_handler)( * @WLAN_INIT_DEINIT_ID: Init deinit module * @WLAN_IPA_ID: IPA operations * @WLAN_CP_STATS_ID: Control Plane Statistics Module + * @WLAN_GREEN_AP_ID: Green AP operations * @WLAN_REF_ID_MAX: Max id used to generate ref count tracking array */ /* New value added to the enum must also be reflected in function @@ -261,6 +262,7 @@ typedef enum { WLAN_INIT_DEINIT_ID = 36, WLAN_IPA_ID = 37, WLAN_CP_STATS_ID = 38, + WLAN_GREEN_AP_ID = 39, WLAN_REF_ID_MAX, } wlan_objmgr_ref_dbgid; @@ -313,6 +315,7 @@ static inline char *string_from_dbgid(wlan_objmgr_ref_dbgid id) "WLAN_INIT_DEINIT_ID", "WLAN_IPA_ID", "WLAN_CP_STATS_ID", + "WLAN_GREEN_AP_ID", "WLAN_REF_ID_MAX" }; return (char *)strings[id]; diff --git a/umac/cmn_services/obj_mgr/inc/wlan_objmgr_pdev_obj.h b/umac/cmn_services/obj_mgr/inc/wlan_objmgr_pdev_obj.h index 02a125efc596..210bf599b6a6 100644 --- a/umac/cmn_services/obj_mgr/inc/wlan_objmgr_pdev_obj.h +++ b/umac/cmn_services/obj_mgr/inc/wlan_objmgr_pdev_obj.h @@ -735,6 +735,19 @@ QDF_STATUS wlan_objmgr_pdev_try_get_ref(struct wlan_objmgr_pdev *pdev, void wlan_objmgr_pdev_release_ref(struct wlan_objmgr_pdev *pdev, wlan_objmgr_ref_dbgid id); +/** + * wlan_objmgr_pdev_get_first_vdev() - Get first vdev of pdev + * @pdev: PDEV object + * @dbg_id: Object Manager ref debug id + * + * API to get reference to first vdev of pdev. + * + * Return: reference to first vdev + */ +struct wlan_objmgr_vdev *wlan_objmgr_pdev_get_first_vdev( + struct wlan_objmgr_pdev *pdev, + wlan_objmgr_ref_dbgid dbg_id); + /** * wlan_objmgr_pdev_get_pdev_id() - get pdev id * @pdev: PDEV object diff --git a/umac/cmn_services/obj_mgr/src/wlan_objmgr_pdev_obj.c b/umac/cmn_services/obj_mgr/src/wlan_objmgr_pdev_obj.c index e5d73bc2db20..9b02022d536d 100644 --- a/umac/cmn_services/obj_mgr/src/wlan_objmgr_pdev_obj.c +++ b/umac/cmn_services/obj_mgr/src/wlan_objmgr_pdev_obj.c @@ -197,8 +197,8 @@ static QDF_STATUS wlan_objmgr_pdev_obj_destroy(struct wlan_objmgr_pdev *pdev) obj_mgr_info("Physically deleting pdev %d", pdev_id); if (pdev->obj_state != WLAN_OBJ_STATE_LOGICALLY_DELETED) { - obj_mgr_err("pdev object delete is not invoked: pdev-id:%d", - pdev_id); + obj_mgr_err("PDEV object delete is not invoked pdevid:%d objstate:%d", + pdev_id, pdev->obj_state); WLAN_OBJMGR_BUG(0); } @@ -886,3 +886,42 @@ void wlan_objmgr_pdev_release_ref(struct wlan_objmgr_pdev *pdev, return; } qdf_export_symbol(wlan_objmgr_pdev_release_ref); + +struct wlan_objmgr_vdev *wlan_objmgr_pdev_get_first_vdev( + struct wlan_objmgr_pdev *pdev, + wlan_objmgr_ref_dbgid dbg_id) +{ + struct wlan_objmgr_pdev_objmgr *objmgr = &pdev->pdev_objmgr; + qdf_list_t *vdev_list = NULL; + struct wlan_objmgr_vdev *vdev; + qdf_list_node_t *node = NULL; + qdf_list_node_t *prev_node = NULL; + + wlan_pdev_obj_lock(pdev); + + /* VDEV list */ + vdev_list = &objmgr->wlan_vdev_list; + if (qdf_list_peek_front(vdev_list, &node) != QDF_STATUS_SUCCESS) { + wlan_pdev_obj_unlock(pdev); + return NULL; + } + + do { + vdev = qdf_container_of(node, struct wlan_objmgr_vdev, + vdev_node); + if (wlan_objmgr_vdev_try_get_ref(vdev, dbg_id) == + QDF_STATUS_SUCCESS) { + wlan_pdev_obj_unlock(pdev); + return vdev; + } + + prev_node = node; + } while (qdf_list_peek_next(vdev_list, prev_node, &node) == + QDF_STATUS_SUCCESS); + + wlan_pdev_obj_unlock(pdev); + + return NULL; +} + +qdf_export_symbol(wlan_objmgr_pdev_get_first_vdev); diff --git a/umac/cmn_services/obj_mgr/src/wlan_objmgr_peer_obj.c b/umac/cmn_services/obj_mgr/src/wlan_objmgr_peer_obj.c index 0da292fab7f5..ce56d2bd1535 100644 --- a/umac/cmn_services/obj_mgr/src/wlan_objmgr_peer_obj.c +++ b/umac/cmn_services/obj_mgr/src/wlan_objmgr_peer_obj.c @@ -280,10 +280,9 @@ static QDF_STATUS wlan_objmgr_peer_obj_destroy(struct wlan_objmgr_peer *peer) QDF_MAC_ADDR_ARRAY(macaddr)); if (peer->obj_state != WLAN_OBJ_STATE_LOGICALLY_DELETED) { - obj_mgr_err( - "peer(%02x:%02x:%02x:%02x:%02x:%02x) object del is not invoked", - macaddr[0], macaddr[1], macaddr[2], - macaddr[3], macaddr[4], macaddr[5]); + obj_mgr_err("PEER object del is not invoked obj_state:%d peer " + QDF_MAC_ADDR_STR, peer->obj_state, + QDF_MAC_ADDR_ARRAY(macaddr)); WLAN_OBJMGR_BUG(0); } diff --git a/umac/cmn_services/obj_mgr/src/wlan_objmgr_psoc_obj.c b/umac/cmn_services/obj_mgr/src/wlan_objmgr_psoc_obj.c index d2fc172beb5f..083bdfd74d62 100644 --- a/umac/cmn_services/obj_mgr/src/wlan_objmgr_psoc_obj.c +++ b/umac/cmn_services/obj_mgr/src/wlan_objmgr_psoc_obj.c @@ -203,7 +203,8 @@ static QDF_STATUS wlan_objmgr_psoc_obj_destroy(struct wlan_objmgr_psoc *psoc) obj_mgr_info("Physically deleting psoc %d", psoc->soc_objmgr.psoc_id); if (psoc->obj_state != WLAN_OBJ_STATE_LOGICALLY_DELETED) { - obj_mgr_err("psoc object delete is not invoked"); + obj_mgr_err("PSOC object delete is not invoked obj_state:%d", + psoc->obj_state); WLAN_OBJMGR_BUG(0); } diff --git a/umac/cmn_services/obj_mgr/src/wlan_objmgr_vdev_obj.c b/umac/cmn_services/obj_mgr/src/wlan_objmgr_vdev_obj.c index 2f583f1eff35..3109e761fbb5 100644 --- a/umac/cmn_services/obj_mgr/src/wlan_objmgr_vdev_obj.c +++ b/umac/cmn_services/obj_mgr/src/wlan_objmgr_vdev_obj.c @@ -283,8 +283,8 @@ static QDF_STATUS wlan_objmgr_vdev_obj_destroy(struct wlan_objmgr_vdev *vdev) obj_mgr_info("Physically deleting vdev %d", vdev_id); if (vdev->obj_state != WLAN_OBJ_STATE_LOGICALLY_DELETED) { - obj_mgr_err("vdev object delete is not invoked: vdev-id:%d", - wlan_vdev_get_id(vdev)); + obj_mgr_err("VDEV object delete is not invoked vdevid:%d objstate:%d", + wlan_vdev_get_id(vdev), vdev->obj_state); WLAN_OBJMGR_BUG(0); } diff --git a/umac/cmn_services/policy_mgr/src/wlan_policy_mgr_action.c b/umac/cmn_services/policy_mgr/src/wlan_policy_mgr_action.c index 9cfa97d85816..884c09f53084 100644 --- a/umac/cmn_services/policy_mgr/src/wlan_policy_mgr_action.c +++ b/umac/cmn_services/policy_mgr/src/wlan_policy_mgr_action.c @@ -947,7 +947,9 @@ void policy_mgr_check_concurrent_intf_and_restart_sap( { struct policy_mgr_psoc_priv_obj *pm_ctx; uint32_t mcc_to_scc_switch; - uint8_t operating_channel, vdev_id; + uint8_t operating_channel[MAX_NUMBER_OF_CONC_CONNECTIONS] = {0}; + uint8_t vdev_id[MAX_NUMBER_OF_CONC_CONNECTIONS] = {0}; + uint32_t cc_count = 0; pm_ctx = policy_mgr_get_context(psoc); if (!pm_ctx) { @@ -955,11 +957,13 @@ void policy_mgr_check_concurrent_intf_and_restart_sap( return; } - if (policy_mgr_get_mode_specific_conn_info(psoc, &operating_channel, - &vdev_id, PM_STA_MODE)) { - policy_mgr_debug("STA operating Channel: %u", - operating_channel); - } else { + /* + * force SCC with STA+STA+SAP will need some additional logic + */ + cc_count = policy_mgr_get_mode_specific_conn_info(psoc, + &operating_channel[cc_count], + &vdev_id[cc_count], PM_STA_MODE); + if (!cc_count) { policy_mgr_err("Could not get STA operating channel&vdevid"); return; } @@ -967,7 +971,7 @@ void policy_mgr_check_concurrent_intf_and_restart_sap( mcc_to_scc_switch = policy_mgr_mcc_to_scc_switch_mode_in_user_cfg(psoc); policy_mgr_info("MCC to SCC switch: %d chan: %d", - mcc_to_scc_switch, operating_channel); + mcc_to_scc_switch, operating_channel[0]); if (!policy_mgr_is_restart_sap_allowed(psoc, mcc_to_scc_switch)) { policy_mgr_debug( @@ -976,7 +980,7 @@ void policy_mgr_check_concurrent_intf_and_restart_sap( } if ((mcc_to_scc_switch != QDF_MCC_TO_SCC_SWITCH_DISABLE) && - policy_mgr_valid_sta_channel_check(psoc, operating_channel) + policy_mgr_valid_sta_channel_check(psoc, operating_channel[0]) && !pm_ctx->sta_ap_intf_check_work_info) { struct sta_ap_intf_check_work_ctx *work_info; work_info = qdf_mem_malloc( diff --git a/umac/cmn_services/utils/inc/wlan_utility.h b/umac/cmn_services/utils/inc/wlan_utility.h index 8acc72cd0bba..57ad2ed2404f 100644 --- a/umac/cmn_services/utils/inc/wlan_utility.h +++ b/umac/cmn_services/utils/inc/wlan_utility.h @@ -177,9 +177,10 @@ uint8_t *wlan_util_vdev_get_if_name(struct wlan_objmgr_vdev *vdev); /* * wlan_util_is_vap_active() - Check for vap active * @pdev: pdev pointer + * @dbg_id: debug id for ref counting * * @Return: QDF_STATUS_SUCCESS in case of vap active */ -QDF_STATUS wlan_util_is_vap_active(struct wlan_objmgr_pdev *pdev); - +QDF_STATUS wlan_util_is_vap_active(struct wlan_objmgr_pdev *pdev, + wlan_objmgr_ref_dbgid dbg_id); #endif /* _WLAN_UTILITY_H_ */ diff --git a/umac/cmn_services/utils/src/wlan_utility.c b/umac/cmn_services/utils/src/wlan_utility.c index dbf97d1bbfad..2d9a5659ec2b 100644 --- a/umac/cmn_services/utils/src/wlan_utility.c +++ b/umac/cmn_services/utils/src/wlan_utility.c @@ -281,7 +281,8 @@ static void wlan_vap_active(struct wlan_objmgr_pdev *pdev, wlan_vdev_obj_unlock(vdev); } -QDF_STATUS wlan_util_is_vap_active(struct wlan_objmgr_pdev *pdev) +QDF_STATUS wlan_util_is_vap_active(struct wlan_objmgr_pdev *pdev, + wlan_objmgr_ref_dbgid dbg_id) { uint8_t flag = 0; @@ -291,7 +292,7 @@ QDF_STATUS wlan_util_is_vap_active(struct wlan_objmgr_pdev *pdev) wlan_objmgr_pdev_iterate_obj_list(pdev, WLAN_VDEV_OP, wlan_vap_active, - &flag, 0, WLAN_OBJMGR_ID); + &flag, 0, dbg_id); if (flag == 1) return QDF_STATUS_SUCCESS; diff --git a/umac/cp_stats/core/src/wlan_cp_stats_da_api.c b/umac/cp_stats/core/src/wlan_cp_stats_da_api.c deleted file mode 100644 index 71fcbe23e779..000000000000 --- a/umac/cp_stats/core/src/wlan_cp_stats_da_api.c +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2018 The Linux Foundation. All rights reserved. - * - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all - * copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL - * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE - * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL - * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR - * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -/** - * DOC: wlan_cp_stats_da_api.c - * - * This file provide definitions for cp stats global context initialization - * specific to DA - */ -#include "wlan_cp_stats_defs.h" -#include "wlan_cp_stats_da_api.h" - -QDF_STATUS wlan_cp_stats_ctx_init_da(struct cp_stats_context *csc) -{ - return QDF_STATUS_SUCCESS; -} - -QDF_STATUS wlan_cp_stats_ctx_deinit_da(struct cp_stats_context *ac) -{ - return QDF_STATUS_SUCCESS; -} diff --git a/umac/cp_stats/core/src/wlan_cp_stats_da_api.h b/umac/cp_stats/core/src/wlan_cp_stats_da_api.h deleted file mode 100644 index 67a181466d89..000000000000 --- a/umac/cp_stats/core/src/wlan_cp_stats_da_api.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2018 The Linux Foundation. All rights reserved. - * - * Permission to use, copy, modify, and/or distribute this software for - * any purpose with or without fee is hereby granted, provided that the - * above copyright notice and this permission notice appear in all - * copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL - * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE - * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL - * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR - * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -/** - * DOC: wlan_cp_stats_da_api.h - * - * This header file provide declarations for cp stats global context object - * initialization specific to DA - */ -#ifndef __WLAN_CP_STATS_DA_API_H__ -#define __WLAN_CP_STATS_DA_API_H__ - -#ifdef QCA_SUPPORT_CP_STATS -#include -#include "wlan_cp_stats_defs.h" -#include "wlan_cp_stats_da_api.h" - -/** - * wlan_cp_stats_ctx_init_da() - initialize cp stats global context - * @pdev: Pointer to cp stats global context object - * - * Return: QDF_STATUS - Success or Failure - */ -QDF_STATUS wlan_cp_stats_ctx_init_da(struct cp_stats_context *csc); - -/** - * wlan_cp_stats_ctx_deinit_da() - deinitialize cp stats global context - * @pdev: Pointer to cp stats global context object - * - * Return: QDF_STATUS - Success or Failure - */ -QDF_STATUS wlan_cp_stats_ctx_deinit_da(struct cp_stats_context *csc); - -#endif /* QCA_SUPPORT_CP_STATS */ -#endif /* __WLAN_CP_STATS_DA_API_H__ */ diff --git a/umac/cp_stats/core/src/wlan_cp_stats_obj_mgr_handler.c b/umac/cp_stats/core/src/wlan_cp_stats_obj_mgr_handler.c index d8dd04170d21..24efc3aeb563 100644 --- a/umac/cp_stats/core/src/wlan_cp_stats_obj_mgr_handler.c +++ b/umac/cp_stats/core/src/wlan_cp_stats_obj_mgr_handler.c @@ -26,13 +26,8 @@ */ #include "wlan_cp_stats_obj_mgr_handler.h" #include "wlan_cp_stats_defs.h" -#include "wlan_cp_stats_da_api.h" #include "wlan_cp_stats_ol_api.h" - #include "wlan_cp_stats_defs.h" -#include "wlan_cp_stats_ic_ucfg_handler.h" - -#include #include "wlan_cp_stats_utils_api.h" QDF_STATUS diff --git a/umac/cp_stats/core/src/wlan_cp_stats_obj_mgr_handler.h b/umac/cp_stats/core/src/wlan_cp_stats_obj_mgr_handler.h index ad050db4f84e..0f60f94b940e 100644 --- a/umac/cp_stats/core/src/wlan_cp_stats_obj_mgr_handler.h +++ b/umac/cp_stats/core/src/wlan_cp_stats_obj_mgr_handler.h @@ -34,6 +34,12 @@ #include #include +#ifdef QCA_SUPPORT_CP_STATS_DA +#include "wlan_cp_stats_da_api.h" +#else +#include "wlan_cp_stats_defs.h" +#endif + /** * wlan_cp_stats_psoc_obj_create_handler() - psoc create notification handler * callback function @@ -122,5 +128,19 @@ QDF_STATUS wlan_cp_stats_peer_obj_create_handler( QDF_STATUS wlan_cp_stats_peer_obj_destroy_handler( struct wlan_objmgr_peer *peer, void *data); +#ifndef QCA_SUPPORT_CP_STATS_DA +static inline +QDF_STATUS wlan_cp_stats_ctx_init_da(struct cp_stats_context *csc) +{ + return QDF_STATUS_SUCCESS; +} + +static inline +QDF_STATUS wlan_cp_stats_ctx_deinit_da(struct cp_stats_context *csc) +{ + return QDF_STATUS_SUCCESS; +} +#endif + #endif /* QCA_SUPPORT_CP_STATS */ #endif /* __WLAN_CP_STATS_OBJ_MGR_HANDLER_H__ */ diff --git a/umac/cp_stats/dispatcher/inc/wlan_cp_stats_mc_defs.h b/umac/cp_stats/dispatcher/inc/wlan_cp_stats_mc_defs.h index 4e2abdf496c3..9eb5293799b5 100644 --- a/umac/cp_stats/dispatcher/inc/wlan_cp_stats_mc_defs.h +++ b/umac/cp_stats/dispatcher/inc/wlan_cp_stats_mc_defs.h @@ -73,6 +73,14 @@ enum stats_req_type { * @oem_response_wake_up_count: oem response wakeup count * @pwr_save_fail_detected: pwr save fail detected wakeup count * @scan_11d 11d scan wakeup count + * @mgmt_assoc: association request management frame + * @mgmt_disassoc: disassociation management frame + * @mgmt_assoc_resp: association response management frame + * @mgmt_reassoc: reassociate request management frame + * @mgmt_reassoc_resp: reassociate response management frame + * @mgmt_auth: authentication managament frame + * @mgmt_deauth: deauthentication management frame + * @mgmt_action: action managament frame */ struct wake_lock_stats { uint32_t ucast_wake_up_count; @@ -92,6 +100,14 @@ struct wake_lock_stats { uint32_t oem_response_wake_up_count; uint32_t pwr_save_fail_detected; uint32_t scan_11d; + uint32_t mgmt_assoc; + uint32_t mgmt_disassoc; + uint32_t mgmt_assoc_resp; + uint32_t mgmt_reassoc; + uint32_t mgmt_reassoc_resp; + uint32_t mgmt_auth; + uint32_t mgmt_deauth; + uint32_t mgmt_action; }; struct stats_event; @@ -125,6 +141,16 @@ struct pending_stats_requests { struct request_info req[TYPE_MAX]; }; +/** + * struct cca_stats - cca stats + * @congestion: the congestion percentage = (busy_time/total_time)*100 + * for the interval from when the vdev was started to the current time + * (or the time at which the vdev was stopped). + */ +struct cca_stats { + uint32_t congestion; +}; + /** * struct psoc_mc_cp_stats: psoc specific stats * @pending: details of pending requests @@ -144,11 +170,13 @@ struct pdev_mc_cp_stats { }; /** - * struct vdev_mc_cp_stats - vdev specific stats - * @wow_stats: wake_lock stats for vdev + * struct vdev_mc_cp_stats - vdev specific stats + * @wow_stats: wake_lock stats for vdev + * @cca: cca stats */ struct vdev_mc_cp_stats { struct wake_lock_stats wow_stats; + struct cca_stats cca; }; /** @@ -165,18 +193,30 @@ struct peer_mc_cp_stats { uint8_t peer_macaddr[WLAN_MACADDR_LEN]; }; +/** + * struct congestion_stats_event: congestion stats event param + * @vdev_id: vdev_id of the event + * @congestion: the congestion percentage + */ +struct congestion_stats_event { + uint8_t vdev_id; + uint32_t congestion; +}; + /** * struct stats_event - parameters populated by stats event * @num_pdev_stats: num pdev stats * @pdev_stats: if populated array indicating pdev stats (index = pdev_id) * @num_peer_stats: num peer stats * @peer_stats: if populated array indicating peer stats + * @cca_stats: if populated indicates congestion stats */ struct stats_event { uint32_t num_pdev_stats; struct pdev_mc_cp_stats *pdev_stats; uint32_t num_peer_stats; struct peer_mc_cp_stats *peer_stats; + struct congestion_stats_event *cca_stats; }; #endif /* CONFIG_MCL */ diff --git a/umac/cp_stats/dispatcher/inc/wlan_cp_stats_mc_ucfg_api.h b/umac/cp_stats/dispatcher/inc/wlan_cp_stats_mc_ucfg_api.h index 065c5a8c6ba2..d47f4f1025eb 100644 --- a/umac/cp_stats/dispatcher/inc/wlan_cp_stats_mc_ucfg_api.h +++ b/umac/cp_stats/dispatcher/inc/wlan_cp_stats_mc_ucfg_api.h @@ -185,5 +185,15 @@ QDF_STATUS ucfg_mc_cp_stats_get_pending_req(struct wlan_objmgr_psoc *psoc, */ void ucfg_mc_cp_stats_free_stats_resources(struct stats_event *ev); +/** + * ucfg_mc_cp_stats_cca_stats_get() - API to fetch cca stats + * @vdev: pointer to vdev object + * @cca_stats: pointer to cca info + * + * Return - status of operation + */ +QDF_STATUS ucfg_mc_cp_stats_cca_stats_get(struct wlan_objmgr_vdev *vdev, + struct cca_stats *cca_stats); + #endif /* QCA_SUPPORT_CP_STATS */ #endif /* __WLAN_CP_STATS_MC_UCFG_API_H__ */ diff --git a/umac/cp_stats/dispatcher/inc/wlan_cp_stats_ucfg_api.h b/umac/cp_stats/dispatcher/inc/wlan_cp_stats_ucfg_api.h index ea69d7e31e20..e09eee385047 100644 --- a/umac/cp_stats/dispatcher/inc/wlan_cp_stats_ucfg_api.h +++ b/umac/cp_stats/dispatcher/inc/wlan_cp_stats_ucfg_api.h @@ -26,6 +26,9 @@ #define __WLAN_CP_STATS_UCFG_API_H__ #ifdef QCA_SUPPORT_CP_STATS +#include +#include "../../core/src/wlan_cp_stats_defs.h" +#include "../../core/src/wlan_cp_stats_cmn_api_i.h" #endif /* QCA_SUPPORT_CP_STATS */ #endif /* __WLAN_CP_STATS_UCFG_API_H__ */ diff --git a/umac/cp_stats/dispatcher/src/wlan_cp_stats_mc_tgt_api.c b/umac/cp_stats/dispatcher/src/wlan_cp_stats_mc_tgt_api.c index 86cb62127618..5cf37abf99ba 100644 --- a/umac/cp_stats/dispatcher/src/wlan_cp_stats_mc_tgt_api.c +++ b/umac/cp_stats/dispatcher/src/wlan_cp_stats_mc_tgt_api.c @@ -325,6 +325,39 @@ static void tgt_mc_cp_stats_extract_peer_stats(struct wlan_objmgr_psoc *psoc, ucfg_mc_cp_stats_reset_pending_req(psoc, TYPE_PEER_STATS); } +static void tgt_mc_cp_stats_extract_cca_stats(struct wlan_objmgr_psoc *psoc, + struct stats_event *ev) +{ + struct wlan_objmgr_vdev *vdev; + struct vdev_mc_cp_stats *vdev_mc_stats; + struct vdev_cp_stats *vdev_cp_stats_priv; + + if (!ev->cca_stats) + return; + + vdev = wlan_objmgr_get_vdev_by_id_from_psoc(psoc, + ev->cca_stats->vdev_id, + WLAN_CP_STATS_ID); + if (!vdev) { + cp_stats_err("vdev is null"); + return; + } + + vdev_cp_stats_priv = wlan_cp_stats_get_vdev_stats_obj(vdev); + if (!vdev_cp_stats_priv) { + cp_stats_err("vdev cp stats object is null"); + goto end; + } + + wlan_cp_stats_vdev_obj_lock(vdev_cp_stats_priv); + vdev_mc_stats = vdev_cp_stats_priv->vdev_stats; + vdev_mc_stats->cca.congestion = ev->cca_stats->congestion; + wlan_cp_stats_vdev_obj_unlock(vdev_cp_stats_priv); + +end: + wlan_objmgr_vdev_release_ref(vdev, WLAN_CP_STATS_ID); +} + QDF_STATUS tgt_mc_cp_stats_process_stats_event(struct wlan_objmgr_psoc *psoc, struct stats_event *ev) { @@ -334,6 +367,8 @@ QDF_STATUS tgt_mc_cp_stats_process_stats_event(struct wlan_objmgr_psoc *psoc, if (ucfg_mc_cp_stats_is_req_pending(psoc, TYPE_PEER_STATS)) tgt_mc_cp_stats_extract_peer_stats(psoc, ev, false); + tgt_mc_cp_stats_extract_cca_stats(psoc, ev); + return QDF_STATUS_SUCCESS; } diff --git a/umac/cp_stats/dispatcher/src/wlan_cp_stats_mc_ucfg_api.c b/umac/cp_stats/dispatcher/src/wlan_cp_stats_mc_ucfg_api.c index d364ee4837d6..4568836c811d 100644 --- a/umac/cp_stats/dispatcher/src/wlan_cp_stats_mc_ucfg_api.c +++ b/umac/cp_stats/dispatcher/src/wlan_cp_stats_mc_ucfg_api.c @@ -532,10 +532,28 @@ QDF_STATUS ucfg_mc_cp_stats_get_pending_req(struct wlan_objmgr_psoc *psoc, return QDF_STATUS_SUCCESS; } +QDF_STATUS ucfg_mc_cp_stats_cca_stats_get(struct wlan_objmgr_vdev *vdev, + struct cca_stats *cca_stats) +{ + struct vdev_cp_stats *vdev_cp_stats_priv; + struct vdev_mc_cp_stats *vdev_mc_stats; + + vdev_cp_stats_priv = wlan_cp_stats_get_vdev_stats_obj(vdev); + if (!vdev_cp_stats_priv) { + cp_stats_err("vdev cp stats object is null"); + return QDF_STATUS_E_NULL_VALUE; + } + + wlan_cp_stats_vdev_obj_lock(vdev_cp_stats_priv); + vdev_mc_stats = vdev_cp_stats_priv->vdev_stats; + cca_stats->congestion = vdev_mc_stats->cca.congestion; + wlan_cp_stats_vdev_obj_unlock(vdev_cp_stats_priv); + return QDF_STATUS_SUCCESS; +} + void ucfg_mc_cp_stats_free_stats_resources(struct stats_event *ev) { qdf_mem_free(ev->pdev_stats); qdf_mem_free(ev->peer_stats); qdf_mem_zero(ev, sizeof(*ev)); } - diff --git a/umac/cp_stats/dispatcher/src/wlan_cp_stats_utils_api.c b/umac/cp_stats/dispatcher/src/wlan_cp_stats_utils_api.c index a21ec8038fa4..c614702ce0df 100644 --- a/umac/cp_stats/dispatcher/src/wlan_cp_stats_utils_api.c +++ b/umac/cp_stats/dispatcher/src/wlan_cp_stats_utils_api.c @@ -232,6 +232,25 @@ QDF_STATUS wlan_cp_stats_open(struct wlan_objmgr_psoc *psoc) } QDF_STATUS wlan_cp_stats_close(struct wlan_objmgr_psoc *psoc) +{ + struct cp_stats_context *csc; + + if (!psoc) { + cp_stats_err("PSOC is null!"); + return QDF_STATUS_E_INVAL; + } + csc = + wlan_objmgr_psoc_get_comp_private_obj(psoc, WLAN_UMAC_COMP_CP_STATS); + if (csc && csc->cp_stats_close) { + csc->cp_stats_close(psoc); + qdf_spinlock_destroy(&csc->csc_lock); + } + + return QDF_STATUS_SUCCESS; +} + +/* WMI registrations stage */ +QDF_STATUS wlan_cp_stats_enable(struct wlan_objmgr_psoc *psoc) { QDF_STATUS status = QDF_STATUS_E_FAILURE; struct cp_stats_context *csc; @@ -247,30 +266,6 @@ QDF_STATUS wlan_cp_stats_close(struct wlan_objmgr_psoc *psoc) return QDF_STATUS_E_FAILURE; } - if (csc->cp_stats_close) - status = csc->cp_stats_close(psoc); - - qdf_spinlock_destroy(&csc->csc_lock); - return status; -} - -/* WMI registrations stage */ -QDF_STATUS wlan_cp_stats_enable(struct wlan_objmgr_psoc *psoc) -{ - QDF_STATUS status = QDF_STATUS_E_FAILURE; - struct cp_stats_context *csc; - - if (!psoc) { - cp_stats_err("PSOC is null!\n"); - return QDF_STATUS_E_INVAL; - } - csc = - wlan_objmgr_psoc_get_comp_private_obj(psoc, WLAN_UMAC_COMP_CP_STATS); - if (!csc) { - cp_stats_err("cp_stats_context is null!\n"); - return QDF_STATUS_E_FAILURE; - } - if (csc->cp_stats_enable) status = csc->cp_stats_enable(psoc); @@ -279,7 +274,6 @@ QDF_STATUS wlan_cp_stats_enable(struct wlan_objmgr_psoc *psoc) QDF_STATUS wlan_cp_stats_disable(struct wlan_objmgr_psoc *psoc) { - QDF_STATUS status = QDF_STATUS_E_FAILURE; struct cp_stats_context *csc; if (!psoc) { @@ -288,15 +282,10 @@ QDF_STATUS wlan_cp_stats_disable(struct wlan_objmgr_psoc *psoc) } csc = wlan_objmgr_psoc_get_comp_private_obj(psoc, WLAN_UMAC_COMP_CP_STATS); - if (!csc) { - cp_stats_err("cp_stats_context is null!\n"); - return QDF_STATUS_E_FAILURE; - } + if (csc && csc->cp_stats_disable) + csc->cp_stats_disable(psoc); - if (csc->cp_stats_disable) - status = csc->cp_stats_disable(psoc); - - return status; + return QDF_STATUS_SUCCESS; } QDF_STATUS diff --git a/umac/dfs/core/src/misc/dfs_full_offload.c b/umac/dfs/core/src/misc/dfs_full_offload.c index fbe628e73acc..bf2397c7a243 100644 --- a/umac/dfs/core/src/misc/dfs_full_offload.c +++ b/umac/dfs/core/src/misc/dfs_full_offload.c @@ -35,6 +35,12 @@ int dfs_fill_emulate_bang_radar_test(struct wlan_dfs *dfs, * More parameters are to be added later indicating * seg id, chirp and sidx values to be sent to fw. */ + if (!(WLAN_IS_PRIMARY_OR_SECONDARY_CHAN_DFS(dfs->dfs_curchan))) { + dfs_err(dfs, WLAN_DEBUG_DFS_ALWAYS, + "Ignore bangradar on a NON-DFS channel"); + return -EINVAL; + } + dfs_unit_test->num_args = DFS_UNIT_TEST_NUM_ARGS; dfs_unit_test->args[IDX_CMD_ID] = DFS_PHYERR_OFFLOAD_TEST_SET_RADAR; diff --git a/umac/green_ap/core/src/wlan_green_ap_main.c b/umac/green_ap/core/src/wlan_green_ap_main.c index 84b298252f7e..aa0f7dec9bac 100644 --- a/umac/green_ap/core/src/wlan_green_ap_main.c +++ b/umac/green_ap/core/src/wlan_green_ap_main.c @@ -56,7 +56,7 @@ static QDF_STATUS wlan_green_ap_ant_ps_reset * Add protection against green AP enabling interrupts * when not valid or no VAPs exist */ - if (wlan_util_is_vap_active(pdev) == QDF_STATUS_SUCCESS) + if (wlan_util_is_vap_active(pdev, WLAN_GREEN_AP_ID) == QDF_STATUS_SUCCESS) green_ap_tx_ops->reset_dev(pdev); else green_ap_err("Green AP tried to enable IRQs when invalid"); diff --git a/umac/green_ap/dispatcher/src/wlan_green_ap_ucfg_api.c b/umac/green_ap/dispatcher/src/wlan_green_ap_ucfg_api.c index 153b5bafcf07..40f580cdcd19 100644 --- a/umac/green_ap/dispatcher/src/wlan_green_ap_ucfg_api.c +++ b/umac/green_ap/dispatcher/src/wlan_green_ap_ucfg_api.c @@ -216,11 +216,12 @@ QDF_STATUS ucfg_green_ap_config(struct wlan_objmgr_pdev *pdev, uint8_t val) } if (val) { - struct wlan_pdev_green_ap_ctx *green_ap_ctx; + struct wlan_pdev_green_ap_ctx *green_ap_ctx; + wlan_objmgr_pdev_iterate_obj_list(pdev, WLAN_VDEV_OP, wlan_green_ap_check_mode, - &flag, 0, WLAN_OBJMGR_ID); + &flag, 0, WLAN_GREEN_AP_ID); if (flag == 1) { green_ap_err("Radio not in AP mode." "Feature not supported"); @@ -237,7 +238,8 @@ QDF_STATUS ucfg_green_ap_config(struct wlan_objmgr_pdev *pdev, uint8_t val) ucfg_green_ap_set_ps_config(pdev, val); - if (wlan_util_is_vap_active(pdev) == QDF_STATUS_SUCCESS) + if (wlan_util_is_vap_active(pdev, WLAN_GREEN_AP_ID) == + QDF_STATUS_SUCCESS) wlan_green_ap_start(pdev); } else { wlan_green_ap_stop(pdev); diff --git a/umac/tdls/core/src/wlan_tdls_mgmt.c b/umac/tdls/core/src/wlan_tdls_mgmt.c index 00d31dad7d63..38b93d1cab7c 100644 --- a/umac/tdls/core/src/wlan_tdls_mgmt.c +++ b/umac/tdls/core/src/wlan_tdls_mgmt.c @@ -417,6 +417,7 @@ QDF_STATUS tdls_process_mgmt_req( case WLAN_SER_CMD_DENIED_UNSPECIFIED: /* free the request */ qdf_mem_free(tdls_mgmt_req); + break; default: QDF_ASSERT(0); diff --git a/wmi/inc/wmi_unified_api.h b/wmi/inc/wmi_unified_api.h index d087cc4b6811..59808cdf60f1 100644 --- a/wmi/inc/wmi_unified_api.h +++ b/wmi/inc/wmi_unified_api.h @@ -2252,4 +2252,18 @@ QDF_STATUS wmi_unified_invoke_neighbor_report_cmd(void *wmi_hdl, wmi_host_channel_width wmi_get_ch_width_from_phy_mode(void *wmi_hdl, WMI_HOST_WLAN_PHY_MODE phymode); +#ifdef QCA_SUPPORT_CP_STATS +/** + * wmi_extract_cca_stats() - api to extract congestion stats from event buffer + * @wmi_handle: wma handle + * @evt_buf: event buffer + * @datalen: length of buffer + * @stats: buffer to populated after stats extraction + * + * Return: status of operation + */ +QDF_STATUS wmi_extract_cca_stats(wmi_unified_t wmi_handle, void *evt_buf, + struct wmi_host_congestion_stats *stats); +#endif /* QCA_SUPPORT_CP_STATS */ + #endif /* _WMI_UNIFIED_API_H_ */ diff --git a/wmi/inc/wmi_unified_param.h b/wmi/inc/wmi_unified_param.h index 73c19aa940cc..6dc74be63660 100644 --- a/wmi/inc/wmi_unified_param.h +++ b/wmi/inc/wmi_unified_param.h @@ -8391,4 +8391,19 @@ struct wmi_obss_color_collision_info { uint32_t obss_color_bitmap_bit0to31; uint32_t obss_color_bitmap_bit32to63; }; + +#ifdef QCA_SUPPORT_CP_STATS +/** + * struct wmi_host_congestion_stats - host definition of congestion stats + * @vdev_id: ID of the vdev to which this info belongs. + * @congestion: This field holds the congestion percentage = + * (busy_time/total_time)*100 + * for the interval from when the vdev was started to the current time + * (or the time at which the vdev was stopped). + */ +struct wmi_host_congestion_stats { + uint32_t vdev_id; + uint32_t congestion; +}; +#endif #endif /* _WMI_UNIFIED_PARAM_H_ */ diff --git a/wmi/inc/wmi_unified_priv.h b/wmi/inc/wmi_unified_priv.h index 6a6d12219692..56b9ae6dbab0 100644 --- a/wmi/inc/wmi_unified_priv.h +++ b/wmi/inc/wmi_unified_priv.h @@ -1616,6 +1616,11 @@ QDF_STATUS (*extract_twt_resume_dialog_comp_event)(wmi_unified_t wmi_handle, uint8_t *evt_buf, struct wmi_twt_resume_dialog_complete_event_param *params); #endif + +#ifdef QCA_SUPPORT_CP_STATS +QDF_STATUS (*extract_cca_stats)(wmi_unified_t wmi_handle, void *evt_buf, + struct wmi_host_congestion_stats *stats); +#endif /* QCA_SUPPORT_CP_STATS */ }; /* Forward declartion for psoc*/ diff --git a/wmi/src/wmi_unified_api.c b/wmi/src/wmi_unified_api.c index 011bfde96238..484c55c0a90a 100644 --- a/wmi/src/wmi_unified_api.c +++ b/wmi/src/wmi_unified_api.c @@ -7482,3 +7482,15 @@ wmi_host_channel_width wmi_get_ch_width_from_phy_mode(void *wmi_hdl, else return WMI_HOST_CHAN_WIDTH_20; } + +#ifdef QCA_SUPPORT_CP_STATS +QDF_STATUS wmi_extract_cca_stats(wmi_unified_t wmi_handle, void *evt_buf, + struct wmi_host_congestion_stats *stats) +{ + if (wmi_handle->ops->extract_cca_stats) + return wmi_handle->ops->extract_cca_stats(wmi_handle, evt_buf, + stats); + + return QDF_STATUS_E_FAILURE; +} +#endif /* QCA_SUPPORT_CP_STATS */ diff --git a/wmi/src/wmi_unified_tlv.c b/wmi/src/wmi_unified_tlv.c index d33856f30f2f..a50e7b23339d 100644 --- a/wmi/src/wmi_unified_tlv.c +++ b/wmi/src/wmi_unified_tlv.c @@ -17806,6 +17806,36 @@ static QDF_STATUS extract_ndp_end_ind_tlv(wmi_unified_t wmi_handle, } #endif +#ifdef QCA_SUPPORT_CP_STATS +/** + * extract_cca_stats_tlv - api to extract congestion stats from event buffer + * @wmi_handle: wma handle + * @evt_buf: event buffer + * @out_buff: buffer to populated after stats extraction + * + * Return: status of operation + */ +static QDF_STATUS extract_cca_stats_tlv(wmi_unified_t wmi_handle, + void *evt_buf, struct wmi_host_congestion_stats *out_buff) +{ + WMI_UPDATE_STATS_EVENTID_param_tlvs *param_buf; + wmi_congestion_stats *congestion_stats; + + param_buf = (WMI_UPDATE_STATS_EVENTID_param_tlvs *)evt_buf; + congestion_stats = param_buf->congestion_stats; + if (!congestion_stats) { + WMI_LOGD("%s: no cca stats in event buffer", __func__); + return QDF_STATUS_E_INVAL; + } + + out_buff->vdev_id = congestion_stats->vdev_id; + out_buff->congestion = congestion_stats->congestion; + + WMI_LOGD("%s: cca stats event processed", __func__); + return QDF_STATUS_SUCCESS; +} +#endif /* QCA_SUPPORT_CP_STATS */ + /** * save_service_bitmap_tlv() - save service bitmap * @wmi_handle: wmi handle @@ -22891,6 +22921,9 @@ struct wmi_ops tlv_ops = { extract_obss_color_collision_info_tlv, .extract_comb_phyerr = extract_comb_phyerr_tlv, .extract_single_phyerr = extract_single_phyerr_tlv, +#ifdef QCA_SUPPORT_CP_STATS + .extract_cca_stats = extract_cca_stats_tlv, +#endif }; /**