qcacld-3.0: Add debug infra to detect reference leaks for dev_hold

Currently there is no debug infra to detect the API that caused the
reference leak for dev_hold. So, It very hard to debug/fix the
reference leak issues.

To address this, add debug_infra for dev_hold and dev_put calls in
the driver. This change also fixes the few reference leaks with
hdd_for_each_adapter_dev_held_safe.

Change-Id: Icf1adf53c3bd11c715111494bac958c541ef87ea
CRs-Fixed: 2825558
This commit is contained in:
Bapiraju Alla 2020-11-23 13:44:21 +05:30 • committed by snandini
commit 85d542301d
14 changed files with 632 additions and 268 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012-2020 The Linux Foundation. All rights reserved.
* Copyright (c) 2012-2021 The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
@ -439,6 +439,79 @@ enum hdd_auth_key_mgmt {
HDD_AUTH_KEY_MGMT_CCKM = BIT(2)
};
/**
* wlan_net_dev_ref_dbgid - Debug IDs to detect net device reference leaks
*/
/*
* New value added to the enum must also be reflected in function
* net_dev_ref_debug_string_from_id()
*/
typedef enum {
NET_DEV_HOLD_ID_RESERVED = 0,
NET_DEV_HOLD_GET_STA_CONNECTION_IN_PROGRESS = 1,
NET_DEV_HOLD_CHECK_DFS_CHANNEL_FOR_ADAPTER = 2,
NET_DEV_HOLD_GET_SAP_OPERATING_BAND = 3,
NET_DEV_HOLD_RECOVERY_NOTIFIER_CALL = 4,
NET_DEV_HOLD_IS_ANY_STA_CONNECTING = 5,
NET_DEV_HOLD_SAP_DESTROY_CTX_ALL = 6,
NET_DEV_HOLD_DRV_CMD_MAX_TX_POWER = 7,
NET_DEV_HOLD_IPA_SET_TX_FLOW_INFO = 8,
NET_DEV_HOLD_SET_RPS_CPU_MASK = 9,
NET_DEV_HOLD_DFS_INDICATE_RADAR = 10,
NET_DEV_HOLD_MAX_STA_INTERFACE_UP_COUNT_REACHED = 11,
NET_DEV_HOLD_IS_CHAN_SWITCH_IN_PROGRESS = 12,
NET_DEV_HOLD_STA_DESTROY_CTX_ALL = 13,
NET_DEV_HOLD_CHECK_FOR_EXISTING_MACADDR = 14,
NET_DEV_HOLD_DEINIT_ALL_ADAPTERS = 15,
NET_DEV_HOLD_STOP_ALL_ADAPTERS = 16,
NET_DEV_HOLD_RESET_ALL_ADAPTERS = 17,
NET_DEV_HOLD_IS_ANY_INTERFACE_OPEN = 18,
NET_DEV_HOLD_START_ALL_ADAPTERS = 19,
NET_DEV_HOLD_GET_ADAPTER_BY_RAND_MACADDR = 20,
NET_DEV_HOLD_GET_ADAPTER_BY_MACADDR = 21,
NET_DEV_HOLD_GET_ADAPTER_BY_VDEV = 22,
NET_DEV_HOLD_ADAPTER_GET_BY_REFERENCE = 23,
NET_DEV_HOLD_GET_ADAPTER_BY_IFACE_NAME = 24,
NET_DEV_HOLD_GET_ADAPTER = 25,
NET_DEV_HOLD_GET_OPERATING_CHAN_FREQ = 26,
NET_DEV_HOLD_UNREGISTER_WEXT_ALL_ADAPTERS = 27,
NET_DEV_HOLD_ABORT_MAC_SCAN_ALL_ADAPTERS = 28,
NET_DEV_HOLD_ABORT_SCHED_SCAN_ALL_ADAPTERS = 29,
NET_DEV_HOLD_GET_FIRST_VALID_ADAPTER = 30,
NET_DEV_HOLD_CLEAR_RPS_CPU_MASK = 31,
NET_DEV_HOLD_BUS_BW_WORK_HANDLER = 32,
NET_DEV_HOLD_DISPLAY_NETIF_QUEUE_HISTORY_COMPACT = 33,
NET_DEV_HOLD_DISPLAY_NETIF_QUEUE_HISTORY = 34,
NET_DEV_HOLD_CLEAR_NETIF_QUEUE_HISTORY = 35,
NET_DEV_HOLD_UNSAFE_CHANNEL_RESTART_SAP = 36,
NET_DEV_HOLD_INDICATE_MGMT_FRAME = 37,
NET_DEV_HOLD_STATE_INFO_DUMP = 38,
NET_DEV_HOLD_DISABLE_ROAMING = 39,
NET_DEV_HOLD_ENABLE_ROAMING = 40,
NET_DEV_HOLD_AUTO_SHUTDOWN_ENABLE = 41,
NET_DEV_HOLD_GET_CON_SAP_ADAPTER = 42,
NET_DEV_HOLD_IS_ANY_ADAPTER_CONNECTED = 43,
NET_DEV_HOLD_IS_ROAMING_IN_PROGRESS = 44,
NET_DEV_HOLD_DEL_P2P_INTERFACE = 45,
NET_DEV_HOLD_IS_NDP_ALLOWED = 46,
NET_DEV_HOLD_NDI_OPEN = 47,
NET_DEV_HOLD_SEND_OEM_REG_RSP_NLINK_MSG = 48,
NET_DEV_HOLD_PERIODIC_STA_STATS_DISPLAY = 49,
NET_DEV_HOLD_SUSPEND_WLAN = 50,
NET_DEV_HOLD_RESUME_WLAN = 51,
NET_DEV_HOLD_SSR_RESTART_SAP = 52,
NET_DEV_HOLD_SEND_DEFAULT_SCAN_IES = 53,
NET_DEV_HOLD_CFG80211_SUSPEND_WLAN = 54,
NET_DEV_HOLD_COUNTRY_CHANGE_UPDATE_STA = 55,
NET_DEV_HOLD_COUNTRY_CHANGE_UPDATE_SAP = 56,
NET_DEV_HOLD_CACHE_STATION_STATS_CB = 57,
NET_DEV_HOLD_DISPLAY_TXRX_STATS = 58,
NET_DEV_HOLD_GET_MODE_SPECIFIC_IF_COUNT = 59,
/* Keep it at the end */
NET_DEV_HOLD_ID_MAX
} wlan_net_dev_ref_dbgid;
/**
* struct hdd_tx_rx_histogram - structure to keep track of tx and rx packets
* received over 100ms intervals
@ -1445,6 +1518,7 @@ struct hdd_adapter {
/* Flag to indicate whether it is a pre cac adapter or not */
bool is_pre_cac_adapter;
bool delete_in_progress;
uint8_t net_dev_hold_ref_count[NET_DEV_HOLD_ID_MAX];
};
#define WLAN_HDD_GET_STATION_CTX_PTR(adapter) (&(adapter)->session.station)
@ -2368,16 +2442,24 @@ QDF_STATUS hdd_adapter_iterate(hdd_adapter_iterate_cb cb,
void *context);
/**
* __hdd_take_ref_and_fetch_front_adapter - Helper macro to lock, fetch front
* adapter, take ref and unlock.
* @hdd_ctx: the global HDD context
* @adapter: an hdd_adapter pointer to use as a cursor
* hdd_adapter_dev_hold_debug - Debug API to call dev_hold
* @adapter: hdd_adapter pointer
* @dbgid: Debug ID corresponding to API that is requesting the dev_hold
*
* Return: none
*/
#define __hdd_take_ref_and_fetch_front_adapter(hdd_ctx, adapter) \
qdf_spin_lock_bh(&hdd_ctx->hdd_adapter_lock), \
hdd_get_front_adapter_no_lock(hdd_ctx, &adapter), \
(adapter) ? dev_hold(adapter->dev) : (false), \
qdf_spin_unlock_bh(&hdd_ctx->hdd_adapter_lock)
void hdd_adapter_dev_hold_debug(struct hdd_adapter *adapter,
wlan_net_dev_ref_dbgid dbgid);
/**
* hdd_adapter_dev_put_debug - Debug API to call dev_put
* @adapter: hdd_adapter pointer
* @dbgid: Debug ID corresponding to API that is requesting the dev_put
*
* Return: none
*/
void hdd_adapter_dev_put_debug(struct hdd_adapter *adapter,
wlan_net_dev_ref_dbgid dbgid);
/**
* __hdd_take_ref_and_fetch_front_adapter_safe - Helper macro to lock, fetch
@ -2385,26 +2467,16 @@ QDF_STATUS hdd_adapter_iterate(hdd_adapter_iterate_cb cb,
* @hdd_ctx: the global HDD context
* @adapter: an hdd_adapter pointer to use as a cursor
* @next_adapter: hdd_adapter pointer to next adapter
* @dbgid: debug ID to detect reference leaks
*/
#define __hdd_take_ref_and_fetch_front_adapter_safe(hdd_ctx, adapter, \
next_adapter) \
next_adapter, dbgid) \
qdf_spin_lock_bh(&hdd_ctx->hdd_adapter_lock), \
hdd_get_front_adapter_no_lock(hdd_ctx, &adapter), \
(adapter) ? dev_hold(adapter->dev) : (false), \
(adapter) ? hdd_adapter_dev_hold_debug(adapter, dbgid) : (false), \
hdd_get_next_adapter_no_lock(hdd_ctx, adapter, &next_adapter), \
(next_adapter) ? dev_hold(next_adapter->dev) : (false), \
qdf_spin_unlock_bh(&hdd_ctx->hdd_adapter_lock)
/**
* __hdd_take_ref_and_fetch_next_adapter - Helper macro to lock, fetch next
* adapter, take ref and unlock.
* @hdd_ctx: the global HDD context
* @adapter: an hdd_adapter pointer to use as a cursor
*/
#define __hdd_take_ref_and_fetch_next_adapter(hdd_ctx, adapter) \
qdf_spin_lock_bh(&hdd_ctx->hdd_adapter_lock), \
hdd_get_next_adapter_no_lock(hdd_ctx, adapter, &adapter), \
(adapter) ? dev_hold(adapter->dev) : (false), \
(next_adapter) ? hdd_adapter_dev_hold_debug(next_adapter, dbgid) : \
(false), \
qdf_spin_unlock_bh(&hdd_ctx->hdd_adapter_lock)
/**
@ -2413,13 +2485,15 @@ QDF_STATUS hdd_adapter_iterate(hdd_adapter_iterate_cb cb,
* @hdd_ctx: the global HDD context
* @adapter: hdd_adapter pointer to use as a cursor
* @next_adapter: hdd_adapter pointer to next adapter
* @dbgid: debug ID to detect reference leaks
*/
#define __hdd_take_ref_and_fetch_next_adapter_safe(hdd_ctx, adapter, \
next_adapter) \
next_adapter, dbgid) \
qdf_spin_lock_bh(&hdd_ctx->hdd_adapter_lock), \
adapter = next_adapter, \
hdd_get_next_adapter_no_lock(hdd_ctx, adapter, &next_adapter), \
(next_adapter) ? dev_hold(next_adapter->dev) : (false), \
(next_adapter) ? hdd_adapter_dev_hold_debug(next_adapter, dbgid) : \
(false), \
qdf_spin_unlock_bh(&hdd_ctx->hdd_adapter_lock)
/**
@ -2443,25 +2517,27 @@ QDF_STATUS hdd_adapter_iterate(hdd_adapter_iterate_cb cb,
* inside the loop body then the dev_hold has been invoked.
*
* ***** NOTE *****
* Before the end of each iteration, dev_put(adapter->dev) must be
* called. Not calling this will keep hold of a reference, thus preventing
* unregister of the netdevice. If the loop is terminated in between with
* return/goto/break statements, dev_put(next_adapter->dev) must be done
* along with dev_put(adapter->dev) before termination of the loop.
* Before the end of each iteration, hdd_adapter_dev_put_debug(adapter, dbgid)
* must be called. Not calling this will keep hold of a reference, thus
* preventing unregister of the netdevice. If the loop is terminated in
* between with return/goto/break statements,
* hdd_adapter_dev_put_debug(next_adapter, dbgid) must be done along with
* hdd_adapter_dev_put_debug(adapter, dbgid) before termination of the loop.
*
* Usage example:
* hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) {
* <work involving adapter>
* <some more work>
* dev_put(adapter->dev)
* }
* hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, dbgid) {
* <work involving adapter>
* <some more work>
* hdd_adapter_dev_put_debug(adapter, dbgid)
* }
*/
#define hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) \
#define hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter, \
dbgid) \
for (__hdd_take_ref_and_fetch_front_adapter_safe(hdd_ctx, adapter, \
next_adapter); \
next_adapter, dbgid); \
__hdd_is_adapter_valid(adapter); \
__hdd_take_ref_and_fetch_next_adapter_safe(hdd_ctx, adapter, \
next_adapter))
next_adapter, dbgid))
/**
* wlan_hdd_get_adapter_by_vdev_id_from_objmgr() - Fetch adapter from objmgr

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012-2020 The Linux Foundation. All rights reserved.
* Copyright (c) 2012-2021 The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
@ -408,13 +408,16 @@ struct hdd_adapter *hdd_get_sta_connection_in_progress(
{
struct hdd_adapter *adapter = NULL, *next_adapter = NULL;
struct hdd_station_ctx *hdd_sta_ctx;
wlan_net_dev_ref_dbgid dbgid =
NET_DEV_HOLD_GET_STA_CONNECTION_IN_PROGRESS;
if (!hdd_ctx) {
hdd_err("HDD context is NULL");
return NULL;
}
hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) {
hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter,
dbgid) {
hdd_sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
if ((QDF_STA_MODE == adapter->device_mode) ||
(QDF_P2P_CLIENT_MODE == adapter->device_mode) ||
@ -423,9 +426,10 @@ struct hdd_adapter *hdd_get_sta_connection_in_progress(
hdd_sta_ctx->conn_info.conn_state) {
hdd_debug("vdev_id %d: Connection is in progress",
adapter->vdev_id);
dev_put(adapter->dev);
hdd_adapter_dev_put_debug(adapter, dbgid);
if (next_adapter)
dev_put(next_adapter->dev);
hdd_adapter_dev_put_debug(next_adapter,
dbgid);
return adapter;
} else if ((eConnectionState_Associated ==
hdd_sta_ctx->conn_info.conn_state) &&
@ -434,13 +438,14 @@ struct hdd_adapter *hdd_get_sta_connection_in_progress(
adapter->vdev_id)) {
hdd_debug("vdev_id %d: Key exchange is in progress",
adapter->vdev_id);
dev_put(adapter->dev);
hdd_adapter_dev_put_debug(adapter, dbgid);
if (next_adapter)
dev_put(next_adapter->dev);
hdd_adapter_dev_put_debug(next_adapter,
dbgid);
return adapter;
}
}
dev_put(adapter->dev);
hdd_adapter_dev_put_debug(adapter, dbgid);
}
return NULL;
}

View file

@ -5765,8 +5765,11 @@ static bool wlan_hdd_check_dfs_channel_for_adapter(struct hdd_context *hdd_ctx,
struct hdd_adapter *adapter, *next_adapter = NULL;
struct hdd_ap_ctx *ap_ctx;
struct hdd_station_ctx *sta_ctx;
wlan_net_dev_ref_dbgid dbgid =
NET_DEV_HOLD_CHECK_DFS_CHANNEL_FOR_ADAPTER;
hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) {
hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter,
dbgid) {
if ((device_mode == adapter->device_mode) &&
(device_mode == QDF_SAP_MODE)) {
ap_ctx =
@ -5783,9 +5786,10 @@ static bool wlan_hdd_check_dfs_channel_for_adapter(struct hdd_context *hdd_ctx,
hdd_ctx->pdev,
ap_ctx->operating_chan_freq)) {
hdd_err("SAP running on DFS channel");
dev_put(adapter->dev);
hdd_adapter_dev_put_debug(adapter, dbgid);
if (next_adapter)
dev_put(next_adapter->dev);
hdd_adapter_dev_put_debug(next_adapter,
dbgid);
return true;
}
}
@ -5804,13 +5808,14 @@ static bool wlan_hdd_check_dfs_channel_for_adapter(struct hdd_context *hdd_ctx,
hdd_ctx->pdev,
sta_ctx->conn_info.chan_freq))) {
hdd_err("client connected on DFS channel");
dev_put(adapter->dev);
hdd_adapter_dev_put_debug(adapter, dbgid);
if (next_adapter)
dev_put(next_adapter->dev);
hdd_adapter_dev_put_debug(next_adapter,
dbgid);
return true;
}
}
dev_put(adapter->dev);
hdd_adapter_dev_put_debug(adapter, dbgid);
}
return false;
@ -11965,10 +11970,12 @@ uint8_t hdd_get_sap_operating_band(struct hdd_context *hdd_ctx)
struct hdd_adapter *adapter, *next_adapter = NULL;
uint32_t operating_chan_freq;
uint8_t sap_operating_band = 0;
wlan_net_dev_ref_dbgid dbgid = NET_DEV_HOLD_GET_SAP_OPERATING_BAND;
hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) {
hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter,
dbgid) {
if (adapter->device_mode != QDF_SAP_MODE) {
dev_put(adapter->dev);
hdd_adapter_dev_put_debug(adapter, dbgid);
continue;
}
@ -11981,7 +11988,7 @@ uint8_t hdd_get_sap_operating_band(struct hdd_context *hdd_ctx)
else
sap_operating_band = BAND_ALL;
dev_put(adapter->dev);
hdd_adapter_dev_put_debug(adapter, dbgid);
}
return sap_operating_band;

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2021, The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@ -50,6 +50,7 @@ static int wlan_hdd_recovery_notifier_call(struct notifier_block *block,
struct wlan_objmgr_vdev *vdev;
struct hdd_hang_event_fixed_param *cmd;
struct hdd_scan_fixed_param *cmd_scan;
wlan_net_dev_ref_dbgid dbgid = NET_DEV_HOLD_RECOVERY_NOTIFIER_CALL;
if (!data)
return NOTIFY_STOP_MASK;
@ -76,10 +77,11 @@ static int wlan_hdd_recovery_notifier_call(struct notifier_block *block,
hdd_hang_data->offset += total_len;
}
hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) {
hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter,
dbgid) {
vdev = hdd_objmgr_get_vdev(adapter);
if (!vdev) {
dev_put(adapter->dev);
hdd_adapter_dev_put_debug(adapter, dbgid);
continue;
}
total_len = sizeof(*cmd);
@ -87,9 +89,10 @@ static int wlan_hdd_recovery_notifier_call(struct notifier_block *block,
if (hdd_hang_data->offset + total_len >
QDF_WLAN_HANG_FW_OFFSET) {
hdd_objmgr_put_vdev(vdev);
dev_put(adapter->dev);
hdd_adapter_dev_put_debug(adapter, dbgid);
if (next_adapter)
dev_put(next_adapter->dev);
hdd_adapter_dev_put_debug(next_adapter,
dbgid);
return NOTIFY_STOP_MASK;
}
cmd = (struct hdd_hang_event_fixed_param *)hdd_buf_ptr;
@ -102,7 +105,7 @@ static int wlan_hdd_recovery_notifier_call(struct notifier_block *block,
cmd->vdev_substate = wlan_vdev_mlme_get_substate(vdev);
hdd_hang_data->offset += total_len;
hdd_objmgr_put_vdev(vdev);
dev_put(adapter->dev);
hdd_adapter_dev_put_debug(adapter, dbgid);
}
return NOTIFY_OK;

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012-2020 The Linux Foundation. All rights reserved.
* Copyright (c) 2012-2021 The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
@ -2898,13 +2898,15 @@ static bool hdd_is_any_sta_connecting(struct hdd_context *hdd_ctx)
{
struct hdd_adapter *adapter = NULL, *next_adapter = NULL;
struct hdd_station_ctx *sta_ctx;
wlan_net_dev_ref_dbgid dbgid = NET_DEV_HOLD_IS_ANY_STA_CONNECTING;
if (!hdd_ctx) {
hdd_err("HDD context is NULL");
return false;
}
hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) {
hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter,
dbgid) {
sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
if ((adapter->device_mode == QDF_STA_MODE) ||
(adapter->device_mode == QDF_P2P_CLIENT_MODE) ||
@ -2913,13 +2915,14 @@ static bool hdd_is_any_sta_connecting(struct hdd_context *hdd_ctx)
eConnectionState_Connecting) {
hdd_debug("vdev_id %d: connecting",
adapter->vdev_id);
dev_put(adapter->dev);
hdd_adapter_dev_put_debug(adapter, dbgid);
if (next_adapter)
dev_put(next_adapter->dev);
hdd_adapter_dev_put_debug(next_adapter,
dbgid);
return true;
}
}
dev_put(adapter->dev);
hdd_adapter_dev_put_debug(adapter, dbgid);
}
return false;
@ -3469,10 +3472,12 @@ void hdd_sap_destroy_ctx_all(struct hdd_context *hdd_ctx, bool is_ssr)
hdd_debug("destroying all the sap context");
hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) {
hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter,
NET_DEV_HOLD_SAP_DESTROY_CTX_ALL) {
if (adapter->device_mode == QDF_SAP_MODE)
hdd_sap_destroy_ctx(adapter);
dev_put(adapter->dev);
hdd_adapter_dev_put_debug(adapter,
NET_DEV_HOLD_SAP_DESTROY_CTX_ALL);
}
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012-2020 The Linux Foundation. All rights reserved.
* Copyright (c) 2012-2021 The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
@ -5155,6 +5155,7 @@ static int drv_cmd_max_tx_power(struct hdd_adapter *adapter,
struct qdf_mac_addr bssid = QDF_MAC_ADDR_BCAST_INIT;
struct qdf_mac_addr selfmac = QDF_MAC_ADDR_BCAST_INIT;
struct hdd_adapter *next_adapter = NULL;
wlan_net_dev_ref_dbgid dbgid = NET_DEV_HOLD_DRV_CMD_MAX_TX_POWER;
ret = hdd_parse_setmaxtxpower_command(value, &tx_power);
if (ret) {
@ -5162,7 +5163,8 @@ static int drv_cmd_max_tx_power(struct hdd_adapter *adapter,
return ret;
}
hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) {
hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter,
dbgid) {
/* Assign correct self MAC address */
qdf_copy_macaddr(&bssid,
&adapter->mac_addr);
@ -5180,13 +5182,14 @@ static int drv_cmd_max_tx_power(struct hdd_adapter *adapter,
if (QDF_STATUS_SUCCESS != status) {
hdd_err("Set max tx power failed");
ret = -EINVAL;
dev_put(adapter->dev);
hdd_adapter_dev_put_debug(adapter, dbgid);
if (next_adapter)
dev_put(next_adapter->dev);
hdd_adapter_dev_put_debug(next_adapter,
dbgid);
goto exit;
}
hdd_debug("Set max tx power success");
dev_put(adapter->dev);
hdd_adapter_dev_put_debug(adapter, dbgid);
}
exit:

