Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4593ca62 authored by Abhishek Singh's avatar Abhishek Singh
Browse files

qcacmn: Use atomic allocation for all scheduler context allocations

In low memory environments using GFP_KERNEL flag may cause
scheduler thread to sleep. Scheduler thread callback handlers
are expected to be atomic in nature to ensure timely execution
of different commands.

Change-Id: I757e88f63cf6e97f6f8839a152798c5b8bfdd28f
CRs-Fixed: 2232553
parent 5d61ede9
Loading
Loading
Loading
Loading
+5 −5
Original line number Original line Diff line number Diff line
@@ -838,7 +838,7 @@ static void wlan_vendor_scan_callback(struct cfg80211_scan_request *req,
	skb = cfg80211_vendor_event_alloc(req->wdev->wiphy, req->wdev,
	skb = cfg80211_vendor_event_alloc(req->wdev->wiphy, req->wdev,
			SCAN_DONE_EVENT_BUF_SIZE + 4 + NLMSG_HDRLEN,
			SCAN_DONE_EVENT_BUF_SIZE + 4 + NLMSG_HDRLEN,
			QCA_NL80211_VENDOR_SUBCMD_SCAN_DONE_INDEX,
			QCA_NL80211_VENDOR_SUBCMD_SCAN_DONE_INDEX,
			GFP_KERNEL);
			GFP_ATOMIC);


	if (!skb) {
	if (!skb) {
		cfg80211_err("skb alloc failed");
		cfg80211_err("skb alloc failed");
@@ -884,7 +884,7 @@ static void wlan_vendor_scan_callback(struct cfg80211_scan_request *req,
	if (nla_put_u8(skb, QCA_WLAN_VENDOR_ATTR_SCAN_STATUS, scan_status))
	if (nla_put_u8(skb, QCA_WLAN_VENDOR_ATTR_SCAN_STATUS, scan_status))
		goto nla_put_failure;
		goto nla_put_failure;


	cfg80211_vendor_event(skb, GFP_KERNEL);
	cfg80211_vendor_event(skb, GFP_ATOMIC);
	qdf_mem_free(req);
	qdf_mem_free(req);


	return;
	return;
@@ -1719,7 +1719,7 @@ wlan_cfg80211_inform_bss_frame_data(struct wiphy *wiphy,
	data.boottime_ns = bss->boottime_ns;
	data.boottime_ns = bss->boottime_ns;
	data.signal = bss->rssi;
	data.signal = bss->rssi;
	return cfg80211_inform_bss_frame_data(wiphy, &data, bss->mgmt,
	return cfg80211_inform_bss_frame_data(wiphy, &data, bss->mgmt,
					      bss->frame_len, GFP_KERNEL);
					      bss->frame_len, GFP_ATOMIC);
}
}
#else
#else
struct cfg80211_bss *
struct cfg80211_bss *
@@ -1729,7 +1729,7 @@ wlan_cfg80211_inform_bss_frame_data(struct wiphy *wiphy,
{
{
	return cfg80211_inform_bss_frame(wiphy, bss->chan, bss->mgmt,
	return cfg80211_inform_bss_frame(wiphy, bss->chan, bss->mgmt,
					 bss->frame_len,
					 bss->frame_len,
					 bss->rssi, GFP_KERNEL);
					 bss->rssi, GFP_ATOMIC);
}
}
#endif
#endif


@@ -1763,7 +1763,7 @@ void wlan_cfg80211_inform_bss_frame(struct wlan_objmgr_pdev *pdev,
	wiphy = pdev_ospriv->wiphy;
	wiphy = pdev_ospriv->wiphy;


	bss_data.frame_len = wlan_get_frame_len(scan_params);
	bss_data.frame_len = wlan_get_frame_len(scan_params);
	bss_data.mgmt = qdf_mem_malloc(bss_data.frame_len);
	bss_data.mgmt = qdf_mem_malloc_atomic(bss_data.frame_len);
	if (!bss_data.mgmt) {
	if (!bss_data.mgmt) {
		cfg80211_err("mem alloc failed");
		cfg80211_err("mem alloc failed");
		return;
		return;
+1 −0
Original line number Original line Diff line number Diff line
@@ -166,6 +166,7 @@ void qdf_mem_check_for_leaks(void);
 * @file: file name of the call site
 * @file: file name of the call site
 * @line: line numbe rof the call site
 * @line: line numbe rof the call site
 * @caller: Address of the caller function
 * @caller: Address of the caller function
 * @flag: GFP flag
 *
 *
 * Return: pointer of allocated memory or null if memory alloc fails
 * Return: pointer of allocated memory or null if memory alloc fails
 */
 */
+1 −1
Original line number Original line Diff line number Diff line
@@ -236,7 +236,7 @@ QDF_STATUS scm_11d_cc_db_init(struct wlan_objmgr_psoc *psoc)
		return QDF_STATUS_E_INVAL;
		return QDF_STATUS_E_INVAL;
	}
	}


	cc_db = (struct scan_country_code_db *)qdf_mem_malloc(
	cc_db = (struct scan_country_code_db *)qdf_mem_malloc_atomic(
		   sizeof(struct scan_country_code_db) * WLAN_UMAC_MAX_PDEVS);
		   sizeof(struct scan_country_code_db) * WLAN_UMAC_MAX_PDEVS);
	if (!cc_db) {
	if (!cc_db) {
		scm_err("alloc country code db error");
		scm_err("alloc country code db error");
+4 −3
Original line number Original line Diff line number Diff line
@@ -442,7 +442,8 @@ static void scm_update_alt_wcn_ie(struct scan_cache_entry *from,


	if (!dst->alt_wcn_ie.ptr) {
	if (!dst->alt_wcn_ie.ptr) {
		/* allocate this additional buffer for alternate WCN IE */
		/* allocate this additional buffer for alternate WCN IE */
		dst->alt_wcn_ie.ptr = qdf_mem_malloc(WLAN_MAX_IE_LEN + 2);
		dst->alt_wcn_ie.ptr =
			qdf_mem_malloc_atomic(WLAN_MAX_IE_LEN + 2);
		if (!dst->alt_wcn_ie.ptr) {
		if (!dst->alt_wcn_ie.ptr) {
			scm_err("failed to allocate memory");
			scm_err("failed to allocate memory");
			return;
			return;
@@ -928,7 +929,7 @@ scm_scan_apply_filter_get_entry(struct wlan_objmgr_psoc *psoc,
	if (!match)
	if (!match)
		return QDF_STATUS_SUCCESS;
		return QDF_STATUS_SUCCESS;


	scan_node = qdf_mem_malloc(sizeof(*scan_node));
	scan_node = qdf_mem_malloc_atomic(sizeof(*scan_node));
	if (!scan_node)
	if (!scan_node)
		return QDF_STATUS_E_NOMEM;
		return QDF_STATUS_E_NOMEM;


@@ -1043,7 +1044,7 @@ qdf_list_t *scm_get_scan_result(struct wlan_objmgr_pdev *pdev,
		return NULL;
		return NULL;
	}
	}


	tmp_list = qdf_mem_malloc(sizeof(*tmp_list));
	tmp_list = qdf_mem_malloc_atomic(sizeof(*tmp_list));
	if (!tmp_list) {
	if (!tmp_list) {
		scm_err("failed tp allocate scan_result");
		scm_err("failed tp allocate scan_result");
		return NULL;
		return NULL;
+3 −3
Original line number Original line Diff line number Diff line
/*
/*
 * Copyright (c) 2017 The Linux Foundation. All rights reserved.
 * Copyright (c) 2017-2018 The Linux Foundation. All rights reserved.
 *
 *
 * Permission to use, copy, modify, and/or distribute this software for
 * Permission to use, copy, modify, and/or distribute this software for
 * any purpose with or without fee is hereby granted, provided that the
 * any purpose with or without fee is hereby granted, provided that the
@@ -29,7 +29,7 @@ QDF_STATUS wlan_scan_psoc_created_notification(struct wlan_objmgr_psoc *psoc,
	struct wlan_scan_obj *scan_obj;
	struct wlan_scan_obj *scan_obj;
	QDF_STATUS status = QDF_STATUS_SUCCESS;
	QDF_STATUS status = QDF_STATUS_SUCCESS;


	scan_obj = qdf_mem_malloc(sizeof(struct wlan_scan_obj));
	scan_obj = qdf_mem_malloc_atomic(sizeof(struct wlan_scan_obj));
	if (scan_obj == NULL) {
	if (scan_obj == NULL) {
		scm_err("Failed to allocate memory");
		scm_err("Failed to allocate memory");
		return QDF_STATUS_E_NOMEM;
		return QDF_STATUS_E_NOMEM;
@@ -78,7 +78,7 @@ QDF_STATUS wlan_scan_vdev_created_notification(struct wlan_objmgr_vdev *vdev,
	struct scan_vdev_obj *scan_vdev_obj;
	struct scan_vdev_obj *scan_vdev_obj;
	QDF_STATUS status = QDF_STATUS_SUCCESS;
	QDF_STATUS status = QDF_STATUS_SUCCESS;


	scan_vdev_obj = qdf_mem_malloc(sizeof(struct scan_vdev_obj));
	scan_vdev_obj = qdf_mem_malloc_atomic(sizeof(struct scan_vdev_obj));
	if (scan_vdev_obj == NULL) {
	if (scan_vdev_obj == NULL) {
		scm_err("Failed to allocate memory");
		scm_err("Failed to allocate memory");
		return QDF_STATUS_E_NOMEM;
		return QDF_STATUS_E_NOMEM;
Loading