From b22da3d8526a935aa31e086e63f60ff3246cb61c Mon Sep 17 00:00:00 2001
From: hc <hc@nodka.com>
Date: Sat, 09 Dec 2023 07:24:11 +0000
Subject: [PATCH] add stmac read mac form eeprom
---
kernel/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_static_buf.c | 125 +++++++++++++++++++++--------------------
1 files changed, 64 insertions(+), 61 deletions(-)
diff --git a/kernel/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_static_buf.c b/kernel/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_static_buf.c
old mode 100644
new mode 100755
index d288788..cfbf305
--- a/kernel/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_static_buf.c
+++ b/kernel/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_static_buf.c
@@ -7,10 +7,10 @@
#include <linux/err.h>
#include <linux/skbuff.h>
-#define DHD_STATIC_VERSION_STR "101.10.361.24 (wlan=r892223-20220916-1)"
-#define STATIC_ERROR_LEVEL BIT(0)
-#define STATIC_TRACE_LEVEL BIT(1)
-#define STATIC_MSG_LEVEL BIT(0)
+#define DHD_STATIC_VERSION_STR "101.10.361.18 (wlan=r892223-20220519-1)"
+#define STATIC_ERROR_LEVEL (1 << 0)
+#define STATIC_TRACE_LEVEL (1 << 1)
+#define STATIC_MSG_LEVEL (1 << 0)
uint static_msg_level = STATIC_ERROR_LEVEL | STATIC_MSG_LEVEL;
#define DHD_STATIC_MSG(x, args...) \
@@ -35,8 +35,8 @@
#define BCMDHD_SDIO
#define BCMDHD_PCIE
//#define BCMDHD_USB
-#define CONFIG_BCMDHD_VTS { : = y}
-#define CONFIG_BCMDHD_DEBUG { : = y}
+#define CONFIG_BCMDHD_VTS := y
+#define CONFIG_BCMDHD_DEBUG := y
//#define BCMDHD_UNUSE_MEM
#ifndef MAX_NUM_ADAPTERS
@@ -86,11 +86,10 @@
};
#define STATIC_BUF_MAX_NUM 20
-#define STATIC_BUF_SIZE (PAGE_SIZE * 2)
+#define STATIC_BUF_SIZE (PAGE_SIZE*2)
#ifndef CUSTOM_LOG_DUMP_BUFSIZE_MB
-/* DHD_LOG_DUMP_BUF_SIZE 4 MB static memory in kernel */
-#define CUSTOM_LOG_DUMP_BUFSIZE_MB 4
+#define CUSTOM_LOG_DUMP_BUFSIZE_MB 4 /* DHD_LOG_DUMP_BUF_SIZE 4 MB static memory in kernel */
#endif /* CUSTOM_LOG_DUMP_BUFSIZE_MB */
#define DHD_PREALLOC_PROT_SIZE (16 * 1024)
@@ -98,7 +97,7 @@
#define DHD_PREALLOC_DATABUF_SIZE (64 * 1024)
#define DHD_PREALLOC_OSL_BUF_SIZE (STATIC_BUF_MAX_NUM * STATIC_BUF_SIZE)
#define DHD_PREALLOC_WIPHY_ESCAN0_SIZE (64 * 1024)
-#define DHD_PREALLOC_DHD_INFO_SIZE (42 * 1024)
+#define DHD_PREALLOC_DHD_INFO_SIZE (36 * 1024)
#if defined(CONFIG_BCMDHD_VTS) || defined(CONFIG_BCMDHD_DEBUG)
#define DHD_PREALLOC_MEMDUMP_RAM_SIZE (1290 * 1024)
#endif /* CONFIG_BCMDHD_VTS | CONFIG_BCMDHD_DEBUG */
@@ -129,9 +128,9 @@
#endif /* CONFIG_64BIT */
#define WLAN_DHD_MEMDUMP_SIZE (800 * 1024)
-#define DHD_SKB_1PAGE_BUFSIZE (PAGE_SIZE * 1)
-#define DHD_SKB_2PAGE_BUFSIZE (PAGE_SIZE * 2)
-#define DHD_SKB_4PAGE_BUFSIZE (PAGE_SIZE * 4)
+#define DHD_SKB_1PAGE_BUFSIZE (PAGE_SIZE*1)
+#define DHD_SKB_2PAGE_BUFSIZE (PAGE_SIZE*2)
+#define DHD_SKB_4PAGE_BUFSIZE (PAGE_SIZE*4)
#ifdef BCMDHD_PCIE
#define DHD_SKB_1PAGE_BUF_NUM 0
@@ -152,47 +151,47 @@
#define WLAN_SKB_BUF_NUM ((WLAN_SKB_1_2PAGE_BUF_NUM) + (DHD_SKB_4PAGE_BUF_NUM))
#endif
-void *wlan_static_prot[MAX_NUM_ADAPTERS] = {};
-void *wlan_static_rxbuf[MAX_NUM_ADAPTERS] = {};
-void *wlan_static_databuf[MAX_NUM_ADAPTERS] = {};
-void *wlan_static_osl_buf[MAX_NUM_ADAPTERS] = {};
-void *wlan_static_scan_buf0[MAX_NUM_ADAPTERS] = {};
-void *wlan_static_scan_buf1[MAX_NUM_ADAPTERS] = {};
-void *wlan_static_dhd_info_buf[MAX_NUM_ADAPTERS] = {};
-void *wlan_static_dhd_wlfc_info_buf[MAX_NUM_ADAPTERS] = {};
-void *wlan_static_if_flow_lkup[MAX_NUM_ADAPTERS] = {};
-void *wlan_static_dhd_memdump_ram_buf[MAX_NUM_ADAPTERS] = {};
-void *wlan_static_dhd_wlfc_hanger_buf[MAX_NUM_ADAPTERS] = {};
+void *wlan_static_prot[MAX_NUM_ADAPTERS] = {NULL};
+void *wlan_static_rxbuf [MAX_NUM_ADAPTERS] = {NULL};
+void *wlan_static_databuf[MAX_NUM_ADAPTERS] = {NULL};
+void *wlan_static_osl_buf[MAX_NUM_ADAPTERS] = {NULL};
+void *wlan_static_scan_buf0[MAX_NUM_ADAPTERS] = {NULL};
+void *wlan_static_scan_buf1[MAX_NUM_ADAPTERS] = {NULL};
+void *wlan_static_dhd_info_buf[MAX_NUM_ADAPTERS] = {NULL};
+void *wlan_static_dhd_wlfc_info_buf[MAX_NUM_ADAPTERS] = {NULL};
+void *wlan_static_if_flow_lkup[MAX_NUM_ADAPTERS] = {NULL};
+void *wlan_static_dhd_memdump_ram_buf[MAX_NUM_ADAPTERS] = {NULL};
+void *wlan_static_dhd_wlfc_hanger_buf[MAX_NUM_ADAPTERS] = {NULL};
#if defined(CONFIG_BCMDHD_VTS) || defined(CONFIG_BCMDHD_DEBUG)
-void *wlan_static_dhd_log_dump_buf[MAX_NUM_ADAPTERS] = {};
-void *wlan_static_dhd_log_dump_buf_ex[MAX_NUM_ADAPTERS] = {};
+void *wlan_static_dhd_log_dump_buf[MAX_NUM_ADAPTERS] = {NULL};
+void *wlan_static_dhd_log_dump_buf_ex[MAX_NUM_ADAPTERS] = {NULL};
#endif /* CONFIG_BCMDHD_VTS | CONFIG_BCMDHD_DEBUG */
-void *wlan_static_wl_escan_info_buf[MAX_NUM_ADAPTERS] = {};
-void *wlan_static_fw_verbose_ring_buf[MAX_NUM_ADAPTERS] = {};
-void *wlan_static_fw_event_ring_buf[MAX_NUM_ADAPTERS] = {};
-void *wlan_static_dhd_event_ring_buf[MAX_NUM_ADAPTERS] = {};
-void *wlan_static_nan_event_ring_buf[MAX_NUM_ADAPTERS] = {};
+void *wlan_static_wl_escan_info_buf[MAX_NUM_ADAPTERS] = {NULL};
+void *wlan_static_fw_verbose_ring_buf[MAX_NUM_ADAPTERS] = {NULL};
+void *wlan_static_fw_event_ring_buf[MAX_NUM_ADAPTERS] = {NULL};
+void *wlan_static_dhd_event_ring_buf[MAX_NUM_ADAPTERS] = {NULL};
+void *wlan_static_nan_event_ring_buf[MAX_NUM_ADAPTERS] = {NULL};
#if defined(BCMDHD_SDIO) || defined(BCMDHD_PCIE)
-static struct sk_buff *wlan_static_skb[MAX_NUM_ADAPTERS][WLAN_SKB_BUF_NUM] = {};
+static struct sk_buff *wlan_static_skb[MAX_NUM_ADAPTERS][WLAN_SKB_BUF_NUM] = {{NULL}};
#endif /* BCMDHD_SDIO | BCMDHD_PCIE */
void *
dhd_wlan_mem_prealloc(
-#if defined(BCMDHD_MDRIVER) && !defined(DHD_STATIC_IN_DRIVER)
+#ifdef BCMDHD_MDRIVER
uint bus_type, int index,
#endif
int section, unsigned long size)
{
-#if !defined(BCMDHD_MDRIVER) || defined(DHD_STATIC_IN_DRIVER)
+#ifndef BCMDHD_MDRIVER
int index = 0;
#endif
-#if defined(BCMDHD_MDRIVER) && !defined(DHD_STATIC_IN_DRIVER)
- DHD_STATIC_MSG("bus_type %d, index %d, section %d, size %ld\n",
+#ifdef BCMDHD_MDRIVER
+ DHD_STATIC_MSG("bus_type %d, index %d, sectoin %d, size %ld\n",
bus_type, index, section, size);
#else
- DHD_STATIC_MSG("section %d, size %ld\n", section, size);
+ DHD_STATIC_MSG("sectoin %d, size %ld\n", section, size);
#endif
if (section == DHD_PREALLOC_PROT)
@@ -424,24 +423,27 @@
unsigned long size = 0;
#if defined(BCMDHD_SDIO) || defined(BCMDHD_PCIE)
- for (i = 0; i < WLAN_SKB_BUF_NUM; i++)
+ for (i=0; i <WLAN_SKB_BUF_NUM; i++) {
wlan_static_skb[index][i] = NULL;
+ }
for (i = 0; i < DHD_SKB_1PAGE_BUF_NUM; i++) {
wlan_static_skb[index][i] = dev_alloc_skb(DHD_SKB_1PAGE_BUFSIZE);
- if (!wlan_static_skb[index][i])
+ if (!wlan_static_skb[index][i]) {
goto err_mem_alloc;
+ }
size += DHD_SKB_1PAGE_BUFSIZE;
- DHD_STATIC_TRACE("section %d skb[%d], size=%ld\n",
+ DHD_STATIC_TRACE("sectoin %d skb[%d], size=%ld\n",
DHD_PREALLOC_SKB_BUF, i, DHD_SKB_1PAGE_BUFSIZE);
}
for (i = DHD_SKB_1PAGE_BUF_NUM; i < WLAN_SKB_1_2PAGE_BUF_NUM; i++) {
wlan_static_skb[index][i] = dev_alloc_skb(DHD_SKB_2PAGE_BUFSIZE);
- if (!wlan_static_skb[index][i])
+ if (!wlan_static_skb[index][i]) {
goto err_mem_alloc;
+ }
size += DHD_SKB_2PAGE_BUFSIZE;
- DHD_STATIC_TRACE("section %d skb[%d], size=%ld\n",
+ DHD_STATIC_TRACE("sectoin %d skb[%d], size=%ld\n",
DHD_PREALLOC_SKB_BUF, i, DHD_SKB_2PAGE_BUFSIZE);
}
#endif /* BCMDHD_SDIO | BCMDHD_PCIE */
@@ -451,7 +453,7 @@
if (!wlan_static_skb[index][i])
goto err_mem_alloc;
size += DHD_SKB_4PAGE_BUFSIZE;
- DHD_STATIC_TRACE("section %d skb[%d], size=%ld\n",
+ DHD_STATIC_TRACE("sectoin %d skb[%d], size=%ld\n",
DHD_PREALLOC_SKB_BUF, i, DHD_SKB_4PAGE_BUFSIZE);
#endif /* BCMDHD_SDIO */
@@ -459,7 +461,7 @@
if (!wlan_static_prot[index])
goto err_mem_alloc;
size += DHD_PREALLOC_PROT_SIZE;
- DHD_STATIC_TRACE("section %d, size=%d\n",
+ DHD_STATIC_TRACE("sectoin %d, size=%d\n",
DHD_PREALLOC_PROT, DHD_PREALLOC_PROT_SIZE);
#if defined(BCMDHD_SDIO)
@@ -467,14 +469,14 @@
if (!wlan_static_rxbuf[index])
goto err_mem_alloc;
size += DHD_PREALLOC_RXBUF_SIZE;
- DHD_STATIC_TRACE("section %d, size=%d\n",
+ DHD_STATIC_TRACE("sectoin %d, size=%d\n",
DHD_PREALLOC_RXBUF, DHD_PREALLOC_RXBUF_SIZE);
wlan_static_databuf[index] = kmalloc(DHD_PREALLOC_DATABUF_SIZE, GFP_KERNEL);
if (!wlan_static_databuf[index])
goto err_mem_alloc;
size += DHD_PREALLOC_DATABUF_SIZE;
- DHD_STATIC_TRACE("section %d, size=%d\n",
+ DHD_STATIC_TRACE("sectoin %d, size=%d\n",
DHD_PREALLOC_DATABUF, DHD_PREALLOC_DATABUF_SIZE);
#endif /* BCMDHD_SDIO */
@@ -482,21 +484,21 @@
if (!wlan_static_osl_buf[index])
goto err_mem_alloc;
size += DHD_PREALLOC_OSL_BUF_SIZE;
- DHD_STATIC_TRACE("section %d, size=%ld\n",
+ DHD_STATIC_TRACE("sectoin %d, size=%ld\n",
DHD_PREALLOC_OSL_BUF, DHD_PREALLOC_OSL_BUF_SIZE);
wlan_static_scan_buf0[index] = kmalloc(DHD_PREALLOC_WIPHY_ESCAN0_SIZE, GFP_KERNEL);
if (!wlan_static_scan_buf0[index])
goto err_mem_alloc;
size += DHD_PREALLOC_WIPHY_ESCAN0_SIZE;
- DHD_STATIC_TRACE("section %d, size=%d\n",
+ DHD_STATIC_TRACE("sectoin %d, size=%d\n",
DHD_PREALLOC_WIPHY_ESCAN0, DHD_PREALLOC_WIPHY_ESCAN0_SIZE);
wlan_static_dhd_info_buf[index] = kmalloc(DHD_PREALLOC_DHD_INFO_SIZE, GFP_KERNEL);
if (!wlan_static_dhd_info_buf[index])
goto err_mem_alloc;
size += DHD_PREALLOC_DHD_INFO_SIZE;
- DHD_STATIC_TRACE("section %d, size=%d\n",
+ DHD_STATIC_TRACE("sectoin %d, size=%d\n",
DHD_PREALLOC_DHD_INFO, DHD_PREALLOC_DHD_INFO_SIZE);
#if defined(BCMDHD_SDIO) || defined(BCMDHD_USB)
@@ -504,7 +506,7 @@
if (!wlan_static_dhd_wlfc_info_buf[index])
goto err_mem_alloc;
size += WLAN_DHD_WLFC_BUF_SIZE;
- DHD_STATIC_TRACE("section %d, size=%d\n",
+ DHD_STATIC_TRACE("sectoin %d, size=%d\n",
DHD_PREALLOC_DHD_WLFC_INFO, WLAN_DHD_WLFC_BUF_SIZE);
#endif /* BCMDHD_SDIO | BCMDHD_USB */
@@ -513,7 +515,7 @@
if (!wlan_static_if_flow_lkup[index])
goto err_mem_alloc;
size += DHD_PREALLOC_IF_FLOW_LKUP_SIZE;
- DHD_STATIC_TRACE("section %d, size=%d\n",
+ DHD_STATIC_TRACE("sectoin %d, size=%d\n",
DHD_PREALLOC_IF_FLOW_LKUP, DHD_PREALLOC_IF_FLOW_LKUP_SIZE);
#endif /* BCMDHD_PCIE */
@@ -522,7 +524,7 @@
if (!wlan_static_dhd_memdump_ram_buf[index])
goto err_mem_alloc;
size += DHD_PREALLOC_MEMDUMP_RAM_SIZE;
- DHD_STATIC_TRACE("section %d, size=%d\n",
+ DHD_STATIC_TRACE("sectoin %d, size=%d\n",
DHD_PREALLOC_MEMDUMP_RAM, DHD_PREALLOC_MEMDUMP_RAM_SIZE);
#endif /* CONFIG_BCMDHD_VTS | CONFIG_BCMDHD_DEBUG */
@@ -531,7 +533,7 @@
if (!wlan_static_dhd_wlfc_hanger_buf[index])
goto err_mem_alloc;
size += DHD_PREALLOC_DHD_WLFC_HANGER_SIZE;
- DHD_STATIC_TRACE("section %d, size=%d\n",
+ DHD_STATIC_TRACE("sectoin %d, size=%d\n",
DHD_PREALLOC_DHD_WLFC_HANGER, DHD_PREALLOC_DHD_WLFC_HANGER_SIZE);
#endif /* BCMDHD_SDIO | BCMDHD_USB */
@@ -540,14 +542,14 @@
if (!wlan_static_dhd_log_dump_buf[index])
goto err_mem_alloc;
size += DHD_PREALLOC_DHD_LOG_DUMP_BUF_SIZE;
- DHD_STATIC_TRACE("section %d, size=%d\n",
+ DHD_STATIC_TRACE("sectoin %d, size=%d\n",
DHD_PREALLOC_DHD_LOG_DUMP_BUF, DHD_PREALLOC_DHD_LOG_DUMP_BUF_SIZE);
wlan_static_dhd_log_dump_buf_ex[index] = kmalloc(DHD_PREALLOC_DHD_LOG_DUMP_BUF_EX_SIZE, GFP_KERNEL);
if (!wlan_static_dhd_log_dump_buf_ex[index])
goto err_mem_alloc;
size += DHD_PREALLOC_DHD_LOG_DUMP_BUF_EX_SIZE;
- DHD_STATIC_TRACE("section %d, size=%d\n",
+ DHD_STATIC_TRACE("sectoin %d, size=%d\n",
DHD_PREALLOC_DHD_LOG_DUMP_BUF_EX, DHD_PREALLOC_DHD_LOG_DUMP_BUF_EX_SIZE);
#endif /* CONFIG_BCMDHD_VTS | CONFIG_BCMDHD_DEBUG */
@@ -555,28 +557,28 @@
if (!wlan_static_wl_escan_info_buf[index])
goto err_mem_alloc;
size += DHD_PREALLOC_WL_ESCAN_SIZE;
- DHD_STATIC_TRACE("section %d, size=%d\n",
+ DHD_STATIC_TRACE("sectoin %d, size=%d\n",
DHD_PREALLOC_WL_ESCAN, DHD_PREALLOC_WL_ESCAN_SIZE);
wlan_static_fw_verbose_ring_buf[index] = kmalloc(FW_VERBOSE_RING_SIZE, GFP_KERNEL);
if (!wlan_static_fw_verbose_ring_buf[index])
goto err_mem_alloc;
size += FW_VERBOSE_RING_SIZE;
- DHD_STATIC_TRACE("section %d, size=%d\n",
+ DHD_STATIC_TRACE("sectoin %d, size=%d\n",
DHD_PREALLOC_FW_VERBOSE_RING, FW_VERBOSE_RING_SIZE);
wlan_static_fw_event_ring_buf[index] = kmalloc(FW_EVENT_RING_SIZE, GFP_KERNEL);
if (!wlan_static_fw_event_ring_buf[index])
goto err_mem_alloc;
size += FW_EVENT_RING_SIZE;
- DHD_STATIC_TRACE("section %d, size=%d\n",
+ DHD_STATIC_TRACE("sectoin %d, size=%d\n",
DHD_PREALLOC_FW_EVENT_RING, FW_EVENT_RING_SIZE);
wlan_static_dhd_event_ring_buf[index] = kmalloc(DHD_EVENT_RING_SIZE, GFP_KERNEL);
if (!wlan_static_dhd_event_ring_buf[index])
goto err_mem_alloc;
size += DHD_EVENT_RING_SIZE;
- DHD_STATIC_TRACE("section %d, size=%d\n",
+ DHD_STATIC_TRACE("sectoin %d, size=%d\n",
DHD_PREALLOC_DHD_EVENT_RING, DHD_EVENT_RING_SIZE);
#if defined(BCMDHD_UNUSE_MEM)
@@ -584,11 +586,11 @@
if (!wlan_static_nan_event_ring_buf[index])
goto err_mem_alloc;
size += NAN_EVENT_RING_SIZE;
- DHD_STATIC_TRACE("section %d, size=%d\n",
+ DHD_STATIC_TRACE("sectoin %d, size=%d\n",
DHD_PREALLOC_NAN_EVENT_RING, NAN_EVENT_RING_SIZE);
#endif /* BCMDHD_UNUSE_MEM */
- DHD_STATIC_MSG("prealloc ok for index %d: %ld(%ldK)\n", index, size, size / 1024);
+ DHD_STATIC_MSG("prealloc ok for index %d: %ld(%ldK)\n", index, size, size/1024);
return 0;
err_mem_alloc:
@@ -638,6 +640,7 @@
}
#ifndef DHD_STATIC_IN_DRIVER
+MODULE_LICENSE("GPL");
module_init(dhd_static_buf_init);
module_exit(dhd_static_buf_exit);
#endif
--
Gitblit v1.6.2