diff --git a/Kbuild b/Kbuild index 2a1531657266..124d3261f744 100644 --- a/Kbuild +++ b/Kbuild @@ -1414,6 +1414,7 @@ PKT_CAPTURE_OBJS := $(PKT_CAPTURE_DIR)/core/src/wlan_pkt_capture_main.o \ $(PKT_CAPTURE_DIR)/core/src/wlan_pkt_capture_data_txrx.o \ $(PKT_CAPTURE_DIR)/dispatcher/src/wlan_pkt_capture_ucfg_api.o \ $(PKT_CAPTURE_DIR)/dispatcher/src/wlan_pkt_capture_tgt_api.o \ + $(PKT_CAPTURE_DIR)/dispatcher/src/wlan_pkt_capture_api.o \ $(PKT_CAPTURE_TARGET_IF_DIR)/src/target_if_pkt_capture.o \ $(PKT_CAPTURE_OS_IF_DIR)/src/os_if_pkt_capture.o endif diff --git a/components/pkt_capture/core/src/wlan_pkt_capture_main.c b/components/pkt_capture/core/src/wlan_pkt_capture_main.c index 7fe763810545..e309fdf14ffc 100644 --- a/components/pkt_capture/core/src/wlan_pkt_capture_main.c +++ b/components/pkt_capture/core/src/wlan_pkt_capture_main.c @@ -677,6 +677,7 @@ bool pkt_capture_is_tx_mgmt_enable(struct wlan_objmgr_pdev *pdev) struct pkt_capture_vdev_priv *vdev_priv; struct wlan_objmgr_vdev *vdev; QDF_STATUS status = QDF_STATUS_SUCCESS; + enum pkt_capture_config config; vdev = pkt_capture_get_vdev(); status = pkt_capture_vdev_get_ref(vdev); @@ -692,10 +693,14 @@ bool pkt_capture_is_tx_mgmt_enable(struct wlan_objmgr_pdev *pdev) return false; } + config = pkt_capture_get_pktcap_config(vdev); + if (!(vdev_priv->frame_filter.mgmt_tx_frame_filter & PKT_CAPTURE_MGMT_FRAME_TYPE_ALL)) { - pkt_capture_vdev_put_ref(vdev); - return false; + if (!(config & PACKET_CAPTURE_CONFIG_QOS_ENABLE)) { + pkt_capture_vdev_put_ref(vdev); + return false; + } } pkt_capture_vdev_put_ref(vdev); @@ -1350,8 +1355,10 @@ QDF_STATUS pkt_capture_set_filter(struct pkt_capture_frame_filter frame_filter, vdev_priv->frame_filter.ctrl_rx_frame_filter) config |= PACKET_CAPTURE_CONFIG_TRIGGER_ENABLE; - if (vdev_priv->frame_filter.data_rx_frame_filter & - PKT_CAPTURE_DATA_FRAME_QOS_NULL) + if ((vdev_priv->frame_filter.data_tx_frame_filter & + PKT_CAPTURE_DATA_FRAME_TYPE_ALL) || + (vdev_priv->frame_filter.data_tx_frame_filter & + PKT_CAPTURE_DATA_FRAME_QOS_NULL)) config |= PACKET_CAPTURE_CONFIG_QOS_ENABLE; if (config != pkt_capture_get_pktcap_config(vdev)) { diff --git a/components/pkt_capture/core/src/wlan_pkt_capture_mgmt_txrx.c b/components/pkt_capture/core/src/wlan_pkt_capture_mgmt_txrx.c index 719b75519c18..0f7018dc7a18 100644 --- a/components/pkt_capture/core/src/wlan_pkt_capture_mgmt_txrx.c +++ b/components/pkt_capture/core/src/wlan_pkt_capture_mgmt_txrx.c @@ -357,7 +357,6 @@ void pkt_capture_mgmt_tx(struct wlan_objmgr_pdev *pdev, return; } - pkt_capture_vdev_put_ref(vdev); if (pfc->type == IEEE80211_FC0_TYPE_MGT && !(vdev_priv->frame_filter.mgmt_tx_frame_filter & PKT_CAPTURE_MGMT_FRAME_TYPE_ALL)) diff --git a/components/pkt_capture/dispatcher/inc/wlan_pkt_capture_api.h b/components/pkt_capture/dispatcher/inc/wlan_pkt_capture_api.h new file mode 100644 index 000000000000..278efe72332c --- /dev/null +++ b/components/pkt_capture/dispatcher/inc/wlan_pkt_capture_api.h @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2021 Qualcomm Innovation Center, Inc. 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: Contains pkt_capture public API declarations + */ + +#ifndef _WLAN_PKT_CAPTURE_API_H_ +#define _WLAN_PKT_CAPTURE_API_H_ + +#include "wlan_pkt_capture_objmgr.h" + +/** + * wlan_pkt_capture_is_tx_mgmt_enable() - Check if tx mgmt frames filter + * is enabled + * @pdev: pointer to pdev + * + * Return: bool + */ +bool wlan_pkt_capture_is_tx_mgmt_enable(struct wlan_objmgr_pdev *pdev); +#endif /* _WLAN_PKT_CAPTURE_API_H_ */ diff --git a/components/pkt_capture/dispatcher/src/wlan_pkt_capture_api.c b/components/pkt_capture/dispatcher/src/wlan_pkt_capture_api.c new file mode 100644 index 000000000000..9f6dc260002a --- /dev/null +++ b/components/pkt_capture/dispatcher/src/wlan_pkt_capture_api.c @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2021 Qualcomm Innovation Center, Inc. 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: This file contains pkt_capture public API's exposed. + */ + +#include "wlan_pkt_capture_api.h" +#include "wlan_pkt_capture_main.h" + +bool wlan_pkt_capture_is_tx_mgmt_enable(struct wlan_objmgr_pdev *pdev) +{ + return pkt_capture_is_tx_mgmt_enable(pdev); +} diff --git a/components/pkt_capture/dispatcher/src/wlan_pkt_capture_ucfg_api.c b/components/pkt_capture/dispatcher/src/wlan_pkt_capture_ucfg_api.c index 0fca2f29046d..38cb4e212aae 100644 --- a/components/pkt_capture/dispatcher/src/wlan_pkt_capture_ucfg_api.c +++ b/components/pkt_capture/dispatcher/src/wlan_pkt_capture_ucfg_api.c @@ -1,5 +1,6 @@ /* * Copyright (c) 2020-2021 The Linux Foundation. All rights reserved. + * Copyright (c) 2021 Qualcomm Innovation Center, Inc. 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 @@ -229,15 +230,10 @@ ucfg_pkt_capture_process_mgmt_tx_data(struct wlan_objmgr_pdev *pdev, qdf_nbuf_t nbuf, uint8_t status) { - if (pkt_capture_is_tx_mgmt_enable(pdev)) - return pkt_capture_process_mgmt_tx_data( + return pkt_capture_process_mgmt_tx_data( pdev, params, nbuf, pkt_capture_mgmt_status_map(status)); - else { - qdf_nbuf_free(nbuf); - return QDF_STATUS_SUCCESS; - } } void diff --git a/components/target_if/pkt_capture/src/target_if_pkt_capture.c b/components/target_if/pkt_capture/src/target_if_pkt_capture.c index cdf1a339b934..2f970ab5f598 100644 --- a/components/target_if/pkt_capture/src/target_if_pkt_capture.c +++ b/components/target_if/pkt_capture/src/target_if_pkt_capture.c @@ -1,5 +1,6 @@ /* * Copyright (c) 2021 The Linux Foundation. All rights reserved. + * Copyright (c) 2021 Qualcomm Innovation Center, Inc. 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 @@ -27,6 +28,7 @@ #include #include #include +#include /** * target_if_set_packet_capture_mode() - set packet capture mode @@ -203,8 +205,7 @@ target_if_mgmt_offload_data_event_handler(void *handle, uint8_t *data, return -EINVAL; } - if (!(ucfg_pkt_capture_get_pktcap_mode(psoc) & - PKT_CAPTURE_MODE_MGMT_ONLY)) + if (!(wlan_pkt_capture_is_tx_mgmt_enable(pdev))) return -EINVAL; status = wmi_unified_extract_vdev_mgmt_offload_event(wmi_handle, data,