qcacmn: Call cfg80211 functions with context aware allocation flags

There are instances in the code where the response is sent from the
driver to the supplicant indicating the allocation flags which is
used by the supplicant to allocate memory.

In those situations, we should pass the allocation flags based on
the context in which the response is sent.

Send the response with the right allocation flags to the supplicant.

Change-Id: I85f1c29fc66ba51a9f9c645692712c3a25b7fed1
CRs-Fixed: 2987552
This commit is contained in:
Vivek
2021-07-21 23:40:29 +05:30
committed by Madan Koyyalamudi
parent 5ee593e754
commit f8167f4dbc
5 changed files with 37 additions and 22 deletions

View File

@@ -193,7 +193,7 @@ osif_connect_timeout(struct net_device *dev, const u8 *bssid,
osif_debug("nl_timeout_reason %d", nl_timeout_reason);
cfg80211_connect_timeout(dev, bssid, NULL, 0, GFP_KERNEL,
cfg80211_connect_timeout(dev, bssid, NULL, 0, qdf_mem_malloc_flags(),
nl_timeout_reason);
}
@@ -228,7 +228,7 @@ static void __osif_connect_bss(struct net_device *dev,
cfg80211_connect_bss(dev, rsp->bssid.bytes, bss,
req_ptr, req_len, rsp_ptr, rsp_len, status,
GFP_KERNEL, nl_timeout_reason);
qdf_mem_malloc_flags(), nl_timeout_reason);
}
#else /* CFG80211_CONNECT_TIMEOUT_REASON_CODE */
@@ -239,7 +239,7 @@ static void osif_connect_timeout(
const u8 *bssid,
enum wlan_cm_connect_fail_reason reason)
{
cfg80211_connect_timeout(dev, bssid, NULL, 0, GFP_KERNEL);
cfg80211_connect_timeout(dev, bssid, NULL, 0, qdf_mem_malloc_flags());
}
#endif
@@ -260,7 +260,7 @@ static void __osif_connect_bss(struct net_device *dev,
cfg80211_connect_bss(dev, rsp->bssid.bytes, bss,
req_ptr, req_len, rsp_ptr, rsp_len,
status, GFP_KERNEL);
status, qdf_mem_malloc_flags());
}
#endif /* CFG80211_CONNECT_TIMEOUT_REASON_CODE */
@@ -420,7 +420,7 @@ static void osif_connect_done(struct net_device *dev, struct cfg80211_bss *bss,
}
osif_debug("Connect resp status %d", conn_rsp_params.status);
cfg80211_connect_done(dev, &conn_rsp_params, GFP_KERNEL);
cfg80211_connect_done(dev, &conn_rsp_params, qdf_mem_malloc_flags());
if (rsp->connect_ies.fils_ie && rsp->connect_ies.fils_ie->hlp_data_len)
osif_cm_set_hlp_data(dev, vdev, rsp);
}
@@ -687,7 +687,8 @@ static void osif_indcate_connect_results(struct wlan_objmgr_vdev *vdev,
&rsp_len, &rsp_ptr);
cfg80211_connect_result(osif_priv->wdev->netdev,
rsp->bssid.bytes, req_ptr, req_len,
rsp_ptr, rsp_len, status, GFP_KERNEL);
rsp_ptr, rsp_len, status,
qdf_mem_malloc_flags());
}
#endif /* WLAN_FEATURE_11BE_MLO */
#endif /* CFG80211_CONNECT_BSS */

View File

@@ -229,9 +229,10 @@ QDF_STATUS osif_disconnect_handler(struct wlan_objmgr_vdev *vdev,
osif_cm_disconnect_comp_ind(vdev, rsp, OSIF_PRE_USERSPACE_UPDATE);
osif_cm_indicate_disconnect(vdev, osif_priv->wdev->netdev,
ieee80211_reason, locally_generated,
rsp->ap_discon_ie.ptr,
rsp->ap_discon_ie.len, GFP_KERNEL);
ieee80211_reason,
locally_generated, rsp->ap_discon_ie.ptr,
rsp->ap_discon_ie.len,
qdf_mem_malloc_flags());
osif_cm_disconnect_comp_ind(vdev, rsp, OSIF_POST_USERSPACE_UPDATE);

