Prechádzať zdrojové kódy

qcacld-3.0: Register/deregister packet capture callbacks

Register/deregister packet capture callbacks.

Change-Id: I16e2c61349fc26d1166ac4b06dc160871c383846
CRs-Fixed: 2619312
Vulupala Shashank Reddy 5 rokov pred
rodič
commit
e96d28ed64

+ 0 - 123
core/dp/txrx/ol_txrx.c

@@ -5928,117 +5928,6 @@ void ol_deregister_packetdump_callback(struct cdp_soc_t *soc_hdl,
 	pdev->ol_rx_packetdump_cb = NULL;
 }
 
-#ifdef WLAN_FEATURE_PKT_CAPTURE
-/**
- * ol_txrx_register_pktcapture_cb() - Register pkt capture mode callback
- * @soc: soc handle
- * @pdev_id: pdev id
- * @context: virtual device's osif_dev
- * @cb: callback to register
- *
- * Return: QDF_STATUS Enumeration
- */
-static QDF_STATUS ol_txrx_register_pktcapture_cb(
-					struct cdp_soc_t *soc,
-					uint8_t pdev_id,
-					void *context,
-					QDF_STATUS(cb)(void *, qdf_nbuf_t))
-{
-	struct ol_txrx_pdev_t *pdev = ol_txrx_get_pdev_from_pdev_id(
-					cdp_soc_t_to_ol_txrx_soc_t(soc),
-					pdev_id);
-
-	if (!pdev) {
-		ol_txrx_err("pdev NULL!");
-		return QDF_STATUS_E_INVAL;
-	}
-
-	pdev->mon_osif_dev = context;
-	pdev->mon_cb = cb;
-	return QDF_STATUS_SUCCESS;
-}
-
-/**
- * ol_txrx_deregister_pktcapture_cb() - Register pkt capture mode callback
- * @soc: soc handle
- * @pdev_id: pdev id
- *
- * Return: QDF_STATUS Enumeration
- */
-static QDF_STATUS ol_txrx_deregister_pktcapture_cb(struct cdp_soc_t *soc,
-						   uint8_t pdev_id)
-{
-	ol_txrx_pdev_handle pdev = ol_txrx_get_pdev_from_pdev_id(
-					cdp_soc_t_to_ol_txrx_soc_t(soc),
-					pdev_id);
-
-	if (qdf_unlikely(!pdev)) {
-		qdf_print("%s: pdev is NULL!\n", __func__);
-		qdf_assert(0);
-		return QDF_STATUS_E_INVAL;
-	}
-
-	pdev->mon_osif_dev = NULL;
-	pdev->mon_cb = NULL;
-
-	return QDF_STATUS_SUCCESS;
-}
-
-/**
- * ol_txrx_get_pktcapture_mode() - return pktcapture mode
- * @soc: soc handle
- * @pdev_id: pdev id
- *
- * Return: 0 - disable
- *         1 - Mgmt packets
- *         2 - Data packets
- *         3 - Both Mgmt and Data packets
- */
-static uint8_t ol_txrx_get_pktcapture_mode(struct cdp_soc_t *soc,
-					   uint8_t pdev_id)
-{
-	struct ol_txrx_pdev_t *pdev = ol_txrx_get_pdev_from_pdev_id(
-					cdp_soc_t_to_ol_txrx_soc_t(soc),
-					pdev_id);
-
-	if (!pdev) {
-		qdf_print("%s: pdev is NULL\n", __func__);
-		return 0;
-	}
-
-	if (!pdev->mon_cb || !pdev->mon_osif_dev)
-		return 0;
-
-	return pdev->pktcapture_mode_value;
-}
-
-/**
- * ol_txrx_set_pktcapture_mode() - set pktcapture mode
- * @soc: soc handle
- * @pdev_id: pdev id
- * @val  : 0 - disable
- *         1 - Mgmt packets
- *         2 - Data packets
- *         3 - Both Mgmt and Data packets
- *
- * Return: none
- */
-static void ol_txrx_set_pktcapture_mode(struct cdp_soc_t *soc,
-					uint8_t pdev_id, uint8_t val)
-{
-	struct ol_txrx_pdev_t *pdev = ol_txrx_get_pdev_from_pdev_id(
-					cdp_soc_t_to_ol_txrx_soc_t(soc),
-					pdev_id);
-
-	if (!pdev) {
-		qdf_print("%s: pdev is NULL\n", __func__);
-		return;
-	}
-
-	pdev->pktcapture_mode_value = val;
-}
-#endif /* WLAN_FEATURE_PKT_CAPTURE */
-
 static struct cdp_cmn_ops ol_ops_cmn = {
 	.txrx_soc_attach_target = ol_txrx_soc_attach_target,
 	.txrx_vdev_attach = ol_txrx_vdev_attach,
@@ -6286,15 +6175,6 @@ static struct cdp_raw_ops ol_ops_raw = {
 	/* EMPTY FOR MCL */
 };
 
-#ifdef WLAN_FEATURE_PKT_CAPTURE
-static struct cdp_pktcapture_ops ol_ops_pkt_capture = {
-	.txrx_pktcapture_cb_register = ol_txrx_register_pktcapture_cb,
-	.txrx_pktcapture_cb_deregister = ol_txrx_deregister_pktcapture_cb,
-	.txrx_pktcapture_set_mode = ol_txrx_set_pktcapture_mode,
-	.txrx_pktcapture_get_mode = ol_txrx_get_pktcapture_mode,
-};
-#endif /* #ifdef WLAN_FEATURE_PKT_CAPTURE */
-
 static struct cdp_ops ol_txrx_ops = {
 	.cmn_drv_ops = &ol_ops_cmn,
 	.ctrl_ops = &ol_ops_ctrl,
@@ -6322,9 +6202,6 @@ static struct cdp_ops ol_txrx_ops = {
 	.mob_stats_ops = &ol_ops_mob_stats,
 	.delay_ops = &ol_ops_delay,
 	.pmf_ops = &ol_ops_pmf,
-#ifdef WLAN_FEATURE_PKT_CAPTURE
-	.pktcapture_ops = &ol_ops_pkt_capture,
-#endif
 };
 
 ol_txrx_soc_handle ol_txrx_soc_attach(void *scn_handle,

+ 0 - 7
core/dp/txrx/ol_txrx_types.h

@@ -653,13 +653,6 @@ struct ol_txrx_pdev_t {
 
 	htt_pdev_handle htt_pdev;
 
-#ifdef WLAN_FEATURE_PKT_CAPTURE
-	void *mon_osif_dev;
-	QDF_STATUS (*mon_cb)(void *osif_dev,
-			     qdf_nbuf_t msdu_list);
-	uint8_t pktcapture_mode_value;
-#endif /* WLAN_FEATURE_PKT_CAPTURE */
-
 #ifdef WLAN_FEATURE_FASTPATH
 	struct CE_handle    *ce_tx_hdl; /* Handle to Tx packet posting CE */
 	struct CE_handle    *ce_htt_msg_hdl; /* Handle to TxRx completion CE */

+ 12 - 26
core/hdd/inc/wlan_hdd_tx_rx.h

@@ -339,43 +339,29 @@ void wlan_hdd_netif_queue_control(struct hdd_adapter *adapter,
 
 #ifdef FEATURE_MONITOR_MODE_SUPPORT
 int hdd_set_mon_rx_cb(struct net_device *dev);
-#else
-static inline
-int hdd_set_mon_rx_cb(struct net_device *dev)
-{
-	return 0;
-}
-#endif
-
-#ifdef WLAN_FEATURE_PKT_CAPTURE
 /**
- * hdd_set_pktcapture_cb() - Set pkt capture mode callback
- * @dev: Pointer to net_device structure
- * @pdev_id: pdev id
+ * hdd_mon_rx_packet_cbk() - Receive callback registered with OL layer.
+ * @context: pointer to qdf context
+ * @rxBuf: pointer to rx qdf_nbuf
  *
- * Return: 0 on success; non-zero for failure
- */
-int hdd_set_pktcapture_cb(struct net_device *dev, uint8_t pdev_id);
-
-/**
- * hdd_reset_pktcapture_cb() - Reset pkt capture mode callback
- * @pdev_id: pdev id
+ * TL will call this to notify the HDD when one or more packets were
+ * received for a registered STA.
  *
- * Return: None
+ * Return: QDF_STATUS
  */
-void hdd_reset_pktcapture_cb(uint8_t pdev_id);
+QDF_STATUS hdd_mon_rx_packet_cbk(void *context, qdf_nbuf_t rxbuf);
 #else
 static inline
-int hdd_set_pktcapture_cb(struct net_device *dev, uint8_t pdev_id)
+int hdd_set_mon_rx_cb(struct net_device *dev)
 {
-	return -ENOTSUPP;
+	return 0;
 }
-
 static inline
-void hdd_reset_pktcapture_cb(uint8_t pdev_id)
+QDF_STATUS hdd_mon_rx_packet_cbk(void *context, qdf_nbuf_t rxbuf)
 {
+	return QDF_STATUS_SUCCESS;
 }
-#endif /* WLAN_FEATURE_PKT_CAPTURE */
+#endif
 
 void hdd_send_rps_ind(struct hdd_adapter *adapter);
 void hdd_send_rps_disable_ind(struct hdd_adapter *adapter);

+ 18 - 8
core/hdd/src/wlan_hdd_main.c

@@ -2579,8 +2579,9 @@ static int __hdd_pktcapture_open(struct net_device *dev)
 
 	hdd_mon_mode_ether_setup(dev);
 
-	ret = hdd_set_pktcapture_cb(dev, OL_TXRX_PDEV_ID);
-
+	ret = ucfg_pkt_capture_register_callbacks(adapter->vdev,
+						  hdd_mon_rx_packet_cbk,
+						  adapter);
 	if (!ret)
 		set_bit(DEVICE_IFACE_OPENED, &adapter->event_flags);
 
@@ -3810,7 +3811,7 @@ static int __hdd_stop(struct net_device *dev)
 		hdd_lpass_notify_stop(hdd_ctx);
 
 	if (wlan_hdd_is_session_type_monitor(adapter->device_mode))
-		hdd_reset_pktcapture_cb(OL_TXRX_PDEV_ID);
+		ucfg_pkt_capture_deregister_callbacks(adapter->vdev);
 
 	/*
 	 * NAN data interface is different in some sense. The traffic on NDI is
@@ -7160,9 +7161,12 @@ QDF_STATUS hdd_start_all_adapters(struct hdd_context *hdd_ctx)
 			break;
 		case QDF_MONITOR_MODE:
 			if (wlan_hdd_is_session_type_monitor(
-						QDF_MONITOR_MODE)) {
-				hdd_set_pktcapture_cb(adapter->dev,
-						      OL_TXRX_PDEV_ID);
+			    QDF_MONITOR_MODE) &&
+			    ucfg_pkt_capture_get_mode(hdd_ctx->psoc)) {
+				ucfg_pkt_capture_register_callbacks(
+						adapter->vdev,
+						hdd_mon_rx_packet_cbk,
+						adapter);
 				break;
 			}
 			chan = wlan_reg_freq_to_chan(hdd_ctx->pdev,
@@ -7976,6 +7980,7 @@ static void wlan_hdd_cache_chann_mutex_destroy(struct hdd_context *hdd_ctx)
 void hdd_wlan_exit(struct hdd_context *hdd_ctx)
 {
 	struct wiphy *wiphy = hdd_ctx->wiphy;
+	struct hdd_adapter *adapter;
 
 	hdd_enter();
 
@@ -8015,8 +8020,12 @@ void hdd_wlan_exit(struct hdd_context *hdd_ctx)
 		hdd_abort_mac_scan_all_adapters(hdd_ctx);
 		hdd_abort_sched_scan_all_adapters(hdd_ctx);
 
-		if (wlan_hdd_is_session_type_monitor(QDF_MONITOR_MODE))
-			hdd_reset_pktcapture_cb(OL_TXRX_PDEV_ID);
+		if (wlan_hdd_is_session_type_monitor(QDF_MONITOR_MODE)) {
+			adapter = hdd_get_adapter(hdd_ctx, QDF_MONITOR_MODE);
+			if (adapter)
+				ucfg_pkt_capture_deregister_callbacks(
+						adapter->vdev);
+		}
 
 		hdd_stop_all_adapters(hdd_ctx);
 		hdd_deinit_all_adapters(hdd_ctx, false);
@@ -16483,6 +16492,7 @@ bool wlan_hdd_check_mon_concurrency(void)
 void wlan_hdd_del_monitor(struct hdd_context *hdd_ctx,
 			  struct hdd_adapter *adapter, bool rtnl_held)
 {
+	ucfg_pkt_capture_deregister_callbacks(adapter->vdev);
 	wlan_hdd_release_intf_addr(hdd_ctx, adapter->mac_addr.bytes);
 	hdd_stop_adapter(hdd_ctx, adapter);
 	hdd_close_adapter(hdd_ctx, adapter, true);

+ 0 - 1
core/hdd/src/wlan_hdd_p2p.c

@@ -898,7 +898,6 @@ int __wlan_hdd_del_virtual_intf(struct wiphy *wiphy, struct wireless_dev *wdev)
 	} else if (wlan_hdd_is_session_type_monitor(
 					adapter->device_mode)) {
 		wlan_hdd_del_monitor(hdd_ctx, adapter, TRUE);
-		hdd_reset_pktcapture_cb(OL_TXRX_PDEV_ID);
 	} else {
 		wlan_hdd_release_intf_addr(hdd_ctx,
 					   adapter->mac_addr.bytes);

+ 1 - 44
core/hdd/src/wlan_hdd_tx_rx.c

@@ -48,7 +48,6 @@
 #include <cdp_txrx_cmn.h>
 #include <cdp_txrx_peer_ops.h>
 #include <cdp_txrx_flow_ctrl_v2.h>
-#include <cdp_txrx_mon.h>
 #include "wlan_hdd_nan_datapath.h"
 #include "pld_common.h"
 #include <cdp_txrx_misc.h>
@@ -1353,18 +1352,7 @@ QDF_STATUS hdd_deinit_tx_rx(struct hdd_adapter *adapter)
 }
 
 #ifdef FEATURE_MONITOR_MODE_SUPPORT
-/**
- * hdd_mon_rx_packet_cbk() - Receive callback registered with OL layer.
- * @context: [in] pointer to qdf context
- * @rxBuf:      [in] pointer to rx qdf_nbuf
- *
- * TL will call this to notify the HDD when one or more packets were
- * received for a registered STA.
- *
- * Return: QDF_STATUS_E_FAILURE if any errors encountered, QDF_STATUS_SUCCESS
- * otherwise
- */
-static QDF_STATUS hdd_mon_rx_packet_cbk(void *context, qdf_nbuf_t rxbuf)
+QDF_STATUS hdd_mon_rx_packet_cbk(void *context, qdf_nbuf_t rxbuf)
 {
 	struct hdd_adapter *adapter;
 	int rxstat;
@@ -2728,37 +2716,6 @@ void hdd_print_netdev_txq_status(struct net_device *dev)
 	}
 }
 
-#ifdef WLAN_FEATURE_PKT_CAPTURE
-/**
- * hdd_set_pktcapture_cb() - Set pkt capture mode callback
- * @dev: Pointer to net_device structure
- * @pdev_id: pdev id
- *
- * Return: 0 on success; non-zero for failure
- */
-int hdd_set_pktcapture_cb(struct net_device *dev, uint8_t pdev_id)
-{
-	struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev);
-	void *soc = cds_get_context(QDF_MODULE_ID_SOC);
-
-	return cdp_register_pktcapture_cb(soc, pdev_id, adapter,
-					  hdd_mon_rx_packet_cbk);
-}
-
-/**
- * hdd_reset_pktcapture_cb() - Reset pkt capture mode callback
- * @pdev_id: pdev id
- *
- * Return: None
- */
-void hdd_reset_pktcapture_cb(uint8_t pdev_id)
-{
-	void *soc = cds_get_context(QDF_MODULE_ID_SOC);
-
-	cdp_deregister_pktcapture_cb(soc, pdev_id);
-}
-#endif /* WLAN_FEATURE_PKT_CAPTURE */
-
 #ifdef FEATURE_MONITOR_MODE_SUPPORT
 /**
  * hdd_set_mon_rx_cb() - Set Monitor mode Rx callback