View file

@ -55,6 +55,7 @@ void hdd_ipa_set_tx_flow_info(void)
void *soc = cds_get_context(QDF_MODULE_ID_SOC);
#endif /* QCA_LL_LEGACY_TX_FLOW_CONTROL */
struct wlan_objmgr_psoc *psoc;
wlan_net_dev_ref_dbgid dbgid = NET_DEV_HOLD_IPA_SET_TX_FLOW_INFO;
hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD);
if (!hdd_ctx) {
@ -70,7 +71,8 @@ void hdd_ipa_set_tx_flow_info(void)
psoc = hdd_ctx->psoc;
hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) {
hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter,
dbgid) {
switch (adapter->device_mode) {
case QDF_STA_MODE:
sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
@ -207,7 +209,8 @@ void hdd_ipa_set_tx_flow_info(void)
if (!preAdapterContext) {
hdd_err("SCC: Previous adapter context NULL");
dev_put(adapter->dev);
hdd_adapter_dev_put_debug(
adapter, dbgid);
continue;
}
@ -256,7 +259,8 @@ void hdd_ipa_set_tx_flow_info(void)
if (!adapter5) {
hdd_err("MCC: 5GHz adapter context NULL");
dev_put(adapter->dev);
hdd_adapter_dev_put_debug(
adapter, dbgid);
continue;
}
adapter5->tx_flow_low_watermark =
@ -285,7 +289,8 @@ void hdd_ipa_set_tx_flow_info(void)
if (!adapter2_4) {
hdd_err("MCC: 2.4GHz adapter context NULL");
dev_put(adapter->dev);
hdd_adapter_dev_put_debug(
adapter, dbgid);
continue;
}
adapter2_4->tx_flow_low_watermark =
@ -318,7 +323,7 @@ void hdd_ipa_set_tx_flow_info(void)
}
targetChannel = 0;
#endif /* QCA_LL_LEGACY_TX_FLOW_CONTROL */
dev_put(adapter->dev);
hdd_adapter_dev_put_debug(adapter, dbgid);
}
}

