From 4f095955f402174cfe0950fa1b84e5b85f46de7f Mon Sep 17 00:00:00 2001 From: Ravi Joshi Date: Thu, 29 Jun 2017 15:39:19 -0700 Subject: [PATCH] qcacld-3.0: Enable Napier monitor mode configuration Host is required to send HTT messages to firmware to configure and enable monitor mode. The HTT message requests the firmware to subscribe the TLVs, packet types and also monitor mode type. CRs-Fixed: 2071621 Change-Id: If2da5de01f3a7eb594e25b421bc17f97498c8a92 --- core/hdd/src/wlan_hdd_main.c | 5 +++++ core/hdd/src/wlan_hdd_rx_monitor.c | 23 +++++++++++++++++++++++ core/hdd/src/wlan_hdd_rx_monitor.h | 10 ++++++++-- 3 files changed, 36 insertions(+), 2 deletions(-) diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index 620fb416167e..b578d179903a 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -120,6 +120,7 @@ #include "os_if_nan.h" #include "nan_public_structs.h" #include "wlan_reg_ucfg_api.h" +#include "wlan_hdd_rx_monitor.h" #ifdef CNSS_GENL #include @@ -1701,6 +1702,10 @@ static int __hdd_mon_open(struct net_device *dev) ENTER_DEV(dev); hdd_mon_mode_ether_setup(dev); ret = hdd_set_mon_rx_cb(dev); + + if (!ret) + ret = hdd_enable_monitor_mode(dev); + return ret; } diff --git a/core/hdd/src/wlan_hdd_rx_monitor.c b/core/hdd/src/wlan_hdd_rx_monitor.c index 8fcbe6fae029..7ba03960d481 100644 --- a/core/hdd/src/wlan_hdd_rx_monitor.c +++ b/core/hdd/src/wlan_hdd_rx_monitor.c @@ -118,3 +118,26 @@ void hdd_monitor_set_rx_monitor_cb(struct ol_txrx_ops *txrx, { txrx->rx.mon = rx_monitor_cb; } + +/** + * hdd_enable_monitor_mode() - Enable monitor mode + * @dev: Pointer to the net_device structure + * + * This function invokes cdp interface API to enable + * monitor mode configuration on the hardware. In this + * case sends HTT messages to FW to setup hardware rings + * + * Return: 0 for success; non-zero for failure + */ +int hdd_enable_monitor_mode(struct net_device *dev) +{ + void *soc = cds_get_context(QDF_MODULE_ID_SOC); + void *pdev = cds_get_context(QDF_MODULE_ID_TXRX); + hdd_adapter_t *adapter = WLAN_HDD_GET_PRIV_PTR(dev); + + ENTER_DEV(dev); + + return cdp_set_monitor_mode(soc, + (struct cdp_vdev *)cdp_get_vdev_from_vdev_id(soc, + (struct cdp_pdev *)pdev, adapter->sessionId), false); +} diff --git a/core/hdd/src/wlan_hdd_rx_monitor.h b/core/hdd/src/wlan_hdd_rx_monitor.h index 161b8a14bbd1..415b52325109 100644 --- a/core/hdd/src/wlan_hdd_rx_monitor.h +++ b/core/hdd/src/wlan_hdd_rx_monitor.h @@ -37,12 +37,18 @@ void hdd_monitor_set_rx_monitor_cb(struct ol_txrx_ops *txrx, void hdd_rx_monitor_callback(ol_osif_vdev_handle vdev, qdf_nbuf_t mpdu, void *rx_status); + +int hdd_enable_monitor_mode(struct net_device *dev); #else -static void hdd_monitor_set_rx_monitor_cb(struct ol_txrx_ops *txrx, +static inline void hdd_monitor_set_rx_monitor_cb(struct ol_txrx_ops *txrx, ol_txrx_rx_mon_fp rx_monitor_cb){ } -static void hdd_rx_monitor_callback(ol_osif_vdev_handle vdev, +static inline void hdd_rx_monitor_callback(ol_osif_vdev_handle vdev, qdf_nbuf_t mpdu, void *rx_status){ } +static inline int hdd_enable_monitor_mode(struct net_device *dev) +{ + return -ENOSYS; +} #endif /* CONFIG_LITHIUM */ #endif /* __WLAN_HDD_RX_MONITOR_H */