Prechádzať zdrojové kódy

qcacmn: Allocate memory from heap for NBUF references

Currently a fixed size array of 2K is used to hold the NBUF pointer
references for RX refill thread NBUFs. Since the queue length of the
NBUF queue is a compile time config, any length change beyond 2K
would result in overflow errors.

Allocate the memory for NBUF references dynamically instead to avoid
such overflow conditions.

Change-Id: I20680768faf20d7688ce33f68ce2aa2be2079be0
CRs-Fixed: 3707803
Manikanta Pubbisetty 1 rok pred
rodič
commit
e6fec28c32
2 zmenil súbory, kde vykonal 12 pridanie a 2 odobranie
  1. 11 1
      dp/wifi3.0/dp_rx_buffer_pool.c
  2. 1 1
      dp/wifi3.0/dp_types.h

+ 11 - 1
dp/wifi3.0/dp_rx_buffer_pool.c

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2020-2021 The Linux Foundation. All rights reserved.
- * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. 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
@@ -297,6 +297,15 @@ static void dp_rx_refill_buff_pool_init(struct dp_soc *soc, u8 mac_id)
 
 	buff_pool->max_bufq_len =
 		wlan_cfg_get_rx_refill_buf_pool_size(soc->wlan_cfg_ctx);
+
+	buff_pool->buf_elem = qdf_mem_malloc(buff_pool->max_bufq_len *
+					     sizeof(qdf_nbuf_t));
+	if (!buff_pool->buf_elem) {
+		dp_err("Failed to allocate memory for RX refill buf element");
+		buff_pool->is_initialized = false;
+		return;
+	}
+
 	buff_pool->dp_pdev = dp_get_pdev_for_lmac_id(soc, 0);
 	buff_pool->tail = 0;
 
@@ -395,6 +404,7 @@ static void dp_rx_refill_buff_pool_deinit(struct dp_soc *soc, u8 mac_id)
 	dp_info("Rx refill buffers freed during deinit %u head: %u, tail: %u",
 		count, buff_pool->head, buff_pool->tail);
 
+	qdf_mem_free(buff_pool->buf_elem);
 	buff_pool->is_initialized = false;
 }
 

+ 1 - 1
dp/wifi3.0/dp_types.h

@@ -1542,7 +1542,7 @@ struct rx_refill_buff_pool {
 	uint16_t tail;
 	struct dp_pdev *dp_pdev;
 	uint16_t max_bufq_len;
-	qdf_nbuf_t buf_elem[2048];
+	qdf_nbuf_t *buf_elem;
 };
 
 #ifdef DP_TX_HW_DESC_HISTORY