Bläddra i källkod

qcacld-3.0: Reduce stack frame size in pmo_core_cache_ns_in_vdev_priv

Reduce stack frame size of pmo_core_cache_ns_in_vdev_priv()
by allocating dynamic memory to struct pmo_ns_offload_params.

Change-Id: I23a2bbcbc2b64c40513511479b1c8aeb9e7898d6
CRs-Fixed: 2868424
Dundi Raviteja 4 år sedan
förälder
incheckning
e420cbf610
1 ändrade filer med 20 tillägg och 16 borttagningar
  1. 20 16
      components/pmo/core/src/wlan_pmo_ns.c

+ 20 - 16
components/pmo/core/src/wlan_pmo_ns.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017-2020 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2017-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
@@ -75,22 +75,27 @@ static QDF_STATUS pmo_core_cache_ns_in_vdev_priv(
 {
 	QDF_STATUS status = QDF_STATUS_SUCCESS;
 	struct pmo_vdev_priv_obj *vdev_ctx;
-	struct pmo_ns_offload_params request;
+	struct pmo_ns_offload_params *request;
 	struct wlan_objmgr_peer *peer;
 
 	vdev_ctx = pmo_vdev_get_priv(vdev);
 
-	qdf_mem_zero(&request, sizeof(request));
-	pmo_core_fill_ns_addr(&request, ns_req);
+	request = qdf_mem_malloc(sizeof(*request));
+	if (!request) {
+		pmo_err("malloc failed for offload params");
+		return QDF_STATUS_E_NOMEM;
+	}
+
+	pmo_core_fill_ns_addr(request, ns_req);
 
-	request.enable = PMO_OFFLOAD_ENABLE;
-	request.is_offload_applied = false;
-	qdf_mem_copy(&request.self_macaddr.bytes,
-			  wlan_vdev_mlme_get_macaddr(vdev),
-			  QDF_MAC_ADDR_SIZE);
+	request->enable = PMO_OFFLOAD_ENABLE;
+	request->is_offload_applied = false;
+	qdf_mem_copy(&request->self_macaddr.bytes,
+		     wlan_vdev_mlme_get_macaddr(vdev),
+		     QDF_MAC_ADDR_SIZE);
 
 	/* set number of ns offload address count */
-	request.num_ns_offload_count = ns_req->count;
+	request->num_ns_offload_count = ns_req->count;
 
 	peer = wlan_objmgr_vdev_try_get_bsspeer(vdev, WLAN_PMO_ID);
 	if (!peer) {
@@ -102,17 +107,16 @@ static QDF_STATUS pmo_core_cache_ns_in_vdev_priv(
 		QDF_MAC_ADDR_REF(wlan_vdev_mlme_get_macaddr(vdev)),
 		QDF_MAC_ADDR_REF(wlan_peer_get_macaddr(peer)));
 	/* get peer and peer mac accdress aka ap mac address */
-	qdf_mem_copy(&request.bssid,
-		wlan_peer_get_macaddr(peer),
-		QDF_MAC_ADDR_SIZE);
+	qdf_mem_copy(&request->bssid, wlan_peer_get_macaddr(peer),
+		     QDF_MAC_ADDR_SIZE);
 	wlan_objmgr_peer_release_ref(peer, WLAN_PMO_ID);
 	/* cache ns request */
 	qdf_spin_lock_bh(&vdev_ctx->pmo_vdev_lock);
-	qdf_mem_copy(&vdev_ctx->vdev_ns_req, &request,
-		sizeof(vdev_ctx->vdev_ns_req));
+	qdf_mem_copy(&vdev_ctx->vdev_ns_req, request,
+		     sizeof(vdev_ctx->vdev_ns_req));
 	qdf_spin_unlock_bh(&vdev_ctx->pmo_vdev_lock);
 out:
-
+	qdf_mem_free(request);
 	return status;
 }