diff --git a/os_if/linux/mlme/src/osif_cm_connect_rsp.c b/os_if/linux/mlme/src/osif_cm_connect_rsp.c index dab6ff9863..9c09f8219e 100644 --- a/os_if/linux/mlme/src/osif_cm_connect_rsp.c +++ b/os_if/linux/mlme/src/osif_cm_connect_rsp.c @@ -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 */ diff --git a/os_if/linux/mlme/src/osif_cm_disconnect_rsp.c b/os_if/linux/mlme/src/osif_cm_disconnect_rsp.c index 8e905bd7bc..6999dbca42 100644 --- a/os_if/linux/mlme/src/osif_cm_disconnect_rsp.c +++ b/os_if/linux/mlme/src/osif_cm_disconnect_rsp.c @@ -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); diff --git a/os_if/linux/mlme/src/osif_cm_roam_rsp.c b/os_if/linux/mlme/src/osif_cm_roam_rsp.c index 8f6c0a4d0f..6ea9d22dc8 100644 --- a/os_if/linux/mlme/src/osif_cm_roam_rsp.c +++ b/os_if/linux/mlme/src/osif_cm_roam_rsp.c @@ -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 */ diff --git a/qdf/inc/qdf_mem.h b/qdf/inc/qdf_mem.h index c41eae9a23..59787f6864 100644 --- a/qdf/inc/qdf_mem.h +++ b/qdf/inc/qdf_mem.h @@ -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 diff --git a/qdf/linux/src/qdf_mem.c b/qdf/linux/src/qdf_mem.c index 0d435fcae9..1b2ccca281 100644 --- a/qdf/linux/src/qdf_mem.c +++ b/qdf/linux/src/qdf_mem.c @@ -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 /**