Browse Source

qcacld-3.0: Add tgt support to send beacon report period to FW

Add tgt support in packet capture component to send user
configured beacon report interval to FW.

Change-Id: Ibeb9f9a7f9ad2c2afa6929c492bd1029784b5f9e
CRs-Fixed: 3046224
Vulupala Shashank Reddy 3 years ago
parent
commit
15f71d055b

+ 40 - 4
components/pkt_capture/core/src/wlan_pkt_capture_main.c

@@ -33,6 +33,7 @@
 #include "cdp_txrx_ctrl.h"
 #include "wlan_pkt_capture_tgt_api.h"
 #include <cds_ieee80211_common.h>
+#include "wlan_vdev_mgr_utils_api.h"
 
 static struct wlan_objmgr_vdev *gp_pkt_capture_vdev;
 
@@ -1024,7 +1025,9 @@ QDF_STATUS pkt_capture_set_filter(struct pkt_capture_frame_filter frame_filter,
 	ol_txrx_soc_handle soc;
 	QDF_STATUS status;
 	enum pkt_capture_config config = 0;
-	bool check_enable_beacon = 0;
+	bool check_enable_beacon = 0, send_bcn = 0;
+	struct vdev_mlme_obj *vdev_mlme;
+	uint32_t bcn_interval, nth_beacon_value;
 
 	if (!vdev) {
 		pkt_capture_err("vdev is NULL");
@@ -1080,9 +1083,14 @@ QDF_STATUS pkt_capture_set_filter(struct pkt_capture_frame_filter frame_filter,
 			frame_filter.ctrl_rx_frame_filter;
 
 	if (frame_filter.vendor_attr_to_set &
-	    BIT(PKT_CAPTURE_ATTR_SET_MONITOR_MODE_CONNECTED_BEACON_INTERVAL))
-		vdev_priv->frame_filter.connected_beacon_interval =
-			frame_filter.connected_beacon_interval;
+	    BIT(PKT_CAPTURE_ATTR_SET_MONITOR_MODE_CONNECTED_BEACON_INTERVAL)) {
+		if (frame_filter.connected_beacon_interval !=
+		    vdev_priv->frame_filter.connected_beacon_interval) {
+			vdev_priv->frame_filter.connected_beacon_interval =
+				frame_filter.connected_beacon_interval;
+			send_bcn = 1;
+		}
+	}
 
 	if (vdev_priv->frame_filter.mgmt_tx_frame_filter)
 		mode |= PACKET_CAPTURE_MODE_MGMT_ONLY;
@@ -1144,5 +1152,33 @@ QDF_STATUS pkt_capture_set_filter(struct pkt_capture_frame_filter frame_filter,
 		}
 	}
 
+	if (send_bcn) {
+		vdev_mlme = wlan_objmgr_vdev_get_comp_private_obj(
+							vdev,
+							WLAN_UMAC_COMP_MLME);
+
+		if (!vdev_mlme)
+			return QDF_STATUS_E_FAILURE;
+
+		wlan_util_vdev_mlme_get_param(vdev_mlme,
+					      WLAN_MLME_CFG_BEACON_INTERVAL,
+					      &bcn_interval);
+
+		if (bcn_interval) {
+			nth_beacon_value =
+				vdev_priv->
+				frame_filter.connected_beacon_interval /
+				bcn_interval;
+
+			status = tgt_pkt_capture_send_beacon_interval(
+							vdev,
+							nth_beacon_value);
+
+			if (QDF_IS_STATUS_ERROR(status)) {
+				pkt_capture_err("send beacon interval fail");
+				return status;
+			}
+		}
+	}
 	return QDF_STATUS_SUCCESS;
 }

+ 4 - 0
components/pkt_capture/dispatcher/inc/wlan_pkt_capture_public_structs.h

