qcacmn: Define CDP Ops for packet capture mode
Define CDP Ops for packet capture mode
Change-Id: If08191f47060210f4340940d01be8eb2cf8cc426
CRs-Fixed: 2528432
diff --git a/dp/inc/cdp_txrx_mon.h b/dp/inc/cdp_txrx_mon.h
index 1c8c9a8..ba990e0 100644
--- a/dp/inc/cdp_txrx_mon.h
+++ b/dp/inc/cdp_txrx_mon.h
@@ -190,4 +190,144 @@
soc->ops->mon_ops->txrx_deliver_tx_mgmt(pdev, nbuf);
}
+
+#ifdef WLAN_FEATURE_PKT_CAPTURE
+static inline void
+cdp_pktcapture_record_channel(
+ ol_txrx_soc_handle soc,
+ uint8_t pdev_id,
+ int chan_num)
+{
+ if (!soc || !soc->ops) {
+ QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,
+ "%s invalid instance", __func__);
+ QDF_BUG(0);
+ return;
+ }
+
+ if (!soc->ops->pktcapture_ops ||
+ !soc->ops->pktcapture_ops->txrx_pktcapture_record_channel)
+ return;
+
+ soc->ops->pktcapture_ops->txrx_pktcapture_record_channel(soc,
+ pdev_id,
+ chan_num);
+}
+
+static inline void
+cdp_set_packet_capture_mode(ol_txrx_soc_handle soc,
+ uint8_t pdev_id,
+ uint8_t val)
+{
+ if (!soc || !soc->ops) {
+ QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,
+ "%s invalid instance", __func__);
+ QDF_BUG(0);
+ return;
+ }
+
+ if (!soc->ops->pktcapture_ops ||
+ !soc->ops->pktcapture_ops->txrx_pktcapture_set_mode)
+ return;
+
+ soc->ops->pktcapture_ops->txrx_pktcapture_set_mode(soc, pdev_id, val);
+}
+
+static inline uint8_t
+cdp_get_packet_capture_mode(ol_txrx_soc_handle soc, uint8_t pdev_id)
+{
+ if (!soc || !soc->ops) {
+ QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG,
+ "%s invalid instance", __func__);
+ QDF_BUG(0);
+ return 0;
+ }
+
+ if (!soc->ops->pktcapture_ops ||
+ !soc->ops->pktcapture_ops->txrx_pktcapture_get_mode)
+ return 0;
+
+ return soc->ops->pktcapture_ops->txrx_pktcapture_get_mode(soc,
+ pdev_id);
+}
+
+static inline QDF_STATUS
+cdp_register_pktcapture_cb(
+ ol_txrx_soc_handle soc, uint8_t pdev_id, void *ctx,
+ QDF_STATUS(txrx_pktcapture_cb)(void *, qdf_nbuf_t))
+{
+ if (!soc || !soc->ops) {
+ QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
+ "%s invalid instance", __func__);
+ return QDF_STATUS_E_INVAL;
+ }
+
+ if (!soc->ops->pktcapture_ops ||
+ !soc->ops->pktcapture_ops->txrx_pktcapture_cb_register)
+ return QDF_STATUS_E_INVAL;
+
+ return soc->ops->pktcapture_ops->txrx_pktcapture_cb_register(
+ soc,
+ pdev_id,
+ ctx,
+ txrx_pktcapture_cb);
+}
+
+static inline QDF_STATUS
+cdp_deregister_pktcapture_cb(ol_txrx_soc_handle soc, uint8_t pdev_id)
+{
+ if (!soc || !soc->ops) {
+ QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
+ "%s invalid instance", __func__);
+ return QDF_STATUS_E_INVAL;
+ }
+
+ if (!soc->ops->pktcapture_ops ||
+ !soc->ops->pktcapture_ops->txrx_pktcapture_cb_deregister)
+ return QDF_STATUS_E_INVAL;
+
+ return soc->ops->pktcapture_ops->txrx_pktcapture_cb_deregister(soc,
+ pdev_id);
+}
+
+static inline QDF_STATUS
+cdp_pktcapture_mgmtpkt_process(
+ ol_txrx_soc_handle soc,
+ uint8_t pdev_id,
+ struct mon_rx_status *txrx_status,
+ qdf_nbuf_t nbuf,
+ uint8_t status)
+{
+ if (!soc || !soc->ops) {
+ QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
+ "%s invalid instance", __func__);
+ return QDF_STATUS_E_INVAL;
+ }
+
+ if (!soc->ops->pktcapture_ops ||
+ !soc->ops->pktcapture_ops->txrx_pktcapture_mgmtpkt_process)
+ return QDF_STATUS_E_INVAL;
+
+ return soc->ops->pktcapture_ops->txrx_pktcapture_mgmtpkt_process(
+ soc,
+ pdev_id,
+ txrx_status,
+ nbuf,
+ status);
+}
+#else
+static inline uint8_t
+cdp_get_packet_capture_mode(ol_txrx_soc_handle soc, uint8_t pdev_id)
+{
+ return 0;
+}
+
+static inline void
+cdp_pktcapture_record_channel(ol_txrx_soc_handle soc,
+ uint8_t pdev_id,
+ int chan_num)
+{
+}
+#endif /* WLAN_FEATURE_PKT_CAPTURE */
+
#endif
diff --git a/dp/inc/cdp_txrx_ops.h b/dp/inc/cdp_txrx_ops.h
index f14398c..73888b9 100644
--- a/dp/inc/cdp_txrx_ops.h
+++ b/dp/inc/cdp_txrx_ops.h
@@ -756,6 +756,40 @@
(struct cdp_pdev *pdev, qdf_nbuf_t nbuf);
};
+#ifdef WLAN_FEATURE_PKT_CAPTURE
+struct cdp_pktcapture_ops {
+ void (*txrx_pktcapture_set_mode)
+ (struct cdp_soc_t *soc,
+ uint8_t pdev_id,
+ uint8_t mode);
+
+ uint8_t (*txrx_pktcapture_get_mode)
+ (struct cdp_soc_t *soc,
+ uint8_t pdev_id);
+
+ QDF_STATUS (*txrx_pktcapture_cb_register)
+ (struct cdp_soc_t *soc,
+ uint8_t pdev_id,
+ void *context,
+ QDF_STATUS(cb)(void *, qdf_nbuf_t));
+
+ QDF_STATUS (*txrx_pktcapture_cb_deregister)
+ (struct cdp_soc_t *soc,
+ uint8_t pdev_id);
+
+ QDF_STATUS (*txrx_pktcapture_mgmtpkt_process)
+ (struct cdp_soc_t *soc,
+ uint8_t pdev_id,
+ struct mon_rx_status *txrx_status,
+ qdf_nbuf_t nbuf, uint8_t status);
+
+ void (*txrx_pktcapture_record_channel)
+ (struct cdp_soc_t *soc,
+ uint8_t pdev_id,
+ int chan_no);
+};
+#endif /* #ifdef WLAN_FEATURE_PKT_CAPTURE */
+
struct cdp_host_stats_ops {
int (*txrx_host_stats_get)(struct cdp_vdev *vdev,
struct ol_txrx_stats_req *req);
@@ -1543,5 +1577,9 @@
#ifdef RECEIVE_OFFLOAD
struct cdp_rx_offld_ops *rx_offld_ops;
#endif
+#ifdef WLAN_FEATURE_PKT_CAPTURE
+ struct cdp_pktcapture_ops *pktcapture_ops;
+#endif
+
};
#endif
diff --git a/qdf/inc/qdf_types.h b/qdf/inc/qdf_types.h
index d2c4a5c..c316147 100644
--- a/qdf/inc/qdf_types.h
+++ b/qdf/inc/qdf_types.h
@@ -698,6 +698,7 @@
#define QDF_SAP_MASK (1 << QDF_SAP_MODE)
#define QDF_P2P_CLIENT_MASK (1 << QDF_P2P_CLIENT_MODE)
#define QDF_P2P_GO_MASK (1 << QDF_P2P_GO_MODE)
+#define QDF_MONITOR_MASK (1 << QDF_MONITOR_MODE)
#ifdef FEATURE_WLAN_MCC_TO_SCC_SWITCH