Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit dbc1c1a8 authored by Vulupala Shashank Reddy's avatar Vulupala Shashank Reddy Committed by Gerrit - the friendly Code Review server
Browse files

qcacld-3.0: Add support to send config to FW based on filter

In packet cpature component add support to send ctrl frames
config to FW based on frame filter received from user through
vendor command.

Change-Id: Ie45ea2135e237a156fb60663e3f85cc601490e4a
CRs-Fixed: 3046222
parent 3b939c69
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -172,6 +172,25 @@ void pkt_capture_set_pktcap_mode(struct wlan_objmgr_psoc *psoc,
enum pkt_capture_mode
pkt_capture_get_pktcap_mode(struct wlan_objmgr_psoc *psoc);

/**
 * pkt_capture_set_pktcap_config - Set packet capture config
 * @psoc: pointer to psoc object
 * @config: config to be set
 *
 * Return: None
 */
void pkt_capture_set_pktcap_config(struct wlan_objmgr_psoc *psoc,
				   enum pkt_capture_config config);

/**
 * pkt_capture_get_pktcap_config - Get packet capture config
 * @psoc: pointer to psoc object
 *
 * Return: config value
 */
enum pkt_capture_config
pkt_capture_get_pktcap_config(struct wlan_objmgr_psoc *psoc);

/**
 * pkt_capture_drop_nbuf_list() - drop an nbuf list
 * @buf_list: buffer list to be dropepd
+2 −0
Original line number Diff line number Diff line
@@ -44,11 +44,13 @@ struct pkt_capture_cfg {
 * @mon_cb: monitor callback function pointer
 * @mon_ctx: monitor callback context
 * @pkt_capture_mode: packet capture mode
 * @pkt_capture_config: pakcet capture config
 */
struct pkt_capture_cb_context {
	QDF_STATUS (*mon_cb)(void *, qdf_nbuf_t);
	void *mon_ctx;
	enum pkt_capture_mode pkt_capture_mode;
	enum pkt_capture_config pkt_capture_config;
};

/**
+104 −2
Original line number Diff line number Diff line
@@ -686,6 +686,65 @@ pkt_capture_get_pktcap_mode(struct wlan_objmgr_psoc *psoc)
	return mode;
}

void pkt_capture_set_pktcap_config(struct wlan_objmgr_psoc *psoc,
				   enum pkt_capture_config config)
{
	struct pkt_capture_vdev_priv *vdev_priv;
	struct wlan_objmgr_vdev *vdev;

	if (!psoc) {
		pkt_capture_err("psoc is NULL");
		return;
	}

	vdev = wlan_objmgr_get_vdev_by_opmode_from_psoc(psoc,
							QDF_STA_MODE,
							WLAN_PKT_CAPTURE_ID);
	if (!vdev) {
		pkt_capture_err("vdev is NULL");
		return;
	}

	vdev_priv = pkt_capture_vdev_get_priv(vdev);
	if (vdev_priv)
		vdev_priv->cb_ctx->pkt_capture_config = config;
	else
		pkt_capture_err("vdev_priv is NULL");

	wlan_objmgr_vdev_release_ref(vdev, WLAN_PKT_CAPTURE_ID);
}

enum pkt_capture_config
pkt_capture_get_pktcap_config(struct wlan_objmgr_psoc *psoc)
{
	enum pkt_capture_config config = 0;
	struct pkt_capture_vdev_priv *vdev_priv;
	struct wlan_objmgr_vdev *vdev;

	if (!psoc) {
		pkt_capture_err("psoc is NULL");
		return 0;
	}

	if (!pkt_capture_get_mode(psoc))
		return 0;

	vdev = wlan_objmgr_get_vdev_by_opmode_from_psoc(psoc,
							QDF_STA_MODE,
							WLAN_PKT_CAPTURE_ID);
	if (!vdev)
		return 0;

	vdev_priv = pkt_capture_vdev_get_priv(vdev);
	if (!vdev_priv)
		pkt_capture_err("vdev_priv is NULL");
	else
		config = vdev_priv->cb_ctx->pkt_capture_config;

	wlan_objmgr_vdev_release_ref(vdev, WLAN_PKT_CAPTURE_ID);
	return config;
}

/**
 * pkt_capture_callback_ctx_create() - Create packet capture callback context
 * @vdev_priv: pointer to packet capture vdev priv obj
@@ -986,6 +1045,8 @@ QDF_STATUS pkt_capture_set_filter(struct pkt_capture_frame_filter frame_filter,
	enum pkt_capture_mode mode = PACKET_CAPTURE_MODE_DISABLE;
	struct dp_soc *soc;
	QDF_STATUS status;
	enum pkt_capture_config config = 0;
	bool check_enable_beacon = 0;

	if (!vdev) {
		pkt_capture_err("vdev is NULL");
@@ -1034,10 +1095,35 @@ QDF_STATUS pkt_capture_set_filter(struct pkt_capture_frame_filter frame_filter,
		psoc_priv->frame_filter.connected_beacon_interval =
			frame_filter.connected_beacon_interval;

	if (psoc_priv->frame_filter.mgmt_tx_frame_filter ||
	    psoc_priv->frame_filter.mgmt_rx_frame_filter)
	if (psoc_priv->frame_filter.mgmt_tx_frame_filter)
		mode |= PACKET_CAPTURE_MODE_MGMT_ONLY;

	if (psoc_priv->frame_filter.mgmt_rx_frame_filter &
	    PKT_CAPTURE_MGMT_FRAME_TYPE_ALL) {
		mode |= PACKET_CAPTURE_MODE_MGMT_ONLY;
		config |= 1 << PACKET_CAPTURE_CONFIG_BEACON_ENABLE;
		config |= 1 << PACKET_CAPTURE_CONFIG_OFF_CHANNEL_BEACON_ENABLE;
	} else {
		if (psoc_priv->frame_filter.mgmt_rx_frame_filter &
		    PKT_CAPTURE_MGMT_CONNECT_NO_BEACON) {
			mode |= PACKET_CAPTURE_MODE_MGMT_ONLY;
			config |= 1 << PACKET_CAPTURE_CONFIG_NO_BEACON_ENABLE;
		} else {
			check_enable_beacon = 1;
		}
	}

	if (check_enable_beacon) {
		if (psoc_priv->frame_filter.mgmt_rx_frame_filter &
		    PKT_CAPTURE_MGMT_CONNECT_BEACON)
			config |= 1 << PACKET_CAPTURE_CONFIG_BEACON_ENABLE;

		if (psoc_priv->frame_filter.mgmt_rx_frame_filter &
		    PKT_CAPTURE_MGMT_CONNECT_SCAN_BEACON)
			config |= 1 <<
				PACKET_CAPTURE_CONFIG_OFF_CHANNEL_BEACON_ENABLE;
	}

	if (psoc_priv->frame_filter.data_tx_frame_filter ||
	    psoc_priv->frame_filter.data_rx_frame_filter)
		mode |= PACKET_CAPTURE_MODE_DATA_ONLY;
@@ -1052,5 +1138,21 @@ QDF_STATUS pkt_capture_set_filter(struct pkt_capture_frame_filter frame_filter,
		soc->wlan_cfg_ctx->pkt_capture_mode = mode;
	}

	if (psoc_priv->frame_filter.ctrl_tx_frame_filter ||
	    psoc_priv->frame_filter.ctrl_rx_frame_filter)
		config |= 1 << PACKET_CAPTURE_CONFIG_TRIGGER_ENABLE;

	if (psoc_priv->frame_filter.data_rx_frame_filter &
	    PKT_CAPTURE_DATA_FRAME_QOS_NULL)
		config |= 1 << PACKET_CAPTURE_CONFIG_QOS_ENABLE;

	if (config != pkt_capture_get_pktcap_config(psoc)) {
		status = tgt_pkt_capture_send_config(vdev, config);
		if (QDF_IS_STATUS_ERROR(status)) {
			pkt_capture_err("packet capture send config failed");
			return status;
		}
	}

	return QDF_STATUS_SUCCESS;
}
+14 −11
Original line number Diff line number Diff line
@@ -38,19 +38,22 @@ enum pkt_capture_mode {
};

/**
 * enum pkt_capture_trigger_qos_config - packet capture config
 * @PACKET_CAPTURE_CONFIG_TRIGGER_QOS_DISABLE: disable capture for trigger and
 *                                             qos frames
 * enum pkt_capture_config - packet capture config
 * @PACKET_CAPTURE_CONFIG_TRIGGER_ENABLE: enable capture for trigger frames only
 * @PACKET_CAPTURE_CONFIG_QOS_ENABLE: enable capture for qos frames only
 * @PACKET_CAPTURE_CONFIG_TRIGGER_QOS_ENABLE: enable capture for both trigger
 *                                            and qos frames
 * @PACKET_CAPTURE_CONFIG_CONNECT_NO_BEACON_ENABLE: drop all beacons, when
 *                                                  device in connected state
 * @PACKET_CAPTURE_CONFIG_CONNECT_BEACON_ENABLE: enable only connected BSSID
 *                                      beacons, when device in connected state
 * @PACKET_CAPTURE_CONFIG_CONNECT_OFF_CHANNEL_BEACON_ENABLE: enable off channel
 *                                      beacons, when device in connected state
 */
enum pkt_capture_trigger_qos_config {
	PACKET_CAPTURE_CONFIG_TRIGGER_QOS_DISABLE = 0,
	PACKET_CAPTURE_CONFIG_TRIGGER_ENABLE,
	PACKET_CAPTURE_CONFIG_QOS_ENABLE,
	PACKET_CAPTURE_CONFIG_TRIGGER_QOS_ENABLE,
enum pkt_capture_config {
	PACKET_CAPTURE_CONFIG_TRIGGER_ENABLE = BIT(0),
	PACKET_CAPTURE_CONFIG_QOS_ENABLE = BIT(1),
	PACKET_CAPTURE_CONFIG_NO_BEACON_ENABLE = BIT(2),
	PACKET_CAPTURE_CONFIG_BEACON_ENABLE = BIT(3),
	PACKET_CAPTURE_CONFIG_OFF_CHANNEL_BEACON_ENABLE = BIT(4),
};

/**
@@ -106,7 +109,7 @@ struct wlan_pkt_capture_tx_ops {
	QDF_STATUS (*pkt_capture_send_config)
				(struct wlan_objmgr_psoc *psoc,
				 uint8_t vdev_id,
				 enum pkt_capture_trigger_qos_config config);
				 enum pkt_capture_config config);
};

/**
+2 −2
Original line number Diff line number Diff line
@@ -53,7 +53,6 @@ QDF_STATUS
tgt_pkt_capture_send_mode(struct wlan_objmgr_vdev *vdev,
			  enum pkt_capture_mode mode);

#ifdef WLAN_FEATURE_PKT_CAPTURE_V2
/**
 * tgt_pkt_capture_send_config() - send packet capture config to firmware
 * @vdev: pointer to vdev object
@@ -63,8 +62,9 @@ tgt_pkt_capture_send_mode(struct wlan_objmgr_vdev *vdev,
 */
QDF_STATUS
tgt_pkt_capture_send_config(struct wlan_objmgr_vdev *vdev,
			    enum pkt_capture_trigger_qos_config config);
			    enum pkt_capture_config config);

#ifdef WLAN_FEATURE_PKT_CAPTURE_V2
/**
 * tgt_pkt_capture_smu_event() - Receive smart monitor event from firmware
 * @psoc: pointer to psoc
Loading