From 6bc52de88157b7119cb803dbeaaf2ac07c799f17 Mon Sep 17 00:00:00 2001 From: Visweswara Tanuku Date: Mon, 9 Apr 2018 18:38:30 +0530 Subject: [PATCH] qcacld-3.0: Use hdd netdev notifier call for softAP interface qcacld-2.0 to qcacld-3.0 propagation In softAP scenario, if any pending scan request is not serviced before NETDEV_GOING_DOWN is called, it results in call trace Handle this by using hdd netdev notifier call for softAP, where scan_block_work is flushed. Change-Id: I5de07103e0b0008f21c0a13add0eed36ea1b31d0 CRs-fixed: 2076542 --- core/hdd/src/wlan_hdd_main.c | 37 +++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index 3e8c7b0040e0..329ce7d1be26 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -590,29 +590,19 @@ static int __hdd_netdev_notifier_call(struct notifier_block *nb, #else struct net_device *dev = data; #endif - struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev); + struct hdd_adapter *adapter; struct hdd_context *hdd_ctx; hdd_enter_dev(dev); - /* Make sure that this callback corresponds to our device. */ - if ((strncmp(dev->name, "wlan", 4)) && (strncmp(dev->name, "p2p", 3))) - return NOTIFY_DONE; - - if ((adapter->magic != WLAN_HDD_ADAPTER_MAGIC) || - (adapter->dev != dev)) { - hdd_err("device adapter is not matching!!!"); - return NOTIFY_DONE; - } - if (!dev->ieee80211_ptr) { hdd_err("ieee80211_ptr is NULL!!!"); return NOTIFY_DONE; } - hdd_ctx = WLAN_HDD_GET_CTX(adapter); - if (NULL == hdd_ctx) { - hdd_err("HDD Context Null Pointer"); + hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD); + if (!hdd_ctx) { + hdd_err("HDD Context is Null"); QDF_ASSERT(0); return NOTIFY_DONE; } @@ -622,11 +612,24 @@ static int __hdd_netdev_notifier_call(struct notifier_block *nb, return NOTIFY_DONE; } - if (cds_is_driver_recovering() || cds_is_driver_in_bad_state()) + /* Make sure that this callback corresponds to our device. */ + adapter = hdd_get_adapter_by_iface_name(hdd_ctx, dev->name); + if (!adapter) { + hdd_err("Couldn't find adapter for dev name %s", dev->name); return NOTIFY_DONE; + } - hdd_debug("%s New Net Device State = %lu", - dev->name, state); + if (adapter != WLAN_HDD_GET_PRIV_PTR(dev)) { + hdd_err("HDD adapter mismatch!"); + return NOTIFY_DONE; + } + + if (cds_is_driver_recovering() || cds_is_driver_in_bad_state()) { + hdd_err("Driver is in recovery or bad state"); + return NOTIFY_DONE; + } + + hdd_debug("%s New Net Device State = %lu", dev->name, state); switch (state) { case NETDEV_REGISTER: