From dca5f81346d46253a54f10d06f5c204c0ae3594b Mon Sep 17 00:00:00 2001 From: Rajeev Kumar Date: Thu, 4 Feb 2016 17:28:06 -0800 Subject: [PATCH] qcacld-3.0: Extend wow debug fs support to all interfaces Currently WoW debug fs support is limited to 1st interface. FW supports wow and periodic pattern generation on all interface types. Extend wow debug fs support to all interfaces. Change-Id: I83deb1845f921ecf8c5422786e025a051ee3c561 CRs-Fixed: 973003 --- core/hdd/inc/wlan_hdd_debugfs.h | 6 +++--- core/hdd/inc/wlan_hdd_main.h | 5 ++--- core/hdd/src/wlan_hdd_debugfs.c | 27 ++++++++++++++++----------- core/hdd/src/wlan_hdd_main.c | 12 +++--------- 4 files changed, 24 insertions(+), 26 deletions(-) diff --git a/core/hdd/inc/wlan_hdd_debugfs.h b/core/hdd/inc/wlan_hdd_debugfs.h index 59f2f36238df..f5bfb1b49452 100644 --- a/core/hdd/inc/wlan_hdd_debugfs.h +++ b/core/hdd/inc/wlan_hdd_debugfs.h @@ -29,15 +29,15 @@ #define _WLAN_HDD_DEBUGFS_H #ifdef WLAN_OPEN_SOURCE -QDF_STATUS hdd_debugfs_init(hdd_adapter_t *pAdapter); -void hdd_debugfs_exit(hdd_context_t *pHddCtx); +QDF_STATUS hdd_debugfs_init(hdd_adapter_t *adapter); +void hdd_debugfs_exit(hdd_adapter_t *adapter); #else inline QDF_STATUS hdd_debugfs_init(hdd_adapter_t *pAdapter) { return QDF_STATUS_SUCCESS; } -inline void hdd_debugfs_exit(hdd_context_t *pHddCtx) +inline void hdd_debugfs_exit(hdd_adapter_t *adapter) { } #endif /* #ifdef WLAN_OPEN_SOURCE */ diff --git a/core/hdd/inc/wlan_hdd_main.h b/core/hdd/inc/wlan_hdd_main.h index 010211d3eca4..d9c5ca0d7302 100644 --- a/core/hdd/inc/wlan_hdd_main.h +++ b/core/hdd/inc/wlan_hdd_main.h @@ -1024,6 +1024,8 @@ struct hdd_adapter_s { struct hdd_netif_queue_stats queue_oper_stats[WLAN_REASON_TYPE_MAX]; struct hdd_lro_s lro_info; ol_txrx_tx_fp tx_fn; + /* debugfs entry */ + struct dentry *debugfs_phy; }; #define WLAN_HDD_GET_STATION_CTX_PTR(pAdapter) (&(pAdapter)->sessionCtx.station) @@ -1199,9 +1201,6 @@ struct hdd_context_s { bool sus_res_mcastbcast_filter_valid; - /* debugfs entry */ - struct dentry *debugfs_phy; - /* Use below lock to protect access to isSchedScanUpdatePending * since it will be accessed in two different contexts. */ diff --git a/core/hdd/src/wlan_hdd_debugfs.c b/core/hdd/src/wlan_hdd_debugfs.c index bf2239d8234d..9c862b59e8c3 100644 --- a/core/hdd/src/wlan_hdd_debugfs.c +++ b/core/hdd/src/wlan_hdd_debugfs.c @@ -603,7 +603,7 @@ static const struct file_operations fops_patterngen = { /** * hdd_debugfs_init() - Initialize debugfs interface - * @pAdapter: primary wlan adapter + * @adapter: interface adapter pointer * * Register support for the debugfs files supported by the driver. * @@ -613,26 +613,26 @@ static const struct file_operations fops_patterngen = { * Return: QDF_STATUS_SUCCESS if all files registered, * QDF_STATUS_E_FAILURE on failure */ -QDF_STATUS hdd_debugfs_init(hdd_adapter_t *pAdapter) +QDF_STATUS hdd_debugfs_init(hdd_adapter_t *adapter) { - hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); - pHddCtx->debugfs_phy = debugfs_create_dir("wlan_wcnss", 0); + struct net_device *dev = adapter->dev; + adapter->debugfs_phy = debugfs_create_dir(dev->name, 0); - if (NULL == pHddCtx->debugfs_phy) + if (NULL == adapter->debugfs_phy) return QDF_STATUS_E_FAILURE; if (NULL == debugfs_create_file("wow_enable", S_IRUSR | S_IWUSR, - pHddCtx->debugfs_phy, pAdapter, + adapter->debugfs_phy, adapter, &fops_wowenable)) return QDF_STATUS_E_FAILURE; if (NULL == debugfs_create_file("wow_pattern", S_IRUSR | S_IWUSR, - pHddCtx->debugfs_phy, pAdapter, + adapter->debugfs_phy, adapter, &fops_wowpattern)) return QDF_STATUS_E_FAILURE; if (NULL == debugfs_create_file("pattern_gen", S_IRUSR | S_IWUSR, - pHddCtx->debugfs_phy, pAdapter, + adapter->debugfs_phy, adapter, &fops_patterngen)) return QDF_STATUS_E_FAILURE; @@ -641,14 +641,19 @@ QDF_STATUS hdd_debugfs_init(hdd_adapter_t *pAdapter) /** * hdd_debugfs_exit() - Shutdown debugfs interface - * @pHddCtx: the global HDD context + * @adapter: interface adapter pointer * * Unregister support for the debugfs files supported by the driver. * * Return: None */ -void hdd_debugfs_exit(hdd_context_t *pHddCtx) +void hdd_debugfs_exit(hdd_adapter_t *adapter) { - debugfs_remove_recursive(pHddCtx->debugfs_phy); + struct net_device *dev = adapter->dev; + + if (adapter->debugfs_phy) + debugfs_remove_recursive(adapter->debugfs_phy); + else + hdd_info("Interface %s has no debugfs entry", dev->name); } #endif /* #ifdef WLAN_OPEN_SOURCE */ diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index af0d983eb9bf..e2c3b0ad3320 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -2265,6 +2265,7 @@ void hdd_cleanup_adapter(hdd_context_t *hdd_ctx, hdd_adapter_t *adapter, } hdd_lro_disable(hdd_ctx, adapter); + hdd_debugfs_exit(adapter); /* * The adapter is marked as closed. When hdd_wlan_exit() call returns, * the driver is almost closed and cannot handle either control @@ -2679,6 +2680,8 @@ hdd_adapter_t *hdd_open_adapter(hdd_context_t *hdd_ctx, uint8_t session_type, } } #endif + if (QDF_STATUS_SUCCESS != hdd_debugfs_init(adapter)) + hdd_err("Interface %s wow debug_fs init failed", iface_name); return adapter; @@ -3756,8 +3759,6 @@ void hdd_wlan_exit(hdd_context_t *hdd_ctx) */ hdd_set_idle_ps_config(hdd_ctx, false); - hdd_debugfs_exit(hdd_ctx); - /* Unregister the Net Device Notifier */ unregister_netdevice_notifier(&hdd_netdev_notifier); @@ -5634,11 +5635,6 @@ int hdd_wlan_startup(struct device *dev, void *hif_sc) sme_register_oem_data_rsp_callback(hdd_ctx->hHal, hdd_send_oem_data_rsp_msg); - status = hdd_debugfs_init(adapter); - - if (QDF_IS_STATUS_SUCCESS(status)) - hdd_err("hdd_debugfs_init failed: %d!", status); - /* FW capabilities received, Set the Dot11 mode */ sme_setdef_dot11mode(hdd_ctx->hHal); @@ -5818,8 +5814,6 @@ err_nl_srv: /* Proceed and complete the clean up */ } - hdd_debugfs_exit(hdd_ctx); - err_close_adapter: hdd_release_rtnl_lock();