@@ -110,6 +110,10 @@ struct wlan_pkt_capture_tx_ops {
 				(struct wlan_objmgr_psoc *psoc,
 				 uint8_t vdev_id,
 				 enum pkt_capture_config config);
+	QDF_STATUS (*pkt_capture_send_beacon_interval)
+				(struct wlan_objmgr_psoc *psoc,
+				 uint8_t vdev_id,
+				 uint32_t nth_value);
 };
 
 /**

+ 11 - 0
components/pkt_capture/dispatcher/inc/wlan_pkt_capture_tgt_api.h

@@ -53,6 +53,17 @@ QDF_STATUS
 tgt_pkt_capture_send_mode(struct wlan_objmgr_vdev *vdev,
 			  enum pkt_capture_mode mode);
 
+/**
+ * tgt_pkt_capture_send_beacon_interval() - send beacon interval to firmware
+ * @vdev: pointer to vdev object
+ * @nth_value: Beacon report period
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS
+tgt_pkt_capture_send_beacon_interval(struct wlan_objmgr_vdev *vdev,
+				     uint32_t nth_value);
+
 /**
  * tgt_pkt_capture_send_config() - send packet capture config to firmware
  * @vdev: pointer to vdev object

+ 36 - 0
components/pkt_capture/dispatcher/src/wlan_pkt_capture_tgt_api.c

@@ -126,6 +126,42 @@ tgt_pkt_capture_send_mode(struct wlan_objmgr_vdev *vdev,
 	return status;
 }
 
+QDF_STATUS
+tgt_pkt_capture_send_beacon_interval(struct wlan_objmgr_vdev *vdev,
+				     uint32_t nth_value)
+{
+	QDF_STATUS status = QDF_STATUS_E_FAILURE;
+	struct pkt_capture_vdev_priv *vdev_priv;
+	struct wlan_pkt_capture_tx_ops *tx_ops;
+	struct wlan_objmgr_psoc *psoc;
+
+	psoc = wlan_vdev_get_psoc(vdev);
+	if (!psoc) {
+		pkt_capture_err("psoc is NULL");
+		return status;
+	}
+
+	vdev_priv = pkt_capture_vdev_get_priv(vdev);
+	if (!vdev_priv) {
+		pkt_capture_err("vdev priv is NULL");
+		return status;
+	}
+
+	tx_ops = &vdev_priv->tx_ops;
+
+	if (!tx_ops->pkt_capture_send_beacon_interval)
+		return status;
+
+	status = tx_ops->pkt_capture_send_beacon_interval
+						(psoc,
+						 wlan_vdev_get_id(vdev),
+						 nth_value);
+	if (QDF_IS_STATUS_ERROR(status))
+		pkt_capture_err("Unable to send beacon interval to fw");
+
+	return status;
+}
+
 QDF_STATUS
 tgt_pkt_capture_send_config(struct wlan_objmgr_vdev *vdev,
 			    enum pkt_capture_config config)

+ 40 - 0
components/target_if/pkt_capture/src/target_if_pkt_capture.c

@@ -125,6 +125,44 @@ target_if_set_packet_capture_config
 }
 #endif
 
+/**
+ * target_if_set_packet_capture_beacon_interval() - set packet capture beacon
+ * interval
+ * @psoc: pointer to psoc object
+ * @vdev_id: vdev id
+ * @nth_value: Beacon report period
+ *
+ * Return: QDF_STATUS
+ */
+static QDF_STATUS
+target_if_set_packet_capture_beacon_interval
+			(struct wlan_objmgr_psoc *psoc,
+			 uint8_t vdev_id,
+			 uint32_t nth_value)
+{
+	wmi_unified_t wmi_handle = lmac_get_wmi_unified_hdl(psoc);
+	QDF_STATUS status = QDF_STATUS_E_FAILURE;
+	struct vdev_set_params param;
+
+	if (!wmi_handle) {
+		target_if_err("Invalid wmi handle");
+		return QDF_STATUS_E_INVAL;
+	}
+
+	target_if_debug("psoc:%pK, vdev_id:%d nth_value:%d",
+			psoc, vdev_id, nth_value);
+
+	param.vdev_id = vdev_id;
+	param.param_id = WMI_VDEV_PARAM_NTH_BEACON_TO_HOST;
+	param.param_value = nth_value;
+
+	status = wmi_unified_vdev_set_param_send(wmi_handle, &param);
+	if (QDF_IS_STATUS_ERROR(status))
+		pkt_capture_err("failed to set beacon interval");
+
+	return status;
+}
+
 /**
  * target_if_mgmt_offload_data_event_handler() - offload event handler
  * @handle: scn handle
@@ -435,4 +473,6 @@ target_if_pkt_capture_register_tx_ops(struct wlan_pkt_capture_tx_ops *tx_ops)
 
 	tx_ops->pkt_capture_send_mode = target_if_set_packet_capture_mode;
 	tx_ops->pkt_capture_send_config = target_if_set_packet_capture_config;
+	tx_ops->pkt_capture_send_beacon_interval =
+				target_if_set_packet_capture_beacon_interval;
 }