Browse Source

qcacld-3.0: Add support for qos null filters in packet capture

Add support to send qos null frames received from firmware on
STA interface to mon interface based on config value. The config
value get update based on vendor command set by user.

The packet filter check in ucfg_pkt_capture_process_mgmt_tx_data
moved to target_if_mgmt_offload_data_event_handler. So that we
will not allocate any buffer if filter is not set.

Change-Id: I426b340c5a65711ada971062af95ae039d18d0bd
CRs-Fixed: 3076241
Vulupala Shashank Reddy 3 years ago
parent
commit
b5e2542a4d

+ 1 - 0
Kbuild

@@ -1603,6 +1603,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

+ 11 - 4
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);
@@ -1352,8 +1357,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)) {

+ 0 - 1
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))

+ 36 - 0
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_ */

+ 29 - 0
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);
+}

+ 2 - 6
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

+ 3 - 2
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 <wmi_unified_api.h>
 #include <target_if.h>
 #include <init_deinit_lmac.h>
+#include <wlan_pkt_capture_api.h>
 
 /**
  * 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,