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/wl_escan.c | 108 +++++++++++++++++++++++++++--------------------------
1 files changed, 55 insertions(+), 53 deletions(-)
diff --git a/kernel/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/wl_escan.c b/kernel/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/wl_escan.c
old mode 100644
new mode 100755
index 01a9e02..3311f4c
--- a/kernel/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/wl_escan.c
+++ b/kernel/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/wl_escan.c
@@ -1,5 +1,4 @@
/* SPDX-License-Identifier: GPL-2.0 */
-
#if defined(WL_ESCAN)
#include <bcmendian.h>
#include <linux/if_arp.h>
@@ -42,11 +41,11 @@
#define dtohchanspec(i) (i)
#define WL_EXTRA_BUF_MAX 2048
-#define wl_escan_get_buf(a) ((wl_scan_results_v109_t *) (a)->escan_buf)
+#define wl_escan_get_buf(a) ((wl_scan_results_t *) (a)->escan_buf)
#if defined(WL_WIRELESS_EXT)
extern int wl_iw_handle_scanresults_ies(char **event_p, char *end,
- struct iw_request_info *info, wl_bss_info_v109_t *bi);
+ struct iw_request_info *info, wl_bss_info_t *bi);
#define for_each_bss_wext(list, bss, __i) \
for (__i = 0; __i < list->count && __i < IW_MAX_AP; __i++, bss = next_bss(list, bss))
#endif
@@ -206,7 +205,7 @@
return wl_chspec_host_to_driver(ioctl_ver, chanspec);
}
-static inline struct wl_bss_info *next_bss(wl_scan_results_v109_t *list,
+static inline struct wl_bss_info *next_bss(wl_scan_results_t *list,
struct wl_bss_info *bss)
{
return bss = bss ?
@@ -217,7 +216,7 @@
#ifndef BSSCACHE
static void
wl_escan_dump_bss(struct net_device *dev, struct wl_escan_info *escan,
- wl_bss_info_v109_t *bi)
+ wl_bss_info_t *bi)
{
int16 rssi;
int channel;
@@ -245,9 +244,9 @@
static s32
wl_escan_inform_bss(struct net_device *dev, struct wl_escan_info *escan)
{
- wl_scan_results_v109_t *bss_list;
+ wl_scan_results_t *bss_list;
#ifndef BSSCACHE
- wl_bss_info_v109_t *bi = NULL; /* must be initialized */
+ wl_bss_info_t *bi = NULL; /* must be initialized */
s32 i;
#endif
s32 err = 0;
@@ -284,14 +283,14 @@
wl_reset_bss_cache(&escan->g_bss_cache_ctrl);
if (escan->autochannel)
wl_ext_get_best_channel(dev, &escan->g_bss_cache_ctrl,
- &escan->best_2g_ch, &escan->best_5g_ch, &escan->best_6g_ch);
+ escan->ioctl_ver, &escan->best_2g_ch, &escan->best_5g_ch, &escan->best_6g_ch);
#else
bi = next_bss(bss_list, bi);
for_each_bss(bss_list, bi, i) {
wl_escan_dump_bss(dev, escan, bi);
}
if (escan->autochannel)
- wl_ext_get_best_channel(dev, bss_list,
+ wl_ext_get_best_channel(dev, bss_list, escan->ioctl_ver,
&escan->best_2g_ch, &escan->best_5g_ch, &escan->best_6g_ch);
#endif
@@ -299,19 +298,19 @@
}
#endif /* ESCAN_RESULT_PATCH */
-static wl_scan_params_v1_t *
+static wl_scan_params_t *
wl_escan_alloc_params(struct net_device *dev, struct wl_escan_info *escan,
int channel, int nprobes, int *out_params_size)
{
- wl_scan_params_v1_t *params;
+ wl_scan_params_t *params;
int params_size;
int num_chans;
*out_params_size = 0;
/* Our scan params only need space for 1 channel and 0 ssids */
- params_size = WL_SCAN_PARAMS_V1_FIXED_SIZE + 1 * sizeof(uint16);
- params = (wl_scan_params_v1_t*) kzalloc(params_size, GFP_KERNEL);
+ params_size = WL_SCAN_PARAMS_FIXED_SIZE + 1 * sizeof(uint16);
+ params = (wl_scan_params_t*) kzalloc(params_size, GFP_KERNEL);
if (params == NULL) {
ESCAN_ERROR(dev->name, "mem alloc failed (%d bytes)\n", params_size);
return params;
@@ -344,7 +343,7 @@
static void
wl_escan_abort(struct net_device *dev, struct wl_escan_info *escan)
{
- wl_scan_params_v1_t *params = NULL;
+ wl_scan_params_t *params = NULL;
s32 params_size = 0;
s32 err = BCME_OK;
if (!in_atomic()) {
@@ -417,7 +416,7 @@
#ifdef ESCAN_BUF_OVERFLOW_MGMT
static void
wl_escan_find_removal_candidate(struct wl_escan_info *escan,
- wl_bss_info_v109_t *bss, removal_element_t *candidate)
+ wl_bss_info_t *bss, removal_element_t *candidate)
{
int idx;
for (idx = 0; idx < BUF_OVERFLOW_MGMT_COUNT; idx++) {
@@ -436,17 +435,17 @@
static void
wl_escan_remove_lowRSSI_info(struct net_device *dev, struct wl_escan_info *escan,
- wl_scan_results_v109_t *list, removal_element_t *candidate, wl_bss_info_v109_t *bi)
+ wl_scan_results_t *list, removal_element_t *candidate, wl_bss_info_t *bi)
{
int idx1, idx2;
int total_delete_len = 0;
for (idx1 = 0; idx1 < BUF_OVERFLOW_MGMT_COUNT; idx1++) {
- int cur_len = WL_SCAN_RESULTS_V109_FIXED_SIZE;
- wl_bss_info_v109_t *bss = NULL;
+ int cur_len = WL_SCAN_RESULTS_FIXED_SIZE;
+ wl_bss_info_t *bss = NULL;
if (candidate[idx1].RSSI >= bi->RSSI)
continue;
for (idx2 = 0; idx2 < list->count; idx2++) {
- bss = bss ? (wl_bss_info_v109_t *)((uintptr)bss + dtoh32(bss->length)) :
+ bss = bss ? (wl_bss_info_t *)((uintptr)bss + dtoh32(bss->length)) :
list->bss_info;
if (!bcmp(&candidate[idx1].BSSID, &bss->BSSID, ETHER_ADDR_LEN) &&
candidate[idx1].RSSI == bss->RSSI &&
@@ -479,16 +478,16 @@
{
struct wl_escan_info *escan = (struct wl_escan_info *)argu;
s32 status = ntoh32(e->status);
- wl_bss_info_v109_t *bi;
- wl_escan_result_v109_t *escan_result;
- wl_bss_info_v109_t *bss = NULL;
- wl_scan_results_v109_t *list;
+ wl_bss_info_t *bi;
+ wl_escan_result_t *escan_result;
+ wl_bss_info_t *bss = NULL;
+ wl_scan_results_t *list;
u32 bi_length;
u32 i;
u16 channel;
mutex_lock(&escan->usr_sync);
- escan_result = (wl_escan_result_v109_t *)data;
+ escan_result = (wl_escan_result_t *)data;
if (escan->escan_state != ESCAN_STATE_SCANING) {
ESCAN_DBG(dev->name, "Not my scan\n");
@@ -515,7 +514,7 @@
goto exit;
}
bi_length = dtoh32(bi->length);
- if (bi_length != (dtoh32(escan_result->buflen) - WL_ESCAN_RESULTS_V109_FIXED_SIZE)) {
+ if (bi_length != (dtoh32(escan_result->buflen) - WL_ESCAN_RESULTS_FIXED_SIZE)) {
ESCAN_ERROR(dev->name, "Invalid bss_info length %d: ignoring\n",
bi_length);
goto exit;
@@ -530,7 +529,7 @@
/* ----- terence 20130524: skip invalid bss */
{
- int cur_len = WL_SCAN_RESULTS_V109_FIXED_SIZE;
+ int cur_len = WL_SCAN_RESULTS_FIXED_SIZE;
#ifdef ESCAN_BUF_OVERFLOW_MGMT
removal_element_t candidate[BUF_OVERFLOW_MGMT_COUNT];
int remove_lower_rssi = FALSE;
@@ -547,7 +546,7 @@
ESCAN_DBG(dev->name, "%s(%pM) RSSI %d flags 0x%x length %d\n",
bi->SSID, &bi->BSSID, bi->RSSI, bi->flags, bi->length);
for (i = 0; i < list->count; i++) {
- bss = bss ? (wl_bss_info_v109_t *)((uintptr)bss + dtoh32(bss->length))
+ bss = bss ? (wl_bss_info_t *)((uintptr)bss + dtoh32(bss->length))
: list->bss_info;
#ifdef ESCAN_BUF_OVERFLOW_MGMT
ESCAN_DBG(dev->name,
@@ -691,15 +690,16 @@
wl_uint32_list_t *list, void *scan_params, wl_scan_info_t *scan_info)
{
int err = 0;
- wl_scan_results_v109_t *results;
+ wl_scan_results_t *results;
char *ptr;
int i = 0, j = 0;
wlc_ssid_t ssid_tmp;
u32 n_channels = 0;
chanspec_t chanspec;
u32 n_ssids = 0;
- wl_scan_params_v1_t *params = NULL;
+ wl_scan_params_t *params = NULL;
wl_scan_params_v2_t *params_v2 = NULL;
+ u32 scan_param_size = 0;
u32 channel_offset = 0;
u32 cur_offset;
uint16 *chan_list = NULL;
@@ -707,7 +707,7 @@
results = wl_escan_get_buf(escan);
results->version = 0;
results->count = 0;
- results->buflen = WL_SCAN_RESULTS_V109_FIXED_SIZE;
+ results->buflen = WL_SCAN_RESULTS_FIXED_SIZE;
escan->escan_state = ESCAN_STATE_SCANING;
/* Arm scan timeout timer */
@@ -715,10 +715,12 @@
if (escan->scan_params_v2) {
params_v2 = (wl_scan_params_v2_t *)scan_params;
+ scan_param_size = sizeof(wl_scan_params_v2_t);
channel_offset = offsetof(wl_scan_params_v2_t, channel_list);
} else {
- params = (wl_scan_params_v1_t *)scan_params;
- channel_offset = offsetof(wl_scan_params_v1_t, channel_list);
+ params = (wl_scan_params_t *)scan_params;
+ scan_param_size = sizeof(wl_scan_params_t);
+ channel_offset = offsetof(wl_scan_params_t, channel_list);
}
if (params_v2) {
@@ -841,7 +843,7 @@
{
wl_event_msg_t msg;
struct wl_escan_info *escan = (struct wl_escan_info *)data;
- wl_scan_results_v109_t *bss_list;
+ wl_scan_results_t *bss_list;
struct wl_bss_info *bi = NULL;
s32 i;
u32 channel;
@@ -881,10 +883,11 @@
struct dhd_pub *dhdp = dhd_get_pub(dev);
struct wl_escan_info *escan = dhdp->escan;
s32 err = BCME_OK;
- wl_escan_params_v1_t *eparams = NULL;
+ wl_escan_params_t *eparams = NULL;
wl_escan_params_v2_t *eparams_v2 = NULL;
- u8 *scan_params = NULL, *params = NULL;
+ u8 *scan_params = NULL;
s32 params_size;
+ wl_escan_params_t *params = NULL;
u32 n_channels = 0;
wl_uint32_list_t *list;
u8 valid_chan_list[sizeof(u32)*(MAX_CTRL_CHANSPECS + 1)];
@@ -915,8 +918,8 @@
params_size = (WL_SCAN_PARAMS_V2_FIXED_SIZE +
OFFSETOF(wl_escan_params_v2_t, params));
} else {
- params_size = (WL_SCAN_PARAMS_V1_FIXED_SIZE +
- OFFSETOF(wl_escan_params_v1_t, params));
+ params_size = (WL_SCAN_PARAMS_FIXED_SIZE +
+ OFFSETOF(wl_escan_params_t, params));
}
/* if scan request is not empty parse scan request paramters */
@@ -934,7 +937,7 @@
}
n_channels = list->count;
- /* Allocate space for populating ssids in wl_escan_params_v1_t struct */
+ /* Allocate space for populating ssids in wl_escan_params_t struct */
if (list->count % 2)
/* If n_channels is odd, add a padd of u16 */
params_size += sizeof(u16) * (n_channels + 1);
@@ -944,7 +947,7 @@
params_size += sizeof(struct wlc_ssid) * 2;
}
- params = kzalloc(params_size, GFP_KERNEL);
+ params = (wl_escan_params_t *) kzalloc(params_size, GFP_KERNEL);
if (params == NULL) {
ESCAN_ERROR(dev->name, "kzalloc failed\n");
err = -ENOMEM;
@@ -956,14 +959,13 @@
scan_params = (u8 *)&eparams_v2->params;
eparams_v2->version = htod32(ESCAN_REQ_VERSION_V2);
eparams_v2->action = htod16(WL_SCAN_ACTION_START);
- wl_escan_set_sync_id(eparams_v2->sync_id);
} else {
- eparams = (wl_escan_params_v1_t *)params;
+ eparams = (wl_escan_params_t *)params;
scan_params = (u8 *)&eparams->params;
- eparams->version = htod32(ESCAN_REQ_VERSION_V1);
+ eparams->version = htod32(ESCAN_REQ_VERSION);
eparams->action = htod16(WL_SCAN_ACTION_START);
- wl_escan_set_sync_id(eparams->sync_id);
}
+ wl_escan_set_sync_id(params->sync_id);
wl_escan_prep(dev, escan, list, scan_params, scan_info);
@@ -1012,7 +1014,7 @@
static int
wl_escan_merge_scan_results(struct net_device *dev, struct wl_escan_info *escan,
- struct iw_request_info *info, char *extra, wl_bss_info_v109_t *bi, int *len, int max_size)
+ struct iw_request_info *info, char *extra, wl_bss_info_t *bi, int *len, int max_size)
{
s32 err = BCME_OK;
struct iw_event iwe;
@@ -1135,8 +1137,8 @@
s32 err = BCME_OK;
int i = 0, cnt = 0;
int len_prep = 0;
- wl_bss_info_v109_t *bi = NULL;
- wl_scan_results_v109_t *bss_list;
+ wl_bss_info_t *bi = NULL;
+ wl_scan_results_t *bss_list;
__u16 buflen_from_user = dwrq->length;
bss_list = escan->bss_list;
@@ -1172,8 +1174,8 @@
s32 err = BCME_OK;
int i = 0, cnt = 0;
int len_prep = 0;
- wl_bss_info_v109_t *bi = NULL;
- wl_scan_results_v109_t *bss_list;
+ wl_bss_info_t *bi = NULL;
+ wl_scan_results_t *bss_list;
__u16 buflen_from_user = dwrq->length;
wl_bss_cache_t *node;
@@ -1217,7 +1219,7 @@
int cache_cnt = 0;
#endif
int len_prep = 0, len_ret = 0;
- wl_bss_info_v109_t *bi = NULL;
+ wl_bss_info_t *bi = NULL;
__u16 buflen_from_user = dwrq->length;
char *buf = NULL;
struct ether_addr cur_bssid;
@@ -1374,8 +1376,8 @@
struct ether_addr *peer_bssid, struct wl_mesh_params *mesh_info)
{
int i = 0;
- wl_bss_info_v109_t *bi = NULL;
- wl_scan_results_v109_t *bss_list;
+ wl_bss_info_t *bi = NULL;
+ wl_scan_results_t *bss_list;
int16 bi_rssi, bi_chan;
wlc_ssid_t bi_meshid;
bool is_mesh_peer = FALSE, found = FALSE;
@@ -1446,8 +1448,8 @@
struct wl_mesh_params *mesh_info)
{
int i = 0;
- wl_bss_info_v109_t *bi = NULL;
- wl_scan_results_v109_t *bss_list;
+ wl_bss_info_t *bi = NULL;
+ wl_scan_results_t *bss_list;
int16 bi_rssi, bi_chan, max_rssi = -100;
uint min_hop_cnt = 255;
wlc_ssid_t bi_meshid;
--
Gitblit v1.6.2