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

Commit 4f346031 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge changes...

Merge changes Id60529b9,Ifc7f0ecf,I9aeb8071,Ibf24349d,Ieddb96d8,Ibeb9f9a7,Ie45ea213,Ib6d0d8ab into wlan-cld3.driver.lnx.2.0.8.r3-rel

* changes:
  qcacld-3.0: Deliver tx offload mgmt pkts based on filter
  qcacld-3.0: Add check for mgmt/ctrl tx packets in pkt capture
  qcacld-3.0: Add check for mgmt/ctrl rx packets in pkt capture
  qcacld-3.0: Add filter for data packets in packet capture mode
  qcacld-3.0: Add check for data tx rx based on vendor command
  qcacld-3.0: Add tgt support to send beacon report period to FW
  qcacld-3.0: Add support to send config to FW based on filter
  qcacld-3.0: Add support to send mode to FW based on frame filter
parents 15def9c7 1f4a0128
Loading
Loading
Loading
Loading
+27 −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
@@ -211,6 +230,14 @@ void pkt_capture_mon(struct pkt_capture_cb_context *cb_ctx, qdf_nbuf_t msdu,
QDF_STATUS pkt_capture_set_filter(struct pkt_capture_frame_filter frame_filter,
				  struct wlan_objmgr_vdev *vdev);

/**
 * pkt_capture_is_tx_mgmt_enable - Check if tx mgmt frames enabled
 * @pdev: pointer to pdev
 *
 * Return: bool
 */
bool pkt_capture_is_tx_mgmt_enable(struct wlan_objmgr_pdev *pdev);

#ifdef WLAN_FEATURE_PKT_CAPTURE_V2
/**
 * pkt_capture_get_pktcap_mode_v2 - Get packet capture mode
+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;
};

/**
+471 −138
Original line number Diff line number Diff line
@@ -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;

@@ -250,16 +251,13 @@ pkt_capture_process_ppdu_stats(void *log_data)
	qdf_spin_unlock(&vdev_priv->lock_q);
}

void pkt_capture_callback(void *soc, enum WDI_EVENT event, void *log_data,
			  u_int16_t vdev_id, uint32_t status)
static void
pkt_capture_process_tx_data(void *soc, void *log_data, u_int16_t vdev_id,
			    uint32_t status)
{
	uint8_t bssid[QDF_MAC_ADDR_SIZE];
	uint8_t tid = 0;
	struct dp_soc *psoc = soc;

	switch (event) {
	case WDI_EVENT_PKT_CAPTURE_TX_DATA:
	{
	uint8_t tid = 0;
	uint8_t bssid[QDF_MAC_ADDR_SIZE];
	struct pkt_capture_tx_hdr_elem_t *ptr_pktcapture_hdr;
	struct pkt_capture_tx_hdr_elem_t pktcapture_hdr = {0};
	struct hal_tx_completion_status tx_comp_status = {0};
@@ -273,10 +271,6 @@ void pkt_capture_callback(void *soc, enum WDI_EVENT event, void *log_data,

	hal_tx_comp_get_status(&desc->comp, &tx_comp_status,
			       psoc->hal_soc);
		if (!(pkt_capture_get_pktcap_mode_v2() &
					PKT_CAPTURE_MODE_DATA_ONLY)) {
			return;
		}

	if (tx_comp_status.valid)
		pktcapture_hdr.ppdu_id = tx_comp_status.ppdu_id;
@@ -390,18 +384,160 @@ void pkt_capture_callback(void *soc, enum WDI_EVENT event, void *log_data,
		vdev_id, netbuf, TXRX_PROCESS_TYPE_DATA_TX_COMPL,
		tid, status, TXRX_PKTCAPTURE_PKT_FORMAT_8023,
		bssid, NULL, pktcapture_hdr.tx_retry_cnt);
}

/**
 * pkt_capture_is_frame_filter_set() - Check frame filter is set
 * @nbuf: buffer address
 * @frame_filter: frame filter address
 * @direction: frame direction
 *
 * Return: true, if filter bit is set
 *         false, if filter bit is not set
 */
static bool
pkt_capture_is_frame_filter_set(qdf_nbuf_t buf,
				struct pkt_capture_frame_filter *frame_filter,
				bool direction)
{
	enum pkt_capture_data_frame_type data_frame_type =
		PKT_CAPTURE_DATA_FRAME_TYPE_ALL;

	if (qdf_nbuf_is_ipv4_arp_pkt(buf))
		data_frame_type = PKT_CAPTURE_DATA_FRAME_TYPE_ARP;
	else if (qdf_nbuf_is_ipv4_eapol_pkt(buf))
		data_frame_type = PKT_CAPTURE_DATA_FRAME_TYPE_EAPOL;
	else if (qdf_nbuf_data_is_tcp_syn(buf))
		data_frame_type =
			PKT_CAPTURE_DATA_FRAME_TYPE_TCP_SYN;
	else if (qdf_nbuf_data_is_tcp_syn_ack(buf))
		data_frame_type =
			PKT_CAPTURE_DATA_FRAME_TYPE_TCP_SYNACK;
	else if (qdf_nbuf_data_is_tcp_syn(buf))
		data_frame_type =
			PKT_CAPTURE_DATA_FRAME_TYPE_TCP_FIN;
	else if (qdf_nbuf_data_is_tcp_syn_ack(buf))
		data_frame_type =
			PKT_CAPTURE_DATA_FRAME_TYPE_TCP_FINACK;
	else if (qdf_nbuf_data_is_tcp_ack(buf))
		data_frame_type =
			PKT_CAPTURE_DATA_FRAME_TYPE_TCP_ACK;
	else if (qdf_nbuf_data_is_tcp_rst(buf))
		data_frame_type =
			PKT_CAPTURE_DATA_FRAME_TYPE_TCP_RST;
	else if (qdf_nbuf_is_ipv4_pkt(buf)) {
		if (qdf_nbuf_is_ipv4_dhcp_pkt(buf))
			data_frame_type =
				PKT_CAPTURE_DATA_FRAME_TYPE_DHCPV4;
		else if (qdf_nbuf_is_icmp_pkt(buf))
			data_frame_type =
				PKT_CAPTURE_DATA_FRAME_TYPE_ICMPV4;
		else if (qdf_nbuf_data_is_dns_query(buf))
			data_frame_type =
				PKT_CAPTURE_DATA_FRAME_TYPE_DNSV4;
		else if (qdf_nbuf_data_is_dns_response(buf))
			data_frame_type =
				PKT_CAPTURE_DATA_FRAME_TYPE_DNSV4;
	} else if (qdf_nbuf_is_ipv6_pkt(buf)) {
		if (qdf_nbuf_is_ipv6_dhcp_pkt(buf))
			data_frame_type =
				PKT_CAPTURE_DATA_FRAME_TYPE_DHCPV6;
		else if (qdf_nbuf_is_icmpv6_pkt(buf))
			data_frame_type =
				PKT_CAPTURE_DATA_FRAME_TYPE_ICMPV6;
		/* need to add code for
		 * PKT_CAPTURE_DATA_FRAME_TYPE_DNSV6
		 */
	}
	/* Add code for
	 * PKT_CAPTURE_DATA_FRAME_TYPE_RTP
	 * PKT_CAPTURE_DATA_FRAME_TYPE_SIP
	 * PKT_CAPTURE_DATA_FRAME_QOS_NULL
	 */

	if (direction == IEEE80211_FC1_DIR_TODS) {
		if (data_frame_type & frame_filter->data_tx_frame_filter)
			return true;
		else
			return false;
	} else {
		if (data_frame_type & frame_filter->data_rx_frame_filter)
			return true;
		else
			return false;
	}
}

void pkt_capture_callback(void *soc, enum WDI_EVENT event, void *log_data,
			  u_int16_t vdev_id, uint32_t status)
{
	uint8_t bssid[QDF_MAC_ADDR_SIZE];
	struct wlan_objmgr_vdev *vdev;
	struct wlan_objmgr_psoc *obj_mgr_psoc;
	struct pkt_psoc_priv *psoc_priv;
	struct pkt_capture_frame_filter *frame_filter;

	vdev = pkt_capture_get_vdev();
	if (!vdev)
		return;

	obj_mgr_psoc = wlan_vdev_get_psoc(vdev);
	psoc_priv = pkt_capture_psoc_get_priv(obj_mgr_psoc);
	if (!psoc_priv) {
		pkt_capture_err("psoc_priv is NULL");
		return;
	}

	frame_filter = &psoc_priv->frame_filter;

	switch (event) {
	case WDI_EVENT_PKT_CAPTURE_TX_DATA:
	{
		struct dp_tx_desc_s *desc = log_data;

		if (!frame_filter->data_tx_frame_filter)
			return;

		if (frame_filter->data_tx_frame_filter &
		    PKT_CAPTURE_DATA_FRAME_TYPE_ALL) {
			pkt_capture_process_tx_data(soc, log_data,
						    vdev_id, status);
		} else if (pkt_capture_is_frame_filter_set(
			   desc->nbuf, frame_filter, IEEE80211_FC1_DIR_TODS)) {
			pkt_capture_process_tx_data(soc, log_data,
						    vdev_id, status);
		}

		break;
	}

	case WDI_EVENT_PKT_CAPTURE_RX_DATA:
	{
		if (!(pkt_capture_get_pktcap_mode_v2() &
					PKT_CAPTURE_MODE_DATA_ONLY))
		qdf_nbuf_t nbuf = (qdf_nbuf_t)log_data;

		if (!frame_filter->data_rx_frame_filter) {
			/*
			 * Rx offload packets are delivered only to pkt capture
			 * component and not to stack so free them.
			 */
			if (status == RX_OFFLOAD_PKT)
				qdf_nbuf_free(nbuf);
			return;
		}

		if (frame_filter->data_rx_frame_filter &
		    PKT_CAPTURE_DATA_FRAME_TYPE_ALL) {
			pkt_capture_msdu_process_pkts(bssid, log_data,
						      vdev_id, soc, status);
		} else if (pkt_capture_is_frame_filter_set(
			   nbuf, frame_filter, IEEE80211_FC1_DIR_FROMDS)) {
			pkt_capture_msdu_process_pkts(bssid, log_data,
						      vdev_id, soc, status);
		} else {
			if (status == RX_OFFLOAD_PKT)
				qdf_nbuf_free(nbuf);
		}

		pkt_capture_msdu_process_pkts(bssid, log_data, vdev_id, soc,
					      status);
		break;
	}

@@ -409,8 +545,7 @@ void pkt_capture_callback(void *soc, enum WDI_EVENT event, void *log_data,
	{
		qdf_nbuf_t nbuf = (qdf_nbuf_t)log_data;

		if (!(pkt_capture_get_pktcap_mode_v2() &
					PKT_CAPTURE_MODE_DATA_ONLY)) {
		if (!frame_filter->data_rx_frame_filter) {
			/*
			 * Rx offload packets are delivered only to pkt capture
			 * component and not to stack so free them
@@ -420,8 +555,19 @@ void pkt_capture_callback(void *soc, enum WDI_EVENT event, void *log_data,
			return;
		}

		pkt_capture_process_rx_data_no_peer(soc, vdev_id, bssid, status,
						    nbuf);
		if (frame_filter->data_rx_frame_filter &
		    PKT_CAPTURE_DATA_FRAME_TYPE_ALL) {
			pkt_capture_process_rx_data_no_peer(soc, vdev_id, bssid,
							    status, nbuf);
		} else if (pkt_capture_is_frame_filter_set(
			   nbuf, frame_filter, IEEE80211_FC1_DIR_FROMDS)) {
			pkt_capture_process_rx_data_no_peer(soc, vdev_id, bssid,
							    status, nbuf);
		} else {
			if (status == RX_OFFLOAD_PKT)
				qdf_nbuf_free(nbuf);
		}

		break;
	}

@@ -430,9 +576,10 @@ void pkt_capture_callback(void *soc, enum WDI_EVENT event, void *log_data,
		struct htt_tx_offload_deliver_ind_hdr_t *offload_deliver_msg;
		bool is_pkt_during_roam = false;
		uint32_t freq = 0;
		qdf_nbuf_t buf = log_data +
				sizeof(struct htt_tx_offload_deliver_ind_hdr_t);

		if (!(pkt_capture_get_pktcap_mode_v2() &
					PKT_CAPTURE_MODE_DATA_ONLY))
		if (!frame_filter->data_tx_frame_filter)
			return;

		offload_deliver_msg =
@@ -448,9 +595,17 @@ void pkt_capture_callback(void *soc, enum WDI_EVENT event, void *log_data,
			vdev_id = offload_deliver_msg->vdev_id;
		}

		if (frame_filter->data_tx_frame_filter &
		    PKT_CAPTURE_DATA_FRAME_TYPE_ALL) {
			pkt_capture_offload_deliver_indication_handler(
							log_data,
							vdev_id, bssid, soc);
		} else if (pkt_capture_is_frame_filter_set(
			   buf, frame_filter, IEEE80211_FC1_DIR_TODS)) {
			pkt_capture_offload_deliver_indication_handler(
							log_data,
							vdev_id, bssid, soc);
		}
		break;
	}

@@ -496,6 +651,30 @@ enum pkt_capture_mode pkt_capture_get_mode(struct wlan_objmgr_psoc *psoc)
	return psoc_priv->cfg_param.pkt_capture_mode;
}

bool pkt_capture_is_tx_mgmt_enable(struct wlan_objmgr_pdev *pdev)
{
	struct pkt_psoc_priv *psoc_priv;
	struct wlan_objmgr_psoc *psoc;

	psoc = wlan_pdev_get_psoc(pdev);
	if (!psoc) {
		pkt_capture_err("psoc is NULL");
		return false;
	}

	psoc_priv = pkt_capture_psoc_get_priv(psoc);
	if (!psoc_priv) {
		pkt_capture_err("psoc priv is NULL");
		return false;
	}

	if (!(psoc_priv->frame_filter.mgmt_tx_frame_filter &
	    PKT_CAPTURE_MGMT_FRAME_TYPE_ALL))
		return false;

	return true;
}

QDF_STATUS
pkt_capture_register_callbacks(struct wlan_objmgr_vdev *vdev,
			       QDF_STATUS (*mon_cb)(void *, qdf_nbuf_t),
@@ -686,6 +865,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
@@ -983,6 +1221,13 @@ QDF_STATUS pkt_capture_set_filter(struct pkt_capture_frame_filter frame_filter,
{
	struct pkt_psoc_priv *psoc_priv;
	struct wlan_objmgr_psoc *psoc;
	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, send_bcn = 0;
	struct vdev_mlme_obj *vdev_mlme;
	uint32_t bcn_interval, nth_beacon_value;

	if (!vdev) {
		pkt_capture_err("vdev is NULL");
@@ -1027,9 +1272,97 @@ 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))
	    BIT(PKT_CAPTURE_ATTR_SET_MONITOR_MODE_CONNECTED_BEACON_INTERVAL)) {
		if (frame_filter.connected_beacon_interval !=
		    psoc_priv->frame_filter.connected_beacon_interval) {
			psoc_priv->frame_filter.connected_beacon_interval =
					frame_filter.connected_beacon_interval;
			send_bcn = 1;
		}
	}

	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;

	if (mode != pkt_capture_get_pktcap_mode(psoc)) {
		status = tgt_pkt_capture_send_mode(vdev, mode);
		if (QDF_IS_STATUS_ERROR(status)) {
			pkt_capture_err("Unable to send packet capture mode");
			return status;
		}
		soc = wlan_psoc_get_dp_handle(psoc);
		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;
		}
	}

	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);

		nth_beacon_value =
			psoc_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("Unable to send beacon interval to fw");
			return status;
		}
	}
	return QDF_STATUS_SUCCESS;
}
+80 −3
Original line number Diff line number Diff line
@@ -329,15 +329,39 @@ void pkt_capture_mgmt_tx(struct wlan_objmgr_pdev *pdev,
			 uint16_t chan_freq,
			 uint8_t preamble_type)
{
	struct mgmt_offload_event_params params = {0};
	tpSirMacFrameCtl pfc = (tpSirMacFrameCtl)(qdf_nbuf_data(nbuf));
	struct pkt_psoc_priv *psoc_priv;
	struct wlan_objmgr_psoc *psoc;
	qdf_nbuf_t wbuf;
	int nbuf_len;
	struct mgmt_offload_event_params params = {0};

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

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

	psoc_priv = pkt_capture_psoc_get_priv(psoc);
	if (!psoc_priv) {
		pkt_capture_err("psoc priv is NULL");
		return;
	}

	if (pfc->type == IEEE80211_FC0_TYPE_MGT &&
	    !(psoc_priv->frame_filter.mgmt_tx_frame_filter &
	    PKT_CAPTURE_MGMT_FRAME_TYPE_ALL))
		return;

	if (pfc->type == IEEE80211_FC0_TYPE_CTL &&
	    !psoc_priv->frame_filter.ctrl_tx_frame_filter)
		return;

	nbuf_len = qdf_nbuf_len(nbuf);
	wbuf = qdf_nbuf_alloc(NULL, roundup(nbuf_len + RESERVE_BYTES, 4),
			      RESERVE_BYTES, 4, false);
@@ -380,6 +404,9 @@ pkt_capture_mgmt_tx_completion(struct wlan_objmgr_pdev *pdev,
			       uint32_t status,
			       struct mgmt_offload_event_params *params)
{
	struct pkt_psoc_priv *psoc_priv;
	struct wlan_objmgr_psoc *psoc;
	tpSirMacFrameCtl pfc;
	qdf_nbuf_t wbuf, nbuf;
	int nbuf_len;

@@ -388,9 +415,30 @@ pkt_capture_mgmt_tx_completion(struct wlan_objmgr_pdev *pdev,
		return;
	}

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

	psoc_priv = pkt_capture_psoc_get_priv(psoc);
	if (!psoc_priv) {
		pkt_capture_err("psoc priv is NULL");
		return;
	}

	nbuf = mgmt_txrx_get_nbuf(pdev, desc_id);
	if (!nbuf)
		return;
	pfc = (tpSirMacFrameCtl)(qdf_nbuf_data(nbuf));
	if (pfc->type == IEEE80211_FC0_TYPE_MGT &&
	    !(psoc_priv->frame_filter.mgmt_tx_frame_filter &
	    PKT_CAPTURE_MGMT_FRAME_TYPE_ALL))
		return;

	if (pfc->type == IEEE80211_FC0_TYPE_CTL &&
	    !psoc_priv->frame_filter.ctrl_tx_frame_filter)
		return;

	nbuf_len = qdf_nbuf_len(nbuf);
	wbuf = qdf_nbuf_alloc(NULL, roundup(nbuf_len + RESERVE_BYTES, 4),
@@ -426,17 +474,43 @@ pkt_capture_mgmt_rx_data_cb(struct wlan_objmgr_psoc *psoc,
			    enum mgmt_frame_type frm_type)
{
	struct mon_rx_status txrx_status = {0};
	struct pkt_psoc_priv *psoc_priv;
	struct ieee80211_frame *wh;
	tpSirMacFrameCtl pfc;
	qdf_nbuf_t nbuf;
	int buf_len;
	struct wlan_objmgr_vdev *vdev;

	if (!(pkt_capture_get_pktcap_mode(psoc) & PKT_CAPTURE_MODE_MGMT_ONLY)) {
		qdf_nbuf_free(wbuf);
	psoc_priv = pkt_capture_psoc_get_priv(psoc);
	if (!psoc_priv) {
		pkt_capture_err("psoc priv is NULL");
		return QDF_STATUS_E_FAILURE;
	}

	pfc = (tpSirMacFrameCtl)(qdf_nbuf_data(wbuf));

	if (pfc->type == SIR_MAC_CTRL_FRAME  &&
	    !psoc_priv->frame_filter.ctrl_rx_frame_filter)
		goto exit;

	if (pfc->type == SIR_MAC_MGMT_FRAME  &&
	    !psoc_priv->frame_filter.mgmt_rx_frame_filter)
		goto exit;

	if (pfc->type == SIR_MAC_MGMT_FRAME) {
		if (pfc->subType == SIR_MAC_MGMT_BEACON) {
			if (psoc_priv->frame_filter.mgmt_rx_frame_filter &
			    PKT_CAPTURE_MGMT_CONNECT_NO_BEACON)
				goto exit;
		} else {
			if (!((psoc_priv->frame_filter.mgmt_rx_frame_filter &
			    PKT_CAPTURE_MGMT_FRAME_TYPE_ALL) ||
			    (psoc_priv->frame_filter.mgmt_rx_frame_filter &
			    PKT_CAPTURE_MGMT_CONNECT_NO_BEACON)))
				goto exit;
		}
	}

	buf_len = qdf_nbuf_len(wbuf);
	nbuf = qdf_nbuf_alloc(NULL, roundup(
				  buf_len + RESERVE_BYTES, 4),
@@ -501,6 +575,9 @@ pkt_capture_mgmt_rx_data_cb(struct wlan_objmgr_psoc *psoc,
		qdf_nbuf_free(nbuf);

	return QDF_STATUS_SUCCESS;
exit:
	qdf_nbuf_free(wbuf);
	return QDF_STATUS_SUCCESS;
}

QDF_STATUS pkt_capture_mgmt_rx_ops(struct wlan_objmgr_psoc *psoc,
+18 −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,11 @@ 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);
	QDF_STATUS (*pkt_capture_send_beacon_interval)
				(struct wlan_objmgr_psoc *psoc,
				 uint8_t vdev_id,
				 uint32_t nth_value);
};

/**
Loading