View File

@@ -75,7 +75,7 @@ static void osif_roamed_ind(struct net_device *dev, struct cfg80211_bss *bss,
info.req_ie_len = req_ie_len;
info.resp_ie = resp_ie;
info.resp_ie_len = resp_ie_len;
cfg80211_roamed(dev, &info, GFP_KERNEL);
cfg80211_roamed(dev, &info, qdf_mem_malloc_flags());
}
#else
static inline void osif_roamed_ind(struct net_device *dev,
@@ -85,7 +85,7 @@ static inline void osif_roamed_ind(struct net_device *dev,
size_t resp_ie_len)
{
cfg80211_roamed_bss(dev, bss, req_ie, req_ie_len, resp_ie, resp_ie_len,
GFP_KERNEL);
qdf_mem_malloc_flags());
}
#endif
@@ -240,7 +240,7 @@ static int osif_send_roam_auth_event(struct wlan_objmgr_vdev *vdev,
sizeof(uint16_t) + sizeof(uint8_t) +
(9 * NLMSG_HDRLEN) + fils_params_len,
QCA_NL80211_VENDOR_SUBCMD_KEY_MGMT_ROAM_AUTH_INDEX,
GFP_KERNEL);
qdf_mem_malloc_flags());
if (!skb) {
osif_err("cfg80211_vendor_event_alloc failed");
@@ -341,7 +341,7 @@ static int osif_send_roam_auth_event(struct wlan_objmgr_vdev *vdev,
}
}
cfg80211_vendor_event(skb, GFP_KERNEL);
cfg80211_vendor_event(skb, qdf_mem_malloc_flags());
return 0;
nla_put_failure:
@@ -440,7 +440,7 @@ osif_pmksa_candidate_notify(struct wlan_objmgr_vdev *vdev,
cfg80211_pmksa_candidate_notify(wdev->netdev, index,
bssid->bytes,
preauth, GFP_KERNEL);
preauth, qdf_mem_malloc_flags());
return QDF_STATUS_SUCCESS;
}
#endif /* CONN_MGR_ADV_FEATURE */

View File

@@ -330,6 +330,17 @@ void qdf_mem_multi_pages_free(qdf_device_t osdev,
#endif /* MEMORY_DEBUG */
/**
* qdf_mem_malloc_flags: Get mem allocation flags
*
* Return the flag to be use for memory allocation
* based on the context
*
* Returns: Based on the context, returns the GFP flag
* for memory alloaction
*/
int qdf_mem_malloc_flags(void);
/**
* qdf_prealloc_disabled_config_get() - Get the user configuration of
* prealloc_disabled

View File

@@ -497,6 +497,16 @@ bool prealloc_disabled = 1;
qdf_declare_param(prealloc_disabled, bool);
qdf_export_symbol(prealloc_disabled);
int qdf_mem_malloc_flags(void)
{
if (in_interrupt() || irqs_disabled() || in_atomic())
return GFP_ATOMIC;
return GFP_KERNEL;
}
qdf_export_symbol(qdf_mem_malloc_flags);
/**
* qdf_prealloc_disabled_config_get() - Get the user configuration of
* prealloc_disabled
@@ -1420,14 +1430,6 @@ static inline bool qdf_mem_prealloc_put(void *ptr)
}
#endif /* CONFIG_WCNSS_MEM_PRE_ALLOC */
static int qdf_mem_malloc_flags(void)
{
if (in_interrupt() || irqs_disabled() || in_atomic())
return GFP_ATOMIC;
return GFP_KERNEL;
}
/* External Function implementation */
#ifdef MEMORY_DEBUG
/**