File diff suppressed because it is too large Load diff

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2020 The Linux Foundation. All rights reserved.
* Copyright (c) 2016-2021 The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
@ -124,15 +124,18 @@ static bool hdd_is_ndp_allowed(struct hdd_context *hdd_ctx)
{
struct hdd_adapter *adapter, *next_adapter = NULL;
struct hdd_station_ctx *sta_ctx;
wlan_net_dev_ref_dbgid dbgid = NET_DEV_HOLD_IS_NDP_ALLOWED;
hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) {
hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter,
dbgid) {
switch (adapter->device_mode) {
case QDF_P2P_GO_MODE:
if (test_bit(SOFTAP_BSS_STARTED,
&adapter->event_flags)) {
dev_put(adapter->dev);
hdd_adapter_dev_put_debug(adapter, dbgid);
if (next_adapter)
dev_put(next_adapter->dev);
hdd_adapter_dev_put_debug(next_adapter,
dbgid);
return false;
}
break;
@ -140,16 +143,17 @@ static bool hdd_is_ndp_allowed(struct hdd_context *hdd_ctx)
sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
if (hdd_conn_is_connected(sta_ctx) ||
hdd_is_connecting(sta_ctx)) {
dev_put(adapter->dev);
hdd_adapter_dev_put_debug(adapter, dbgid);
if (next_adapter)
dev_put(next_adapter->dev);
hdd_adapter_dev_put_debug(next_adapter,
dbgid);
return false;
}
break;
default:
break;
}
dev_put(adapter->dev);
hdd_adapter_dev_put_debug(adapter, dbgid);
}
return true;
@ -159,16 +163,19 @@ static bool hdd_is_ndp_allowed(struct hdd_context *hdd_ctx)
{
struct hdd_adapter *adapter, *next_adapter = NULL;
struct hdd_station_ctx *sta_ctx;
wlan_net_dev_ref_dbgid dbgid = NET_DEV_HOLD_IS_NDP_ALLOWED;
hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) {
hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter,
dbgid) {
switch (adapter->device_mode) {
case QDF_P2P_GO_MODE:
case QDF_SAP_MODE:
if (test_bit(SOFTAP_BSS_STARTED,
&adapter->event_flags)) {
dev_put(adapter->dev);
hdd_adapter_dev_put_debug(adapter, dbgid);
if (next_adapter)
dev_put(next_adapter->dev);
hdd_adapter_dev_put_debug(next_adapter,
dbgid);
return false;
}
break;
@ -176,16 +183,17 @@ static bool hdd_is_ndp_allowed(struct hdd_context *hdd_ctx)
sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
if (hdd_conn_is_connected(sta_ctx) ||
hdd_is_connecting(sta_ctx)) {
dev_put(adapter->dev);
hdd_adapter_dev_put_debug(adapter, dbgid);
if (next_adapter)
dev_put(next_adapter->dev);
hdd_adapter_dev_put_debug(next_adapter,
dbgid);
return false;
}
break;
default:
break;
}
dev_put(adapter->dev);
hdd_adapter_dev_put_debug(adapter, dbgid);
}
return true;
@ -576,10 +584,11 @@ int hdd_ndi_open(char *iface_name)
return -EINVAL;
}
hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) {
hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter,
NET_DEV_HOLD_NDI_OPEN) {
if (WLAN_HDD_IS_NDI(adapter))
ndi_adapter_count++;
dev_put(adapter->dev);
hdd_adapter_dev_put_debug(adapter, NET_DEV_HOLD_NDI_OPEN);
}
if (ndi_adapter_count >= MAX_NDI_ADAPTERS) {
hdd_err("Can't allow more than %d NDI adapters",

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012-2020 The Linux Foundation. All rights reserved.
* Copyright (c) 2012-2021 The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
@ -191,6 +191,7 @@ static void send_oem_reg_rsp_nlink_msg(void)
uint8_t *device_mode;
uint8_t *vdev_id;
struct hdd_adapter *adapter, *next_adapter = NULL;
wlan_net_dev_ref_dbgid dbgid = NET_DEV_HOLD_SEND_OEM_REG_RSP_NLINK_MSG;
/* OEM msg is always to a specific process & cannot be a broadcast */
if (p_hdd_ctx->oem_pid == 0) {
@ -221,7 +222,8 @@ static void send_oem_reg_rsp_nlink_msg(void)
*num_interfaces = 0;
/* Iterate through each adapter and fill device mode and vdev id */
hdd_for_each_adapter_dev_held_safe(p_hdd_ctx, adapter, next_adapter) {
hdd_for_each_adapter_dev_held_safe(p_hdd_ctx, adapter, next_adapter,
dbgid) {
device_mode = buf++;
vdev_id = buf++;
*device_mode = adapter->device_mode;
@ -230,7 +232,7 @@ static void send_oem_reg_rsp_nlink_msg(void)
hdd_debug("num_interfaces: %d, device_mode: %d, vdev_id: %d",
*num_interfaces, *device_mode,
*vdev_id);
dev_put(adapter->dev);
hdd_adapter_dev_put_debug(adapter, dbgid);
}
ani_hdr->length =

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2020-2021, The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@ -46,15 +46,17 @@ void hdd_periodic_sta_stats_display(struct hdd_context *hdd_ctx)
struct hdd_config *hdd_cfg;
char *dev_name;
bool should_log;
wlan_net_dev_ref_dbgid dbgid = NET_DEV_HOLD_PERIODIC_STA_STATS_DISPLAY;
if (!hdd_ctx)
return;
hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) {
hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter,
dbgid) {
should_log = false;
if (adapter->device_mode != QDF_STA_MODE) {
dev_put(adapter->dev);
hdd_adapter_dev_put_debug(adapter, dbgid);
continue;
}
@ -63,7 +65,7 @@ void hdd_periodic_sta_stats_display(struct hdd_context *hdd_ctx)
if (!adapter->is_sta_periodic_stats_enabled) {
qdf_mutex_release(&adapter->sta_periodic_stats_lock);
dev_put(adapter->dev);
hdd_adapter_dev_put_debug(adapter, dbgid);
continue;
}
@ -92,7 +94,7 @@ void hdd_periodic_sta_stats_display(struct hdd_context *hdd_ctx)
hdd_nofl_info("%s: Rx DNS responses: %d", dev_name,
sta_stats.hdd_dns_stats.rx_dns_rsp_count);
}
dev_put(adapter->dev);
hdd_adapter_dev_put_debug(adapter, dbgid);
}
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012-2020 The Linux Foundation. All rights reserved.
* Copyright (c) 2012-2021 The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
@ -1320,9 +1320,11 @@ hdd_suspend_wlan(void)
return -EINVAL;
}
hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) {
hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter,
NET_DEV_HOLD_SUSPEND_WLAN) {
if (wlan_hdd_validate_vdev_id(adapter->vdev_id)) {
dev_put(adapter->dev);
hdd_adapter_dev_put_debug(adapter,
NET_DEV_HOLD_SUSPEND_WLAN);
continue;
}
@ -1339,7 +1341,7 @@ hdd_suspend_wlan(void)
/* Configure supported OffLoads */
hdd_enable_host_offloads(adapter, pmo_apps_suspend);
hdd_update_conn_state_mask(adapter, &conn_state_mask);
dev_put(adapter->dev);
hdd_adapter_dev_put_debug(adapter, NET_DEV_HOLD_SUSPEND_WLAN);
}
status = ucfg_pmo_psoc_user_space_suspend_req(hdd_ctx->psoc,
@ -1385,9 +1387,11 @@ static int hdd_resume_wlan(void)
hdd_wlan_suspend_resume_event(HDD_WLAN_EARLY_RESUME);
/*loop through all adapters. Concurrency */
hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) {
hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter,
NET_DEV_HOLD_RESUME_WLAN) {
if (wlan_hdd_validate_vdev_id(adapter->vdev_id)) {
dev_put(adapter->dev);
hdd_adapter_dev_put_debug(adapter,
NET_DEV_HOLD_RESUME_WLAN);
continue;
}
@ -1404,7 +1408,7 @@ static int hdd_resume_wlan(void)
if (adapter->device_mode == QDF_STA_MODE)
status = hdd_disable_default_pkt_filters(adapter);
dev_put(adapter->dev);
hdd_adapter_dev_put_debug(adapter, NET_DEV_HOLD_RESUME_WLAN);
}
ucfg_ipa_resume(hdd_ctx->pdev);
@ -1441,14 +1445,16 @@ static void hdd_ssr_restart_sap(struct hdd_context *hdd_ctx)
hdd_enter();
hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) {
hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter,
NET_DEV_HOLD_SSR_RESTART_SAP) {
if (adapter->device_mode == QDF_SAP_MODE) {
if (test_bit(SOFTAP_INIT_DONE, &adapter->event_flags)) {
hdd_debug("Restart prev SAP session");
wlan_hdd_start_sap(adapter, true);
}
}
dev_put(adapter->dev);
hdd_adapter_dev_put_debug(adapter,
NET_DEV_HOLD_SSR_RESTART_SAP);
}
hdd_exit();
@ -1570,7 +1576,8 @@ static void hdd_send_default_scan_ies(struct hdd_context *hdd_ctx)
{
struct hdd_adapter *adapter, *next_adapter = NULL;
hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) {
hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter,
NET_DEV_HOLD_SEND_DEFAULT_SCAN_IES) {
if (hdd_is_interface_up(adapter) &&
(adapter->device_mode == QDF_STA_MODE ||
adapter->device_mode == QDF_P2P_DEVICE_MODE) &&
@ -1580,7 +1587,8 @@ static void hdd_send_default_scan_ies(struct hdd_context *hdd_ctx)
adapter->scan_info.default_scan_ies,
adapter->scan_info.default_scan_ies_len);
}
dev_put(adapter->dev);
hdd_adapter_dev_put_debug(adapter,
NET_DEV_HOLD_SEND_DEFAULT_SCAN_IES);
}
}
@ -2009,6 +2017,7 @@ static int __wlan_hdd_cfg80211_suspend_wlan(struct wiphy *wiphy,
mac_handle_t mac_handle;
struct wlan_objmgr_vdev *vdev;
int rc;
wlan_net_dev_ref_dbgid dbgid = NET_DEV_HOLD_CFG80211_SUSPEND_WLAN;
hdd_enter();
@ -2042,9 +2051,10 @@ static int __wlan_hdd_cfg80211_suspend_wlan(struct wiphy *wiphy,
* "dfs_cac_block_tx" is set to true when RADAR is found and stay true
* until CAC is done for a SoftAP which is in started state.
*/
hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) {
hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter,
dbgid) {
if (wlan_hdd_validate_vdev_id(adapter->vdev_id)) {
dev_put(adapter->dev);
hdd_adapter_dev_put_debug(adapter, dbgid);
continue;
}
@ -2057,9 +2067,10 @@ static int __wlan_hdd_cfg80211_suspend_wlan(struct wiphy *wiphy,
hdd_err("RADAR detection in progress, do not allow suspend");
wlan_hdd_inc_suspend_stats(hdd_ctx,
SUSPEND_FAIL_RADAR);
dev_put(adapter->dev);
hdd_adapter_dev_put_debug(adapter, dbgid);
if (next_adapter)
dev_put(next_adapter->dev);
hdd_adapter_dev_put_debug(next_adapter,
dbgid);
return -EAGAIN;
} else if (!ucfg_pmo_get_enable_sap_suspend(
hdd_ctx->psoc)) {
@ -2067,9 +2078,10 @@ static int __wlan_hdd_cfg80211_suspend_wlan(struct wiphy *wiphy,
* suspend
*/
hdd_err("SAP does not support suspend!!");
dev_put(adapter->dev);
hdd_adapter_dev_put_debug(adapter, dbgid);
if (next_adapter)
dev_put(next_adapter->dev);
hdd_adapter_dev_put_debug(next_adapter,
dbgid);
return -EOPNOTSUPP;
}
} else if (QDF_P2P_GO_MODE == adapter->device_mode) {
@ -2079,13 +2091,14 @@ static int __wlan_hdd_cfg80211_suspend_wlan(struct wiphy *wiphy,
* suspend
*/
hdd_err("GO does not support suspend!!");
dev_put(adapter->dev);
hdd_adapter_dev_put_debug(adapter, dbgid);
if (next_adapter)
dev_put(next_adapter->dev);
hdd_adapter_dev_put_debug(next_adapter,
dbgid);
return -EOPNOTSUPP;
}
}
dev_put(adapter->dev);
hdd_adapter_dev_put_debug(adapter, dbgid);
}
/* p2p cleanup task based on scheduler */
ucfg_p2p_cleanup_tx_by_psoc(hdd_ctx->psoc);
@ -2097,14 +2110,15 @@ static int __wlan_hdd_cfg80211_suspend_wlan(struct wiphy *wiphy,
}
/* flush any pending powersave timers */
hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) {
hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter,
dbgid) {
if (wlan_hdd_validate_vdev_id(adapter->vdev_id)) {
dev_put(adapter->dev);
hdd_adapter_dev_put_debug(adapter, dbgid);
continue;
}
sme_ps_timer_flush_sync(mac_handle, adapter->vdev_id);
dev_put(adapter->dev);
hdd_adapter_dev_put_debug(adapter, dbgid);
}
/*

View file

@ -1397,10 +1397,12 @@ static void hdd_country_change_update_sta(struct hdd_context *hdd_ctx)
bool freq_changed, phy_changed;
qdf_freq_t oper_freq;
eCsrPhyMode csr_phy_mode;
wlan_net_dev_ref_dbgid dbgid = NET_DEV_HOLD_COUNTRY_CHANGE_UPDATE_STA;
pdev = hdd_ctx->pdev;
hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) {
hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter,
dbgid) {
oper_freq = hdd_get_adapter_home_channel(adapter);
freq_changed = wlan_reg_is_disable_for_freq(pdev, oper_freq);
@ -1433,7 +1435,7 @@ static void hdd_country_change_update_sta(struct hdd_context *hdd_ctx)
break;
}
/* dev_put has to be done here */
dev_put(adapter->dev);
hdd_adapter_dev_put_debug(adapter, dbgid);
}
}
@ -1525,10 +1527,12 @@ static void hdd_country_change_update_sap(struct hdd_context *hdd_ctx)
bool phy_changed;
qdf_freq_t oper_freq;
eCsrPhyMode csr_phy_mode;
wlan_net_dev_ref_dbgid dbgid = NET_DEV_HOLD_COUNTRY_CHANGE_UPDATE_SAP;
pdev = hdd_ctx->pdev;
hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) {
hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter,
dbgid) {
oper_freq = hdd_get_adapter_home_channel(adapter);
switch (adapter->device_mode) {
@ -1561,7 +1565,7 @@ static void hdd_country_change_update_sap(struct hdd_context *hdd_ctx)
break;
}
/* dev_put has to be done here */
dev_put(adapter->dev);
hdd_adapter_dev_put_debug(adapter, dbgid);
}
}

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012-2020 The Linux Foundation. All rights reserved.
* Copyright (c) 2012-2021 The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
@ -1747,17 +1747,20 @@ static void cache_station_stats_cb(struct stats_event *ev, void *cookie)
struct hdd_adapter *adapter = cookie, *next_adapter = NULL;
struct hdd_context *hdd_ctx = adapter->hdd_ctx;
uint8_t vdev_id = adapter->vdev_id;
wlan_net_dev_ref_dbgid dbgid = NET_DEV_HOLD_DISPLAY_TXRX_STATS;
hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter) {
hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter,
dbgid) {
if (adapter->vdev_id != vdev_id) {
dev_put(adapter->dev);
hdd_adapter_dev_put_debug(adapter, dbgid);
continue;
}
copy_station_stats_to_adapter(adapter, ev);
/* dev_put has to be done here */
dev_put(adapter->dev);
hdd_adapter_dev_put_debug(adapter, dbgid);
if (next_adapter)
dev_put(next_adapter->dev);
hdd_adapter_dev_put_debug(next_adapter,
dbgid);
break;
}
}
@ -6570,8 +6573,10 @@ void wlan_hdd_display_txrx_stats(struct hdd_context *ctx)
int i = 0;
uint32_t total_rx_pkt, total_rx_dropped,
total_rx_delv, total_rx_refused;
wlan_net_dev_ref_dbgid dbgid = NET_DEV_HOLD_CACHE_STATION_STATS_CB;
hdd_for_each_adapter_dev_held_safe(ctx, adapter, next_adapter) {
hdd_for_each_adapter_dev_held_safe(ctx, adapter, next_adapter,
dbgid) {
total_rx_pkt = 0;
total_rx_dropped = 0;
total_rx_delv = 0;
@ -6579,7 +6584,7 @@ void wlan_hdd_display_txrx_stats(struct hdd_context *ctx)
stats = &adapter->hdd_stats.tx_rx_stats;
if (adapter->vdev_id == INVAL_VDEV_ID) {
dev_put(adapter->dev);
hdd_adapter_dev_put_debug(adapter, dbgid);
continue;
}
@ -6592,7 +6597,7 @@ void wlan_hdd_display_txrx_stats(struct hdd_context *ctx)
}
/* dev_put has to be done here */
dev_put(adapter->dev);
hdd_adapter_dev_put_debug(adapter, dbgid);
hdd_debug("TX - called %u, dropped %u orphan %u",
stats->tx_called, stats->tx_dropped,