net: wireless: update bcmdhd driver to 101.10.361.20

Signed-off-by: Alex Zhao <zzc@rock-chips.com>
Change-Id: I7beac9c4e228865b7a07a0d2f88e2968ac7e5e8e
This commit is contained in:
Alex Zhao
2022-07-04 17:44:58 +08:00
committed by Tao Huang
parent 271bc93c62
commit 6513b9fbdd
66 changed files with 4847 additions and 1601 deletions

View File

@@ -2,7 +2,7 @@
# bcmdhd
MODULE_NAME := bcmdhd
#CONFIG_BCMDHD := m
CONFIG_BCMDHD ?= m
#CONFIG_BCMDHD_SDIO := y
#CONFIG_BCMDHD_PCIE := y
@@ -15,11 +15,15 @@ CONFIG_BCMDHD_PROPTXSTATUS := y
CONFIG_BCMDHD_AG := y
CONFIG_DHD_USE_STATIC_BUF := y
#CONFIG_BCMDHD_STATIC_BUF_IN_DHD := y
CONFIG_BCMDHD_VTS := y
CONFIG_BCMDHD_ANDROID_VERSION := 12
CONFIG_BCMDHD_AUTO_SELECT := y
CONFIG_BCMDHD_DEBUG := y
#CONFIG_BCMDHD_TIMESTAMP := y
#CONFIG_BCMDHD_WAPI := y
#CONFIG_BCMDHD_RANDOM_MAC := y
#CONFIG_BCMDHD_REQUEST_FW := y
#CONFIG_BCMDHD_MULTIPLE_DRIVER := y
#CONFIG_BCMDHD_DWDS := y
CONFIG_BCMDHD_TPUT := y
CONFIG_MACH_PLATFORM := y
@@ -71,12 +75,13 @@ ifneq ($(CONFIG_CFG80211),)
DHDCFLAGS += -DDHD_USE_SCAN_WAKELOCK
DHDCFLAGS += -DSPECIFIC_MAC_GEN_SCHEME
DHDCFLAGS += -DWL_IFACE_MGMT
DHDCFLAGS += -DWLFBT
DHDCFLAGS += -DWLFBT -DWL_GCMP_SUPPORT
DHDCFLAGS += -DWL_EXT_RECONNECT
DHDCFLAGS += -DDHD_LOSSLESS_ROAMING
DHDCFLAGS += -DGTK_OFFLOAD_SUPPORT
DHDCFLAGS += -DRESTART_AP_WAR
# DHDCFLAGS += -DWL_STATIC_IF
# DHDCFLAGS += -DWL_CLIENT_SAE
DHDCFLAGS += -DWL_CLIENT_SAE -DWL_OWE
endif
#BCMDHD_SDIO
@@ -110,6 +115,7 @@ DHDCFLAGS += -DDHD_LB -DDHD_LB_RXP -DDHD_LB_STATS -DDHD_LB_TXP
DHDCFLAGS += -DDHD_PKTID_AUDIT_ENABLED
DHDCFLAGS += -DINSMOD_FW_LOAD
DHDCFLAGS += -DCHIP_INTR_CONTROL
#DHDCFLAGS += -DDHD_PCIE_RUNTIMEPM -DMAX_IDLE_COUNT=11 -DCUSTOM_DHD_RUNTIME_MS=100
DHDCFLAGS += -DDHD_CONTROL_PCIE_ASPM_WIFI_TURNON
ifeq ($(CONFIG_BCMDHD_OOB),y)
DHDCFLAGS += -DCUSTOMER_OOB -DBCMPCIE_OOB_HOST_WAKE -DHW_OOB
@@ -148,6 +154,11 @@ else
DHDCFLAGS += -DBUS_TYPE=\"\"
endif
ifeq ($(CONFIG_BCMDHD_TIMESTAMP),y)
DHDCFLAGS += -DKERNEL_TIMESTAMP
DHDCFLAGS += -DSYSTEM_TIMESTAMP
endif
#PROPTXSTATUS
ifeq ($(CONFIG_BCMDHD_PROPTXSTATUS),y)
ifneq ($(CONFIG_BCMDHD_USB),)
@@ -167,19 +178,23 @@ ifeq ($(CONFIG_64BIT),y)
endif
# For Android VTS
ifeq ($(CONFIG_BCMDHD_VTS),y)
ifneq ($(CONFIG_BCMDHD_ANDROID_VERSION),)
DHDCFLAGS += -DANDROID_VERSION=$(CONFIG_BCMDHD_ANDROID_VERSION)
DHDCFLAGS += -DDHD_NOTIFY_MAC_CHANGED
ifneq ($(CONFIG_CFG80211),)
DHDCFLAGS += -DGSCAN_SUPPORT -DRTT_SUPPORT
DHDCFLAGS += -DWL_SAR_TX_POWER
# DHDCFLAGS += -DLINKSTAT_SUPPORT
DHDCFLAGS += -DCUSTOM_COUNTRY_CODE -DDHD_GET_VALID_CHANNELS
DHDCFLAGS += -DDEBUGABILITY -DDBG_PKT_MON
# DHDCFLAGS += -DDHD_LOG_DUMP
DHDCFLAGS += -DDHD_FW_COREDUMP
DHDCFLAGS += -DAPF -DNDO_CONFIG_SUPPORT -DRSSI_MONITOR_SUPPORT
DHDCFLAGS += -DDHD_WAKE_STATUS
DHDCFLAGS += -DDHD_WAKE_STATUS -DWL_LATENCY_MODE
DHDOFILES += dhd_rtt.o bcm_app_utils.o
endif
else
DHDCFLAGS += -DANDROID_VERSION=0
endif
# For Debug
@@ -220,13 +235,26 @@ endif
DHDCFLAGS :=$(filter-out -DWL_STATIC_IF,$(DHDCFLAGS))
endif
# EasyMesh
ifeq ($(CONFIG_BCMDHD_EASYMESH),y)
DHDCFLAGS :=$(filter-out -DDHD_FW_COREDUMP,$(DHDCFLAGS))
DHDCFLAGS :=$(filter-out -DDHD_LOG_DUMP,$(DHDCFLAGS))
DHDCFLAGS += -DWLEASYMESH -DWL_STATIC_IF -DWLDWDS -DFOURADDR_AUTO_BRG
DHDCFLAGS += -DWLEASYMESH
CONFIG_BCMDHD_DWDS := y
endif
#CSI_SUPPORT
# DWDS
ifeq ($(CONFIG_BCMDHD_DWDS),y)
ifneq ($(CONFIG_CFG80211),)
DHDCFLAGS += -DWLDWDS -DFOURADDR_AUTO_BRG
ifneq ($(CONFIG_BCMDHD_SDIO),)
DHDCFLAGS += -DRXF_DEQUEUE_ON_BUSY
endif
DHDCFLAGS += -DWL_STATIC_IF
endif
endif
# CSI_SUPPORT
ifeq ($(CONFIG_CSI_SUPPORT),y)
DHDCFLAGS += -DCSI_SUPPORT
DHDOFILES += dhd_csi.o
@@ -256,6 +284,9 @@ endif
# For WAPI
ifeq ($(CONFIG_BCMDHD_WAPI),y)
DHDCFLAGS += -DBCMWAPI_WPI -DBCMWAPI_WAI
ifeq ($(CONFIG_BCMDHD_ANDROID_VERSION),11)
DHDCFLAGS += -DCFG80211_WAPI_BKPORT
endif
endif
# For scan random mac
@@ -279,7 +310,7 @@ ifneq ($(CONFIG_BCMDHD_SDIO),)
endif
endif
ifeq ($(CONFIG_BCMDHD),m)
ifeq ($(CONFIG_AP6XXX),m)
DHDCFLAGS += -DBCMDHD_MODULAR
endif
@@ -292,6 +323,19 @@ endif
DHDCFLAGS += -DCUSTOMER_HW_ROCKCHIP
endif
ifeq ($(CONFIG_BCMDHD_REQUEST_FW),y)
DHDCFLAGS += -DDHD_LINUX_STD_FW_API
DHDCFLAGS += -DDHD_FW_NAME="\"fw_bcmdhd.bin\""
DHDCFLAGS += -DDHD_NVRAM_NAME="\"nvram.txt\""
DHDCFLAGS += -DDHD_CLM_NAME="\"clm_bcmdhd.blob\""
else
ifeq ($(CONFIG_BCMDHD_FW_PATH),)
DHDCFLAGS += -DCONFIG_BCMDHD_FW_PATH="\"/system/etc/firmware/fw_bcmdhd.bin\""
DHDCFLAGS += -DCONFIG_BCMDHD_NVRAM_PATH="\"/system/etc/firmware/nvram.txt\""
DHDCFLAGS += -DCONFIG_BCMDHD_CLM_PATH="\"/system/etc/firmware/clm_bcmdhd.blob\""
endif
endif
ifeq ($(CONFIG_BCMDHD_AG),y)
DHDCFLAGS += -DBAND_AG
endif
@@ -317,7 +361,7 @@ BCMDHD_ROOT = $(src)
EXTRA_CFLAGS = $(DHDCFLAGS)
EXTRA_CFLAGS += -DDHD_COMPILED=\"$(BCMDHD_ROOT)\"
EXTRA_CFLAGS += -I$(BCMDHD_ROOT)/include/ -I$(BCMDHD_ROOT)/
ifeq ($(CONFIG_BCMDHD),m)
ifeq ($(CONFIG_AP6XXX),m)
EXTRA_LDFLAGS += --strip-debug
endif

View File

@@ -24,7 +24,9 @@
#include <typedefs.h>
#include <bcmdefs.h>
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0))
#include <stdarg.h>
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0) */
#ifdef BCMDRIVER
#include <osl.h>

View File

@@ -937,7 +937,7 @@ bcmsdh_gpioout(void *sdh, uint32 gpio, bool enab)
}
uint
bcmsdh_set_mode(void *sdh, uint mode)
bcmsdh_set_mode(void *sdh, uint mode)
{
bcmsdh_info_t *bcmsdh = (bcmsdh_info_t *)sdh;
return (sdioh_set_mode(bcmsdh->sdioh, mode));

View File

@@ -346,6 +346,12 @@ bcmsdh_unregister(void)
bcmsdh_unregister_client_driver();
}
void *bcmsdh_get_dev(bcmsdh_info_t *sdh)
{
bcmsdh_os_info_t *bcmsdh_osinfo = sdh->os_cxt;
return bcmsdh_osinfo->dev;
}
void bcmsdh_dev_pm_stay_awake(bcmsdh_info_t *bcmsdh)
{
#if !defined(CONFIG_HAS_WAKELOCK) && (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 36))

View File

@@ -1094,8 +1094,7 @@ sdioh_request_byte(sdioh_info_t *sd, uint rw, uint func, uint regaddr, uint8 *by
}
if (err_ret) {
if ((regaddr == 0x1001F) && ((err_ret == -ETIMEDOUT) || (err_ret == -EILSEQ)
|| (err_ret == -EIO))) {
if (regaddr == 0x1001F) {
/* XXX: Read/Write to SBSDIO_FUNC1_SLEEPCSR could return -110(timeout)
* or -84(CRC) error in case the host tries to wake the device up.
* Skip error log message if err code is -110 or -84 when accessing

View File

@@ -23,7 +23,9 @@
#include <typedefs.h>
#include <bcmdefs.h>
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0))
#include <stdarg.h>
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0) */
#ifdef BCMDRIVER
#include <osl.h>
#include <bcmutils.h>

View File

@@ -24,7 +24,9 @@
#include <typedefs.h>
#include <bcmdefs.h>
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0))
#include <stdarg.h>
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0) */
#ifdef BCMDRIVER
#include <osl.h>

View File

@@ -32,6 +32,7 @@
*/
#include <linux/usb.h>
#include "osl.h"
#include "dbus.h"
#include <bcmutils.h>
@@ -51,7 +52,7 @@
#include <sbpcmcia.h>
#include <bcmnvram.h>
#include <bcmdevs.h>
#endif
#endif
@@ -59,7 +60,7 @@
#ifndef VARS_MAX
#define VARS_MAX 8192
#endif
#endif
#endif
#ifdef DBUS_USB_LOOPBACK
extern bool is_loopback_pkt(void *buf);
@@ -943,7 +944,7 @@ dbus_do_download(dhd_bus_t *dhd_bus)
DBUS_FIRMWARE, 0, 0);
if (!dhd_bus->firmware)
return DBUS_ERR;
#endif
#endif
dhd_bus->image = dhd_bus->fw;
dhd_bus->image_len = (uint32)dhd_bus->fwlen;
@@ -1519,7 +1520,7 @@ dbus_attach(osl_t *osh, int rxsize, int nrxq, int ntxq, dhd_pub_t *pub,
dhd_bus->extdl.varslen = extdl->varslen;
}
}
#endif
#endif
return (dhd_bus_t *)dhd_bus;
@@ -1625,7 +1626,7 @@ int dbus_download_firmware(dhd_bus_t *pub, char *pfw_path, char *pnv_path)
return err;
}
#endif
#endif
/**
* higher layer requests us to 'up' the interface to the dongle. Prerequisite is that firmware (not
@@ -2325,7 +2326,7 @@ uint16 boardtype, uint16 boardrev, int8 **nvram, int *nvram_len)
return DBUS_JUMBO_NOMATCH;
} /* dbus_select_nvram */
#endif
#endif
#define DBUS_NRXQ 50
#define DBUS_NTXQ 100
@@ -2573,6 +2574,19 @@ dhd_bus_chiprev(struct dhd_bus *bus)
return bus->pub.attrib.chiprev;
}
struct device *
dhd_bus_to_dev(struct dhd_bus *bus)
{
struct usb_device *pdev;
pdev = (struct usb_device *)bus->pub.dev_info;
if (pdev)
return &pdev->dev;
else
return NULL;
}
void
dhd_bus_dump(dhd_pub_t *dhdp, struct bcmstrbuf *strbuf)
{
@@ -2682,7 +2696,7 @@ dhd_bus_devreset(dhd_pub_t *dhdp, uint8 flag)
#if !defined(IGNORE_ETH0_DOWN)
/* Restore flow control */
dhd_txflowcontrol(dhdp, ALL_INTERFACES, OFF);
#endif
#endif
dhd_os_wd_timer(dhdp, dhd_watchdog_ms);
DBUSTRACE(("%s: WLAN ON DONE\n", __FUNCTION__));

View File

@@ -2160,7 +2160,7 @@ dbus_usbos_intf_up(void *bus)
return DBUS_ERR;
}
}
#endif
#endif
if (usbos_info->ctl_urb) {
usbos_info->ctl_in_pipe = usb_rcvctrlpipe(usbos_info->usb, 0);

View File

@@ -34,6 +34,7 @@
#define _dhd_h_
#if defined(LINUX)
#include <linux/firmware.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/slab.h>
@@ -2724,6 +2725,8 @@ void dhd_schedule_memdump(dhd_pub_t *dhdp, uint8 *buf, uint32 size);
#endif /* DHD_FW_COREDUMP */
#if defined(linux) || defined(LINUX)
int dhd_os_get_img_fwreq(const struct firmware **fw, char *file_path);
void dhd_os_close_img_fwreq(const struct firmware *fw);
#if defined(DHD_SSSR_DUMP)
void dhd_write_sssr_dump(dhd_pub_t *dhdp, uint32 dump_mode);
#endif /* DHD_SSSR_DUMP */

View File

@@ -90,6 +90,7 @@ extern int dhd_bus_oob_intr_register(dhd_pub_t *dhdp);
extern void dhd_bus_oob_intr_unregister(dhd_pub_t *dhdp);
extern void dhd_bus_oob_intr_set(dhd_pub_t *dhdp, bool enable);
extern int dhd_bus_get_oob_irq_num(dhd_pub_t *dhdp);
extern struct device * dhd_bus_to_dev(struct dhd_bus *bus);
extern void dhd_bus_dev_pm_stay_awake(dhd_pub_t *dhdpub);
extern void dhd_bus_dev_pm_relax(dhd_pub_t *dhdpub);
extern bool dhd_bus_dev_pm_enabled(dhd_pub_t *dhdpub);

View File

@@ -1669,7 +1669,7 @@ dhd_dump(dhd_pub_t *dhdp, char *buf, int buflen)
}
#endif /* DHD_WET */
DHD_ERROR(("%s bufsize: %d free: %d", __FUNCTION__, buflen, strbuf->size));
DHD_ERROR(("%s bufsize: %d free: %d\n", __FUNCTION__, buflen, strbuf->size));
/* return remaining buffer length */
return (!strbuf->size ? BCME_BUFTOOSHORT : strbuf->size);
}
@@ -7804,6 +7804,82 @@ static int traffic_mgmt_add_dwm_filter(dhd_pub_t *dhd,
}
#endif /* BCM_ROUTER_DHD */
#ifdef DHD_LINUX_STD_FW_API
int dhd_get_download_buffer(dhd_pub_t *dhd, char *file_path, download_type_t component,
char ** buffer, int *length)
{
int ret = BCME_ERROR;
const struct firmware *fw = NULL;
#ifdef SUPPORT_OTA_UPDATE
uint8 *buf = NULL;
int len = 0;
ota_update_info_t *ota_info = &dhd->ota_update_info;
#endif /* SUPPORT_OTA_UPDATE */
#ifdef SUPPORT_OTA_UPDATE
if (component == CLM_BLOB) {
if (ota_info->clm_len) {
DHD_ERROR(("Using OTA CLM_BLOB\n"));
buf = ota_info->clm_buf;
len = ota_info->clm_len;
}
}
else if (component == NVRAM) {
if (ota_info->nvram_len) {
DHD_ERROR(("Using OTA NVRAM.\n"));
buf = ota_info->nvram_buf;
len = ota_info->nvram_len;
}
}
#endif /* SUPPORT_OTA_UPDATE */
#ifdef SUPPORT_OTA_UPDATE
if (len) {
*buffer = (char *)buf;
*length = len;
}
else
#endif /* SUPPORT_OTA_UPDATE */
{
if (file_path) {
ret = dhd_os_get_img_fwreq(&fw, file_path);
if (ret < 0) {
DHD_ERROR(("dhd_os_get_img(Request Firmware API) error : %d\n",
ret));
goto err;
} else {
if ((fw->size <= 0 || fw->size > *length)) {
DHD_ERROR(("fw->size = %d, *length = %d\n", fw->size, *length));
*length = fw->size;
goto err;
}
*buffer = VMALLOCZ(dhd->osh, fw->size);
if (*buffer == NULL) {
DHD_ERROR(("%s: Failed to allocate memory %d bytes\n",
__FUNCTION__, (int)fw->size));
ret = BCME_NOMEM;
goto err;
}
*length = fw->size;
ret = memcpy_s(*buffer, fw->size, fw->data, fw->size);
if (ret != BCME_OK) {
DHD_ERROR(("%s: memcpy_s failed, err : %d\n",
__FUNCTION__, ret));
goto err;
}
ret = BCME_OK;
}
}
}
err:
if (fw) {
dhd_os_close_img_fwreq(fw);
}
return ret;
}
#else
/* Given filename and download type, returns a buffer pointer and length
* for download to f/w. Type can be FW or NVRAM.
*
@@ -7923,6 +7999,7 @@ err:
return ret;
}
#endif /* DHD_LINUX_STD_FW_API */
int
dhd_download_2_dongle(dhd_pub_t *dhd, char *iovar, uint16 flag, uint16 dload_type,
@@ -7963,9 +8040,9 @@ dhd_download_blob(dhd_pub_t *dhd, unsigned char *buf,
{
int chunk_len;
#if !defined(LINUX) && !defined(linux)
#if (!defined(LINUX) && !defined(linux)) || defined(DHD_LINUX_STD_FW_API)
int cumulative_len = 0;
#endif /* !LINUX && !linux */
#endif /* !LINUX && !linux || DHD_LINUX_STD_FW_API */
int size2alloc;
unsigned char *new_buf;
int err = 0, data_offset;
@@ -7977,7 +8054,7 @@ dhd_download_blob(dhd_pub_t *dhd, unsigned char *buf,
if ((new_buf = (unsigned char *)MALLOCZ(dhd->osh, size2alloc)) != NULL) {
do {
#if !defined(LINUX) && !defined(linux)
#if (!defined(LINUX) && !defined(linux)) || defined(DHD_LINUX_STD_FW_API)
if (len >= MAX_CHUNK_LEN)
chunk_len = MAX_CHUNK_LEN;
else
@@ -7994,7 +8071,7 @@ dhd_download_blob(dhd_pub_t *dhd, unsigned char *buf,
err = BCME_ERROR;
goto exit;
}
#endif /* !LINUX && !linux */
#endif /* !LINUX && !linux || DHD_LINUX_STD_FW_API */
if (len - chunk_len == 0)
dl_flag |= DL_END;
@@ -8005,13 +8082,13 @@ dhd_download_blob(dhd_pub_t *dhd, unsigned char *buf,
len = len - chunk_len;
} while ((len > 0) && (err == 0));
#if !defined(LINUX) && !defined(linux)
#if (!defined(LINUX) && !defined(linux)) || defined(DHD_LINUX_STD_FW_API)
MFREE(dhd->osh, new_buf, size2alloc);
#endif /* !LINUX && !linux */
} else {
err = BCME_NOMEM;
}
#if defined(LINUX) || defined(linux)
#if (defined(LINUX) || defined(linux)) && !defined(DHD_LINUX_STD_FW_API)
exit:
if (new_buf) {
MFREE(dhd->osh, new_buf, size2alloc);
@@ -8258,7 +8335,7 @@ int
dhd_apply_default_clm(dhd_pub_t *dhd, char *clm_path)
{
char *clm_blob_path;
int len;
int len = 0, memblock_len = 0;
char *memblock = NULL;
int err = BCME_OK;
char iovbuf[WLC_IOCTL_SMLEN];
@@ -8272,7 +8349,11 @@ dhd_apply_default_clm(dhd_pub_t *dhd, char *clm_path)
clm_blob_path = clm_path;
DHD_TRACE(("clm path from module param:%s\n", clm_path));
} else {
#ifdef DHD_LINUX_STD_FW_API
clm_blob_path = DHD_CLM_NAME;
#else
clm_blob_path = VENDOR_PATH CONFIG_BCMDHD_CLM_PATH;
#endif /* DHD_LINUX_STD_FW_API */
}
/* If CLM blob file is found on the filesystem, download the file.
@@ -8280,11 +8361,21 @@ dhd_apply_default_clm(dhd_pub_t *dhd, char *clm_path)
* validate the country code before proceeding with the initialization.
* If country code is not valid, fail the initialization.
*/
#if !defined(LINUX) && !defined(linux)
#if (!defined(LINUX) && !defined(linux)) || defined(DHD_LINUX_STD_FW_API)
len = MAX_CLM_BUF_SIZE;
dhd_get_download_buffer(dhd, clm_blob_path, CLM_BLOB, &memblock, &len);
#ifdef DHD_LINUX_STD_FW_API
memblock_len = len;
#else
memblock_len = MAX_CLM_BUF_SIZE;
#endif /* DHD_LINUX_STD_FW_API */
#else
memblock = dhd_os_open_image1(dhd, (char *)clm_blob_path);
len = dhd_os_get_image_size(memblock);
BCM_REFERENCE(memblock_len);
#endif /* !LINUX && !linux || DHD_LINUX_STD_FW_API */
#if defined(LINUX) || defined(linux)
if (memblock == NULL) {
printf("%s: Ignore clm file %s\n", __FUNCTION__, clm_path);
#if defined(DHD_BLOB_EXISTENCE_CHECK)
@@ -8301,8 +8392,6 @@ dhd_apply_default_clm(dhd_pub_t *dhd, char *clm_path)
#endif /* DHD_BLOB_EXISTENCE_CHECK */
goto exit;
}
len = dhd_os_get_image_size(memblock);
#endif /* !LINUX && !linux */
if ((len > 0) && (len < MAX_CLM_BUF_SIZE) && memblock) {
@@ -8368,10 +8457,10 @@ dhd_apply_default_clm(dhd_pub_t *dhd, char *clm_path)
exit:
if (memblock) {
#if defined(LINUX) || defined(linux)
#if (defined(LINUX) || defined(linux)) && !defined(DHD_LINUX_STD_FW_API)
dhd_os_close_image1(dhd, memblock);
#else
dhd_free_download_buffer(dhd, memblock, MAX_CLM_BUF_SIZE);
dhd_free_download_buffer(dhd, memblock, memblock_len);
#endif /* LINUX || linux */
}
@@ -8384,7 +8473,11 @@ void dhd_free_download_buffer(dhd_pub_t *dhd, void *buffer, int length)
#ifdef CACHE_FW_IMAGES
return;
#endif
#if defined(DHD_LINUX_STD_FW_API)
VMFREE(dhd->osh, buffer, length);
#else
MFREE(dhd->osh, buffer, length);
#endif /* DHD_LINUX_STD_FW_API */
}
#ifdef REPORT_FATAL_TIMEOUTS
@@ -9063,8 +9156,13 @@ dhd_parse_logstrs_file(osl_t *osh, char *raw_fmts, int logstrs_size,
int32 i = 0;
uint8 *pfw_id = NULL;
uint32 fwid = 0;
#ifdef DHD_LINUX_STD_FW_API
int err = 0;
const struct firmware *fw = NULL;
#else
void *file = NULL;
int file_len = 0;
#endif /* DHD_LINUX_STD_FW_API */
char fwid_str[FWID_STR_LEN];
uint32 hdr_logstrs_size = 0;
@@ -9097,6 +9195,23 @@ dhd_parse_logstrs_file(osl_t *osh, char *raw_fmts, int logstrs_size,
* both logstrs.bin and fw bin
*/
#ifdef DHD_LINUX_STD_FW_API
err = dhd_os_get_img_fwreq(&fw, st_str_file_path);
if (err < 0) {
DHD_ERROR(("dhd_os_get_img(Request Firmware API) error : %d\n",
err));
goto error;
}
memset(fwid_str, 0, sizeof(fwid_str));
err = memcpy_s(fwid_str, (sizeof(fwid_str) - 1),
&(fw->data[fw->size - (sizeof(fwid_str) - 1)]),
(sizeof(fwid_str) - 1));
if (err) {
DHD_ERROR(("%s: failed to copy raw_fmts, err=%d\n",
__FUNCTION__, err));
goto error;
}
#else
/* read the FWID from fw bin */
file = dhd_os_open_image1(NULL, st_str_file_path);
if (!file) {
@@ -9119,6 +9234,7 @@ dhd_parse_logstrs_file(osl_t *osh, char *raw_fmts, int logstrs_size,
DHD_ERROR(("%s: read fw file failed !\n", __FUNCTION__));
goto error;
}
#endif /* DHD_LINUX_STD_FW_API */
pfw_id = (uint8 *)bcmstrnstr(fwid_str, sizeof(fwid_str) - 1,
FWID_STR_1, strlen(FWID_STR_1));
if (!pfw_id) {
@@ -9156,9 +9272,15 @@ dhd_parse_logstrs_file(osl_t *osh, char *raw_fmts, int logstrs_size,
hdr_logstrs_size = hdr->logstrs_size;
error:
#ifdef DHD_LINUX_STD_FW_API
if (fw) {
dhd_os_close_img_fwreq(fw);
}
#else
if (file) {
dhd_os_close_image1(NULL, file);
}
#endif /* DHD_LINUX_STD_FW_API */
if (match_fail) {
return BCME_DECERR;
}
@@ -9223,6 +9345,101 @@ error:
return BCME_OK;
} /* dhd_parse_logstrs_file */
#ifdef DHD_LINUX_STD_FW_API
int dhd_parse_map_file(osl_t *osh, void *ptr, uint32 *ramstart, uint32 *rodata_start,
uint32 *rodata_end)
{
char *raw_fmts = NULL, *raw_fmts_loc = NULL;
uint32 read_size = READ_NUM_BYTES, offset = 0;
int error = 0;
char * cptr = NULL;
char c;
uint8 count = 0;
uint32 size = 0;
*ramstart = 0;
*rodata_start = 0;
*rodata_end = 0;
size = (uint32)(((struct firmware *)ptr)->size);
/* Allocate 1 byte more than read_size to terminate it with NULL */
raw_fmts = MALLOCZ(osh, read_size + 1);
if (raw_fmts == NULL) {
DHD_ERROR(("%s: Failed to allocate raw_fmts memory \n", __FUNCTION__));
goto fail;
}
/* read ram start, rodata_start and rodata_end values from map file */
while (count != ALL_MAP_VAL)
{
/* Bound check for size before doing memcpy() */
if ((offset + read_size) > size) {
read_size = size - offset;
}
error = memcpy_s(raw_fmts, read_size,
(((char *)((struct firmware *)ptr)->data) + offset), read_size);
if (error) {
DHD_ERROR(("%s: failed to copy raw_fmts, err=%d\n",
__FUNCTION__, error));
goto fail;
}
/* End raw_fmts with NULL as strstr expects NULL terminated strings */
raw_fmts[read_size] = '\0';
/* Get ramstart address */
raw_fmts_loc = raw_fmts;
if (!(count & RAMSTART_BIT) &&
(cptr = bcmstrnstr(raw_fmts_loc, read_size, ramstart_str,
strlen(ramstart_str)))) {
cptr = cptr - BYTES_AHEAD_NUM;
sscanf(cptr, "%x %c text_start", ramstart, &c);
count |= RAMSTART_BIT;
}
/* Get ram rodata start address */
raw_fmts_loc = raw_fmts;
if (!(count & RDSTART_BIT) &&
(cptr = bcmstrnstr(raw_fmts_loc, read_size, rodata_start_str,
strlen(rodata_start_str)))) {
cptr = cptr - BYTES_AHEAD_NUM;
sscanf(cptr, "%x %c rodata_start", rodata_start, &c);
count |= RDSTART_BIT;
}
/* Get ram rodata end address */
raw_fmts_loc = raw_fmts;
if (!(count & RDEND_BIT) &&
(cptr = bcmstrnstr(raw_fmts_loc, read_size, rodata_end_str,
strlen(rodata_end_str)))) {
cptr = cptr - BYTES_AHEAD_NUM;
sscanf(cptr, "%x %c rodata_end", rodata_end, &c);
count |= RDEND_BIT;
}
if ((offset + read_size) >= size) {
break;
}
memset(raw_fmts, 0, read_size);
offset += (read_size - GO_BACK_FILE_POS_NUM_BYTES);
}
fail:
if (raw_fmts) {
MFREE(osh, raw_fmts, read_size + 1);
raw_fmts = NULL;
}
if (count == ALL_MAP_VAL) {
return BCME_OK;
}
else {
DHD_ERROR(("%s: readmap error 0X%x \n", __FUNCTION__,
count));
return BCME_ERROR;
}
} /* dhd_parse_map_file */
#else
int dhd_parse_map_file(osl_t *osh, void *file, uint32 *ramstart, uint32 *rodata_start,
uint32 *rodata_end)
{
@@ -9320,6 +9537,7 @@ fail:
}
} /* dhd_parse_map_file */
#endif /* DHD_LINUX_STD_FW_API */
#ifdef PCIE_FULL_DONGLE
int

View File

@@ -48,19 +48,19 @@ uint dump_msg_level = 0;
#define CONFIG_MSG(x, args...) \
do { \
if (config_msg_level & CONFIG_MSG_LEVEL) { \
printk(KERN_ERR DHD_LOG_PREFIXS "%s : " x, __func__, ## args); \
printf("%s : " x, __func__, ## args); \
} \
} while (0)
#define CONFIG_ERROR(x, args...) \
do { \
if (config_msg_level & CONFIG_ERROR_LEVEL) { \
printk(KERN_ERR DHD_LOG_PREFIXS "CONFIG-ERROR) %s : " x, __func__, ## args); \
printf("CONFIG-ERROR) %s : " x, __func__, ## args); \
} \
} while (0)
#define CONFIG_TRACE(x, args...) \
do { \
if (config_msg_level & CONFIG_TRACE_LEVEL) { \
printk(KERN_INFO DHD_LOG_PREFIXS "CONFIG-TRACE) %s : " x, __func__, ## args); \
printf("CONFIG-TRACE) %s : " x, __func__, ## args); \
} \
} while (0)
@@ -1146,7 +1146,10 @@ dhd_conf_set_tput_patch(dhd_pub_t *dhd)
if (conf->tput_patch) {
conf->mtu = 1500;
conf->pktsetsum = TRUE;
/* set pktsetsum false by default since this will cause to
* the checksum is wrong of downloaded file
*/
conf->pktsetsum = FALSE;
#ifdef BCMSDIO
conf->dhd_dpc_prio = 98;
/* need to check if CPU can support multi-core first,
@@ -1251,14 +1254,73 @@ dhd_conf_dump_tput_patch(dhd_pub_t *dhd)
}
#endif /* DHD_TPUT_PATCH */
#ifdef DHD_LINUX_STD_FW_API
#define FIRMWARE_CLASS_PATH "/sys/module/firmware_class/parameters/path"
static int
dhd_conf_get_fw_path(char *path, int len)
{
char *pch;
int err, path_len = 0;
err = dhd_read_file(FIRMWARE_CLASS_PATH, path, len);
if(err < 0){
CONFIG_ERROR("firmware path can not read %d\n", err);
} else {
pch = strchr(path, '\n');
if (pch)
*pch = '\0';
CONFIG_TRACE("path = %s\n", path);
path_len = strlen(path);
}
return path_len;
}
static void
dhd_conf_get_filename(char *pFilename)
{
const char *pName = NULL;
if ((pFilename) && (*pFilename)) {
// back/reverse search the '/'
pName = strrchr(pFilename, '/');
if (NULL == pName) {
pName = pFilename;
} else {
if (pName[1]) {
pName++;
} else {
pName = NULL;
}
}
}
if (pName)
strcpy(pFilename, pName);
return;
}
#endif /* DHD_LINUX_STD_FW_API */
void
dhd_conf_set_path_params(dhd_pub_t *dhd, char *fw_path, char *nv_path)
{
int ag_type;
#ifdef DHD_LINUX_STD_FW_API
char path[WLC_IOCTL_SMLEN];
int path_len;
#endif
/* External conf takes precedence if specified */
dhd_conf_preinit(dhd);
#ifdef DHD_LINUX_STD_FW_API
// preprocess the filename to only left 'name'
dhd_conf_get_filename(fw_path);
dhd_conf_get_filename(nv_path);
dhd_conf_get_filename(dhd->clm_path);
dhd_conf_get_filename(dhd->conf_path);
#endif
if (dhd->conf_path[0] == '\0') {
dhd_conf_copy_path(dhd, "config.txt", dhd->conf_path, nv_path);
}
@@ -1269,11 +1331,6 @@ dhd_conf_set_path_params(dhd_pub_t *dhd, char *fw_path, char *nv_path)
dhd_conf_set_conf_name_by_chip(dhd, dhd->conf_path);
#endif
dhd_conf_read_config(dhd, dhd->conf_path);
#ifdef DHD_TPUT_PATCH
dhd_conf_dump_tput_patch(dhd);
#endif
ag_type = dhd_conf_set_fw_name_by_chip(dhd, fw_path);
dhd_conf_set_nv_name_by_chip(dhd, nv_path, ag_type);
dhd_conf_set_clm_name_by_chip(dhd, dhd->clm_path, ag_type);
@@ -1282,10 +1339,28 @@ dhd_conf_set_path_params(dhd_pub_t *dhd, char *fw_path, char *nv_path)
dhd_conf_set_nv_name_by_mac(dhd, nv_path);
#endif
#ifdef DHD_LINUX_STD_FW_API
memset(path, 0, sizeof(path));
path_len = dhd_conf_get_fw_path(path, sizeof(path));
snprintf(path+path_len, WLC_IOCTL_SMLEN, "%s", fw_path);
CONFIG_MSG("Final fw_path=%s\n", path);
snprintf(path+path_len, WLC_IOCTL_SMLEN, "%s", nv_path);
CONFIG_MSG("Final nv_path=%s\n", path);
snprintf(path+path_len, WLC_IOCTL_SMLEN, "%s", dhd->clm_path);
CONFIG_MSG("Final clm_path=%s\n", path);
snprintf(path+path_len, WLC_IOCTL_SMLEN, "%s", dhd->conf_path);
CONFIG_MSG("Final conf_path=%s\n", path);
#else
CONFIG_MSG("Final fw_path=%s\n", fw_path);
CONFIG_MSG("Final nv_path=%s\n", nv_path);
CONFIG_MSG("Final clm_path=%s\n", dhd->clm_path);
CONFIG_MSG("Final conf_path=%s\n", dhd->conf_path);
#endif
dhd_conf_read_config(dhd, dhd->conf_path);
#ifdef DHD_TPUT_PATCH
dhd_conf_dump_tput_patch(dhd);
#endif
}
int
@@ -3938,6 +4013,14 @@ dhd_conf_read_pcie_params(dhd_pub_t *dhd, char *full_param, uint len_param)
conf->flow_ring_queue_threshold = (int)simple_strtol(data, NULL, 10);
CONFIG_MSG("flow_ring_queue_threshold = %d\n", conf->flow_ring_queue_threshold);
}
else if (!strncmp("d2h_intr_control=", full_param, len_param)) {
conf->d2h_intr_control = (int)simple_strtol(data, NULL, 10);
CONFIG_MSG("d2h_intr_control = %d\n", conf->d2h_intr_control);
}
else if (!strncmp("enq_hdr_pkt=", full_param, len_param)) {
conf->enq_hdr_pkt = (int)simple_strtol(data, NULL, 0);
CONFIG_MSG("enq_hdr_pkt = 0x%x\n", conf->enq_hdr_pkt);
}
else
return false;
@@ -4367,33 +4450,37 @@ int
dhd_conf_read_config(dhd_pub_t *dhd, char *conf_path)
{
int bcmerror = -1, chip_match = -1;
uint len = 0, start_pos=0, end_pos=0;
void *image = NULL;
uint len = 0, memblock_len = 0, start_pos=0, end_pos=0;
char *memblock = NULL;
char *bufp, *pick = NULL, *pch;
bool conf_file_exists;
uint len_param;
len = MAXSZ_CONFIG;
conf_file_exists = ((conf_path != NULL) && (conf_path[0] != '\0'));
if (!conf_file_exists) {
CONFIG_MSG("config path %s\n", conf_path);
return (0);
}
if (conf_file_exists) {
image = dhd_os_open_image1(dhd, conf_path);
if (image == NULL) {
CONFIG_MSG("Ignore config file %s\n", conf_path);
goto err;
}
}
if (conf_file_exists)
bcmerror = dhd_get_download_buffer(dhd, conf_path, NVRAM, &memblock,
(int *)&len);
else
bcmerror = dhd_get_download_buffer(dhd, NULL, NVRAM, &memblock, (int *)&len);
memblock = MALLOC(dhd->osh, MAXSZ_CONFIG);
if (memblock == NULL) {
CONFIG_ERROR("Failed to allocate memory %d bytes\n", MAXSZ_CONFIG);
if (bcmerror != BCME_OK) {
CONFIG_MSG("Ignore config file %s\n", conf_path);
goto err;
}
#ifdef DHD_LINUX_STD_FW_API
memblock_len = len;
#else
memblock_len = MAXSZ_CONFIG;
#endif /* DHD_LINUX_STD_FW_API */
pick = MALLOC(dhd->osh, MAXSZ_BUF);
if (!pick) {
CONFIG_ERROR("Failed to allocate memory %d bytes\n", MAXSZ_BUF);
@@ -4401,9 +4488,6 @@ dhd_conf_read_config(dhd_pub_t *dhd, char *conf_path)
}
/* Read variables */
if (conf_file_exists) {
len = dhd_os_get_image_block(memblock, MAXSZ_CONFIG, image);
}
if (len > 0 && len < MAXSZ_CONFIG) {
bufp = (char *)memblock;
bufp[len] = 0;
@@ -4487,10 +4571,7 @@ err:
MFREE(dhd->osh, pick, MAXSZ_BUF);
if (memblock)
MFREE(dhd->osh, memblock, MAXSZ_CONFIG);
if (image)
dhd_os_close_image1(dhd, image);
dhd_free_download_buffer(dhd, memblock, memblock_len);
return bcmerror;
}
@@ -4587,7 +4668,7 @@ dhd_conf_set_txglom_params(dhd_pub_t *dhd, bool enable)
CONFIG_MSG("txglom_ext=%d, txglom_bucket_size=%d\n",
conf->txglom_ext, conf->txglom_bucket_size);
CONFIG_MSG("txglom_mode=%s\n",
conf->txglom_mode==SDPCM_TXGLOM_MDESC?"multi-desc":"copy");
conf->txglom_mode==SDPCM_TXGLOM_MDESC?"multi-desc":"copy");
CONFIG_MSG("txglomsize=%d, deferred_tx_len=%d\n",
conf->txglomsize, conf->deferred_tx_len);
CONFIG_MSG("txinrx_thres=%d, dhd_txminmax=%d\n",
@@ -4682,8 +4763,7 @@ dhd_conf_postinit_ioctls(dhd_pub_t *dhd)
dhd_conf_set_wl_cmd(dhd, wl_preinit, TRUE);
#if defined(BCMSDIO)
if (conf->chip == BCM43751_CHIP_ID || conf->chip == BCM43752_CHIP_ID ||
conf->chip == BCM4375_CHIP_ID) {
if (conf->chip == BCM43751_CHIP_ID || conf->chip == BCM43752_CHIP_ID) {
char ampdu_mpdu[] = "ampdu_mpdu=32";
dhd_conf_set_wl_cmd(dhd, ampdu_mpdu, TRUE);
} else {
@@ -4711,6 +4791,12 @@ dhd_conf_postinit_ioctls(dhd_pub_t *dhd)
char txack_alive[] = "txack_alive=0";
dhd_conf_set_wl_cmd(dhd, txack_alive, TRUE);
}
#ifdef WLDWDS
{
char dwds[] = "dwds=1";
dhd_conf_set_wl_cmd(dhd, dwds, TRUE);
}
#endif /* WLDWDS */
#if defined(WLEASYMESH)
if (conf->fw_type == FW_TYPE_EZMESH) {
if (conf->chip == BCM4359_CHIP_ID) {
@@ -4792,7 +4878,8 @@ dhd_conf_preinit(dhd_pub_t *dhd)
strcpy(conf->cspec.country_abbrev, "ALL");
strcpy(conf->cspec.ccode, "ALL");
conf->cspec.rev = 0;
} else if (conf->chip == BCM4335_CHIP_ID || conf->chip == BCM4339_CHIP_ID ||
}
else if (conf->chip == BCM4335_CHIP_ID || conf->chip == BCM4339_CHIP_ID ||
conf->chip == BCM4354_CHIP_ID || conf->chip == BCM4356_CHIP_ID ||
conf->chip == BCM4345_CHIP_ID || conf->chip == BCM4371_CHIP_ID ||
conf->chip == BCM43569_CHIP_ID || conf->chip == BCM4359_CHIP_ID ||
@@ -4800,7 +4887,8 @@ dhd_conf_preinit(dhd_pub_t *dhd)
strcpy(conf->cspec.country_abbrev, "CN");
strcpy(conf->cspec.ccode, "CN");
conf->cspec.rev = 38;
} else {
}
else {
strcpy(conf->cspec.country_abbrev, "CN");
strcpy(conf->cspec.ccode, "CN");
conf->cspec.rev = 0;
@@ -4869,6 +4957,8 @@ dhd_conf_preinit(dhd_pub_t *dhd)
conf->bus_deepsleep_disable = 1;
conf->flow_ring_queue_threshold = FLOW_RING_QUEUE_THRESHOLD;
conf->d2h_intr_method = -1;
conf->d2h_intr_control = -1;
conf->enq_hdr_pkt = 0;
#endif
conf->dpc_cpucore = -1;
conf->rxf_cpucore = -1;
@@ -5046,6 +5136,11 @@ dhd_conf_preinit(dhd_pub_t *dhd)
conf->txglomsize = SDPCM_MAXGLOM_SIZE;
#endif
init_waitqueue_head(&conf->event_complete);
#ifdef CUSTOMER_HW_ROCKCHIP
#ifdef BCMPCIE
conf->d2h_intr_control = 0;
#endif
#endif
return 0;
}

View File

@@ -22,7 +22,11 @@
#define FW_TYPE_AG 1
#define FW_PATH_AUTO_SELECT 1
#ifdef BCMDHD_MDRIVER
#define CONFIG_PATH_AUTO_SELECT
#else
//#define CONFIG_PATH_AUTO_SELECT
#endif
extern char firmware_path[MOD_PARAM_PATHLEN];
#if defined(BCMSDIO) || defined(BCMPCIE)
extern uint dhd_rxbound;
@@ -64,9 +68,10 @@ typedef struct wl_chip_nv_path_list_ctrl {
struct wl_chip_nv_path *m_chip_nv_path_head;
} wl_chip_nv_path_list_ctrl_t;
#define MAX_CTRL_CHANSPECS 256
typedef struct wl_channel_list {
uint32 count;
uint32 channel[WL_NUMCHANNELS];
uint32 channel[MAX_CTRL_CHANSPECS];
} wl_channel_list_t;
typedef struct wmes_param {
@@ -187,6 +192,13 @@ enum conn_state {
CONN_STATE_GROUPKEY_M2 = 24,
};
enum enq_pkt_type {
ENQ_PKT_TYPE_EAPOL = (1 << (0)),
ENQ_PKT_TYPE_ARP = (1 << (1)),
ENQ_PKT_TYPE_DHCP = (1 << (2)),
ENQ_PKT_TYPE_ICMP = (1 << (3)),
};
typedef struct dhd_conf {
uint devid;
uint chip;
@@ -283,6 +295,8 @@ typedef struct dhd_conf {
int bus_deepsleep_disable;
int flow_ring_queue_threshold;
int d2h_intr_method;
int d2h_intr_control;
int enq_hdr_pkt;
#endif
int dpc_cpucore;
int rxf_cpucore;
@@ -433,6 +447,8 @@ void dhd_conf_detach(dhd_pub_t *dhd);
void *dhd_get_pub(struct net_device *dev);
int wl_pattern_atoh(char *src, char *dst);
int dhd_conf_suspend_resume_sta(dhd_pub_t *dhd, int ifidx, int suspend);
/* Add to adjust 802.1x priority */
extern void pktset8021xprio(void *pkt, int prio);
#ifdef BCMSDIO
extern int dhd_bus_sleep(dhd_pub_t *dhdp, bool sleep, uint32 *intstatus);
#endif

View File

@@ -84,7 +84,7 @@ dhd_csi_event_handler(dhd_pub_t *dhd, wl_event_msg_t *event, void *event_data)
dump_len = p_event->header.cfr_dump_length;
if (dump_len < MAX_EVENT_SIZE) {
bcopy(&p_event->data, &ptr->entry.data, dump_len);
} else {
} else {
/* for big csi data */
uint8 *p = (uint8 *)&ptr->entry.data;
remain = p_event->header.remain_length;
@@ -217,4 +217,3 @@ dhd_csi_dump_list(dhd_pub_t *dhd, char *buf)
return length;
}

View File

@@ -74,4 +74,3 @@ void dhd_csi_clean_list(dhd_pub_t *dhd);
int dhd_csi_dump_list(dhd_pub_t *dhd, char *buf);
#endif /* __DHD_CSI_H__ */

View File

@@ -120,9 +120,9 @@ extern char* dhd_dbg_get_system_timestamp(void);
#endif /* DHD_LOG_DUMP */
#if defined(CUSTOMER_DBG_SYSTEM_TIME) && defined(DHD_DEBUGABILITY_LOG_DUMP_RING)
#define DBG_PRINT_PREFIX "[%s][dhd] ", dhd_dbg_get_system_timestamp()
#define DBG_PRINT_PREFIX "[%s][dhd][wlan]", dhd_dbg_get_system_timestamp()
#else
#define DBG_PRINT_PREFIX "[dhd] "
#define DBG_PRINT_PREFIX
#endif
#define DBG_PRINT_SYSTEM_TIME pr_cont(DBG_PRINT_PREFIX)
@@ -163,8 +163,7 @@ do { \
#define DHD_ERROR(args) \
do { \
if (dhd_msg_level & DHD_ERROR_VAL) { \
DBG_PRINT_SYSTEM_TIME; \
pr_cont args; \
printf args; \
DHD_LOG_DUMP_WRITE_TS; \
DHD_LOG_DUMP_WRITE args; \
} \
@@ -238,8 +237,7 @@ do { \
do { \
if (dhd_msg_level & DHD_ERROR_VAL) { \
if (dhd_msg_level & DHD_ERROR_MEM_VAL) { \
DBG_PRINT_SYSTEM_TIME; \
pr_cont args; \
printf args; \
} \
DHD_LOG_DUMP_WRITE args; \
} \
@@ -248,8 +246,7 @@ do { \
do { \
if (dhd_msg_level & DHD_ERROR_VAL) { \
if (dhd_msg_level & DHD_IOVAR_MEM_VAL) { \
DBG_PRINT_SYSTEM_TIME; \
pr_cont args; \
printf args; \
} \
DHD_LOG_DUMP_WRITE args; \
} \
@@ -264,8 +261,7 @@ do { \
#define DHD_EVENT(args) \
do { \
if (dhd_msg_level & DHD_EVENT_VAL) { \
DBG_PRINT_SYSTEM_TIME; \
pr_cont args; \
printf args; \
DHD_LOG_DUMP_WRITE_PRSRV_TS; \
DHD_LOG_DUMP_WRITE_PRSRV args; \
} \
@@ -274,7 +270,6 @@ do { \
do { \
if (dhd_msg_level & DHD_EVENT_VAL) { \
if (dhd_msg_level & DHD_PRSRV_MEM_VAL) { \
DBG_PRINT_SYSTEM_TIME; \
printf args; \
} \
DHD_LOG_DUMP_WRITE_TS; \
@@ -290,8 +285,7 @@ do { \
do { \
if (dhd_msg_level & DHD_EVENT_VAL) { \
if (dhd_msg_level & DHD_MSGTRACE_VAL) { \
DBG_PRINT_SYSTEM_TIME; \
pr_cont args; \
printf args; \
DHD_LOG_DUMP_WRITE_TS; \
DHD_LOG_DUMP_WRITE args; \
} \
@@ -300,8 +294,7 @@ do { \
#define DHD_ERROR_EX(args) \
do { \
if (dhd_msg_level & DHD_ERROR_VAL) { \
DBG_PRINT_SYSTEM_TIME; \
pr_cont args; \
printf args; \
DHD_LOG_DUMP_WRITE_EX_TS; \
DHD_LOG_DUMP_WRITE_EX args; \
} \
@@ -309,8 +302,7 @@ do { \
#define DHD_MSGTRACE_LOG(args) \
do { \
if (dhd_msg_level & DHD_MSGTRACE_VAL) { \
DBG_PRINT_SYSTEM_TIME; \
pr_cont args; \
printf args; \
} \
DHD_LOG_DUMP_WRITE_TS; \
DHD_LOG_DUMP_WRITE args; \
@@ -319,8 +311,7 @@ do { \
#define DHD_ERROR_ROAM(args) \
do { \
if (dhd_msg_level & DHD_ERROR_VAL) { \
DBG_PRINT_SYSTEM_TIME; \
pr_cont args; \
printf args; \
DHD_LOG_DUMP_WRITE_ROAM_TS; \
DHD_LOG_DUMP_WRITE_ROAM args; \
} \
@@ -352,6 +343,7 @@ do { \
#define DHD_REORDER(args) do {if (dhd_msg_level & DHD_REORDER_VAL) printf args;} while (0)
#define DHD_PNO(args) do {if (dhd_msg_level & DHD_PNO_VAL) printf args;} while (0)
#define DHD_RTT(args) do {if (dhd_msg_level & DHD_RTT_VAL) printf args;} while (0)
#define DHD_RPM(args) do {if (dhd_msg_level & DHD_RPM_VAL) printf args;} while (0)
#define DHD_PKT_MON(args) do {if (dhd_msg_level & DHD_PKT_MON_VAL) printf args;} while (0)
#if defined(DHD_LOG_DUMP)

View File

@@ -210,6 +210,39 @@ done:
return ret;
}
int BCMFASTPATH
(dhd_flow_queue_enqueue_head)(dhd_pub_t *dhdp, flow_queue_t *queue, void *pkt)
{
int ret = BCME_OK;
ASSERT(queue != NULL);
if (dhd_flow_queue_throttle(queue)) {
queue->failures++;
ret = (*queue->cb)(queue, pkt);
goto done;
}
if (queue->head) {
FLOW_QUEUE_PKT_SETNEXT(pkt, queue->head);
queue->head = pkt;
} else {
queue->head = pkt;
FLOW_QUEUE_PKT_SETNEXT(pkt, NULL);
queue->tail = pkt; /* at tail */
}
queue->len++;
/* increment parent's cummulative length */
DHD_CUMM_CTR_INCR(DHD_FLOW_QUEUE_CLEN_PTR(queue));
/* increment grandparent's cummulative length */
DHD_CUMM_CTR_INCR(DHD_FLOW_QUEUE_L2CLEN_PTR(queue));
done:
return ret;
}
/** Dequeue an 802.3 packet from a flow ring's queue, from head (FIFO) */
void *
BCMFASTPATH(dhd_flow_queue_dequeue)(dhd_pub_t *dhdp, flow_queue_t *queue)

View File

@@ -307,6 +307,7 @@ extern void dhd_flow_queue_init(dhd_pub_t *dhdp, flow_queue_t *queue, int max);
extern void dhd_flow_queue_reinit(dhd_pub_t *dhdp, flow_queue_t *queue, int max);
extern void dhd_flow_queue_register(flow_queue_t *queue, flow_queue_cb_t cb);
extern int dhd_flow_queue_enqueue(dhd_pub_t *dhdp, flow_queue_t *queue, void *pkt);
extern int dhd_flow_queue_enqueue_head(dhd_pub_t *dhdp, flow_queue_t *queue, void *pkt);
extern void * dhd_flow_queue_dequeue(dhd_pub_t *dhdp, flow_queue_t *queue);
extern void dhd_flow_queue_reinsert(dhd_pub_t *dhdp, flow_queue_t *queue, void *pkt);

View File

@@ -404,10 +404,14 @@ int dhd_wlan_init_plat_data(wifi_adapter_info_t *adapter)
adapter->index = 0;
}
err = dhd_wlan_init_gpio(adapter);
if (err)
goto exit;
#ifdef DHD_STATIC_IN_DRIVER
dhd_static_buf_init();
err = dhd_static_buf_init();
#endif
exit:
return err;
}
@@ -419,4 +423,3 @@ void dhd_wlan_deinit_plat_data(wifi_adapter_info_t *adapter)
#endif
dhd_wlan_deinit_gpio(adapter);
}

File diff suppressed because it is too large Load Diff

View File

@@ -407,6 +407,9 @@ typedef struct dhd_if {
bool recv_reassoc_evt;
bool post_roam_evt;
#endif /* DHD_POST_EAPOL_M1_AFTER_ROAM_EVT */
#ifdef WLDWDS
bool dwds; /* DWDS interface */
#endif /* WLDWDS */
#ifdef WLEASYMESH
uint8 _1905_al_ucast[ETHER_ADDR_LEN];
uint8 _1905_al_mcast[ETHER_ADDR_LEN];

View File

@@ -177,6 +177,7 @@ dhd_dbg_ring_proc_destroy(dhd_pub_t *dhdp)
* -----------------------------------------------------------------------------
*/
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 18, 0))
#if defined(DHD_TRACE_WAKE_LOCK)
extern atomic_t trace_wklock_onoff;
@@ -1030,6 +1031,7 @@ done:
return ret;
}
#endif /* PWRSTATS_SYSFS */
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(5, 18, 0) */
/*
* Generic Attribute Structure for DHD.
@@ -1046,6 +1048,7 @@ struct dhd_attr {
ssize_t(*store)(struct dhd_info *, const char *, size_t count);
};
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 18, 0))
#if defined(DHD_TRACE_WAKE_LOCK)
static struct dhd_attr dhd_attr_wklock =
__ATTR(wklock_trace, 0660, show_wklock_trace, wklock_trace_onoff);
@@ -1119,10 +1122,12 @@ static struct dhd_attr dhd_attr_nvram_path =
static struct dhd_attr dhd_attr_pwrstats_path =
__ATTR(power_stats, 0660, show_pwrstats_path, NULL);
#endif /* PWRSTATS_SYSFS */
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(5, 18, 0) */
#define to_dhd(k) container_of(k, struct dhd_info, dhd_kobj)
#define to_attr(a) container_of(a, struct dhd_attr, attr)
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 18, 0))
#ifdef DHD_MAC_ADDR_EXPORT
struct ether_addr sysfs_mac_addr;
static ssize_t
@@ -1154,6 +1159,7 @@ set_mac_addr(struct dhd_info *dev, const char *buf, size_t count)
static struct dhd_attr dhd_attr_macaddr =
__ATTR(mac_addr, 0660, show_mac_addr, set_mac_addr);
#endif /* DHD_MAC_ADDR_EXPORT */
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(5, 18, 0) */
#ifdef DHD_FW_COREDUMP
/*
@@ -1262,6 +1268,7 @@ void dhd_get_memdump_info(dhd_pub_t *dhd)
DHD_ERROR(("%s: MEMDUMP ENABLED = %u\n", __FUNCTION__, dhd->memdump_enabled));
}
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 18, 0))
#ifdef DHD_EXPORT_CNTL_FILE
static ssize_t
show_memdump_info(struct dhd_info *dev, char *buf)
@@ -1303,6 +1310,7 @@ set_memdump_info(struct dhd_info *dev, const char *buf, size_t count)
static struct dhd_attr dhd_attr_memdump =
__ATTR(memdump, 0660, show_memdump_info, set_memdump_info);
#endif /* DHD_EXPORT_CNTL_FILE */
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(5, 18, 0) */
#endif /* DHD_FW_COREDUMP */
#ifdef BCMASSERT_LOG
@@ -1362,6 +1370,7 @@ void dhd_get_assert_info(dhd_pub_t *dhd)
#endif /* !DHD_EXPORT_CNTL_FILE */
}
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 18, 0))
#ifdef DHD_EXPORT_CNTL_FILE
static ssize_t
show_assert_info(struct dhd_info *dev, char *buf)
@@ -1396,8 +1405,10 @@ set_assert_info(struct dhd_info *dev, const char *buf, size_t count)
static struct dhd_attr dhd_attr_assert =
__ATTR(assert, 0660, show_assert_info, set_assert_info);
#endif /* DHD_EXPORT_CNTL_FILE */
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(5, 18, 0) */
#endif /* BCMASSERT_LOG */
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 18, 0))
#ifdef DHD_EXPORT_CNTL_FILE
#if defined(WRITE_WLANINFO)
static ssize_t
@@ -1889,10 +1900,12 @@ store_adps_bam_list(struct dhd_info *dev, const char *buf, size_t count)
static struct dhd_attr dhd_attr_adps_bam =
__ATTR(bad_ap_list, 0660, show_adps_bam_list, store_adps_bam_list);
#endif /* DHD_ADPS_BAM_EXPORT && WL_BAM */
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(5, 18, 0) */
#ifdef DHD_SEND_HANG_PRIVCMD_ERRORS
uint32 report_hang_privcmd_err = 1;
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 18, 0))
#ifdef DHD_SEND_HANG_PRIVCMD_ERRORS
static ssize_t
show_hang_privcmd_err(struct dhd_info *dev, char *buf)
{
@@ -2350,6 +2363,7 @@ static struct attribute *default_file_attrs[] = {
#endif /* AGG_H2D_DB */
NULL
};
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(5, 18, 0) */
/*
* wifi kobject show function, the "attr" attribute specifices to which
@@ -2406,7 +2420,9 @@ static struct sysfs_ops dhd_sysfs_ops = {
static struct kobj_type dhd_ktype = {
.sysfs_ops = &dhd_sysfs_ops,
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 18, 0))
.default_attrs = default_file_attrs,
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(5, 18, 0) */
};
#ifdef CSI_SUPPORT
@@ -2436,6 +2452,7 @@ static struct bin_attribute dhd_attr_csi = {
* sysfs for dhd_lb
*/
#ifdef DHD_LB
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 18, 0))
#if defined(DHD_LB_TXP)
static ssize_t
show_lbtxp(struct dhd_info *dev, char *buf)
@@ -2830,6 +2847,7 @@ static struct attribute *debug_lb_attrs[] = {
&dhd_tx_cpu.attr,
NULL
};
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(5, 18, 0) */
#define to_dhd_lb(k) container_of(k, struct dhd_info, dhd_lb_kobj)
@@ -2888,7 +2906,9 @@ static struct sysfs_ops dhd_sysfs_lb_ops = {
static struct kobj_type dhd_lb_ktype = {
.sysfs_ops = &dhd_sysfs_lb_ops,
#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 18, 0))
.default_attrs = debug_lb_attrs,
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(5, 18, 0) */
};
#endif /* DHD_LB */

View File

@@ -41,8 +41,8 @@
#include <dhd_config.h>
#include <wl_android.h>
#define DHD_PKTDUMP(arg) printk arg
#define DHD_PKTDUMP_MEM(arg) printk arg
#define DHD_PKTDUMP(arg) printf arg
#define DHD_PKTDUMP_MEM(arg) printf arg
#define PACKED_STRUCT __attribute__ ((packed))
#define EAPOL_HDR_LEN 4
@@ -200,12 +200,12 @@ static const char tx_pktfate[][30] = {
do { \
if (dump_msg_level & DUMP_EAPOL_VAL) { \
if (tx) { \
DHD_PKTDUMP((DHD_LOG_PREFIX "[%s] 802_1X " x " [TX] : (%s) %s (%s)"TXFATE_FMT"\n", \
DHD_PKTDUMP(("[%s] 802_1X " x " [TX] : (%s) %s (%s)"TXFATE_FMT"\n", \
ifname, ## args, \
tx?seabuf:deabuf, tx?"->":"<-", tx?deabuf:seabuf, \
TX_PKTHASH(pkthash), TX_FATE(pktfate))); \
} else { \
DHD_PKTDUMP((DHD_LOG_PREFIX "[%s] 802_1X " x " [RX] : (%s) %s (%s)\n", \
DHD_PKTDUMP(("[%s] 802_1X " x " [RX] : (%s) %s (%s)\n", \
ifname, ## args, \
tx?seabuf:deabuf, tx?"->":"<-", tx?deabuf:seabuf)); \
} \
@@ -216,12 +216,12 @@ static const char tx_pktfate[][30] = {
do { \
if (dump_msg_level & DUMP_EAPOL_VAL) { \
if (tx) { \
DHD_PKTDUMP((DHD_LOG_PREFIX "[%s] 802_1X " x " [TX] : (%s) %s (%s)"DBGREPLAY TXFATE_FMT"\n", \
DHD_PKTDUMP(("[%s] 802_1X " x " [TX] : (%s) %s (%s)"DBGREPLAY TXFATE_FMT"\n", \
ifname, ## args, \
tx?seabuf:deabuf, tx?"->":"<-", tx?deabuf:seabuf, \
REPLAY_FMT(eap_key), TX_PKTHASH(pkthash), TX_FATE(pktfate))); \
} else { \
DHD_PKTDUMP((DHD_LOG_PREFIX "[%s] 802_1X " x " [RX] : (%s) %s (%s)"DBGREPLAY"\n", \
DHD_PKTDUMP(("[%s] 802_1X " x " [RX] : (%s) %s (%s)"DBGREPLAY"\n", \
ifname, ## args, \
tx?seabuf:deabuf, tx?"->":"<-", tx?deabuf:seabuf, \
REPLAY_FMT(eap_key))); \
@@ -233,14 +233,14 @@ static const char tx_pktfate[][30] = {
do { \
if (dump_msg_level & DUMP_EAPOL_VAL) { \
if (tx) { \
DHD_PKTDUMP((DHD_LOG_PREFIX "[%s] 802_1X " x " [TX] : (%s) %s (%s) " \
DHD_PKTDUMP(("[%s] 802_1X " x " [TX] : (%s) %s (%s) " \
"ver %d, type %d"TXFATE_FMT"\n", \
ifname, ## args, \
tx?seabuf:deabuf, tx?"->":"<-", tx?deabuf:seabuf, \
eapol_hdr->version, eapol_hdr->type, \
TX_PKTHASH(pkthash), TX_FATE(pktfate))); \
} else { \
DHD_PKTDUMP((DHD_LOG_PREFIX "[%s] 802_1X " x " [RX] : (%s) %s (%s) " \
DHD_PKTDUMP(("[%s] 802_1X " x " [RX] : (%s) %s (%s) " \
"ver %d, type %d\n", \
ifname, ## args, \
tx?seabuf:deabuf, tx?"->":"<-", tx?deabuf:seabuf, \
@@ -253,7 +253,7 @@ static const char tx_pktfate[][30] = {
do { \
if (dump_msg_level & DUMP_EAPOL_VAL) { \
if (tx) { \
DHD_PKTDUMP((DHD_LOG_PREFIX "[%s] 802_1X " x " [TX] : (%s) %s (%s) " \
DHD_PKTDUMP(("[%s] 802_1X " x " [TX] : (%s) %s (%s) " \
"ver %d type %d keytype %d keyinfo 0x%02X"TXFATE_FMT"\n", \
ifname, ## args, \
tx?seabuf:deabuf, tx?"->":"<-", tx?deabuf:seabuf, \
@@ -261,7 +261,7 @@ static const char tx_pktfate[][30] = {
(uint32)hton16(eap_key->key_info), \
TX_PKTHASH(pkthash), TX_FATE(pktfate))); \
} else { \
DHD_PKTDUMP((DHD_LOG_PREFIX "[%s] 802_1X " x " [RX] : (%s) %s (%s) " \
DHD_PKTDUMP(("[%s] 802_1X " x " [RX] : (%s) %s (%s) " \
"ver %d type %d keytype %d keyinfo 0x%02X\n", \
ifname, ## args, \
tx?seabuf:deabuf, tx?"->":"<-", tx?deabuf:seabuf, \
@@ -1047,36 +1047,12 @@ dhd_check_dhcp(uint8 *pktdata)
return TRUE;
}
#ifdef DHD_DHCP_DUMP
#define BOOTP_CHADDR_LEN 16
#define BOOTP_SNAME_LEN 64
#define BOOTP_FILE_LEN 128
#define BOOTP_MIN_DHCP_OPT_LEN 312
#define BOOTP_MAGIC_COOKIE_LEN 4
#define DHCP_MSGTYPE_DISCOVER 1
#define DHCP_MSGTYPE_OFFER 2
#define DHCP_MSGTYPE_REQUEST 3
#define DHCP_MSGTYPE_DECLINE 4
#define DHCP_MSGTYPE_ACK 5
#define DHCP_MSGTYPE_NAK 6
#define DHCP_MSGTYPE_RELEASE 7
#define DHCP_MSGTYPE_INFORM 8
#define DHCP_PRINT(str) \
do { \
if (tx) { \
DHD_PKTDUMP((DHD_LOG_PREFIX "[%s] " str " %8s[%8s] [TX] : %s(%s) %s %s(%s)"TXFATE_FMT"\n", \
ifname, typestr, opstr, tx?sabuf:dabuf, tx?seabuf:deabuf, \
tx?"->":"<-", tx?dabuf:sabuf, tx?deabuf:seabuf, \
TX_PKTHASH(pkthash), TX_FATE(pktfate))); \
} else { \
DHD_PKTDUMP((DHD_LOG_PREFIX "[%s] " str " %8s[%8s] [RX] : %s(%s) %s %s(%s)\n", \
ifname, typestr, opstr, tx?sabuf:dabuf, tx?seabuf:deabuf, \
tx?"->":"<-", tx?dabuf:sabuf, tx?deabuf:seabuf)); \
} \
} while (0)
typedef struct bootp_fmt {
struct ipv4_hdr iph;
struct bcmudp_hdr udph;
@@ -1096,8 +1072,32 @@ typedef struct bootp_fmt {
uint8 file_name[BOOTP_FILE_LEN];
uint8 options[BOOTP_MIN_DHCP_OPT_LEN];
} PACKED_STRUCT bootp_fmt_t;
static const uint8 bootp_magic_cookie[4] = { 99, 130, 83, 99 };
#ifdef DHD_DHCP_DUMP
#define DHCP_MSGTYPE_DISCOVER 1
#define DHCP_MSGTYPE_OFFER 2
#define DHCP_MSGTYPE_REQUEST 3
#define DHCP_MSGTYPE_DECLINE 4
#define DHCP_MSGTYPE_ACK 5
#define DHCP_MSGTYPE_NAK 6
#define DHCP_MSGTYPE_RELEASE 7
#define DHCP_MSGTYPE_INFORM 8
#define DHCP_PRINT(str) \
do { \
if (tx) { \
DHD_PKTDUMP(("[%s] " str " %8s[%8s] [TX] : %s(%s) %s %s(%s)"TXFATE_FMT"\n", \
ifname, typestr, opstr, tx?sabuf:dabuf, tx?seabuf:deabuf, \
tx?"->":"<-", tx?dabuf:sabuf, tx?deabuf:seabuf, \
TX_PKTHASH(pkthash), TX_FATE(pktfate))); \
} else { \
DHD_PKTDUMP(("[%s] " str " %8s[%8s] [RX] : %s(%s) %s %s(%s)\n", \
ifname, typestr, opstr, tx?sabuf:dabuf, tx?seabuf:deabuf, \
tx?"->":"<-", tx?dabuf:sabuf, tx?deabuf:seabuf)); \
} \
} while (0)
static char dhcp_ops[][10] = {
"NA", "REQUEST", "REPLY"
};
@@ -1193,12 +1193,12 @@ dhd_check_icmp(uint8 *pktdata)
#define ICMP_PING_PRINT(str) \
do { \
if (tx) { \
DHD_PKTDUMP_MEM((DHD_LOG_PREFIX "[%s] "str " [TX] : %s(%s) %s %s(%s) SEQNUM=%d" \
DHD_PKTDUMP_MEM(("[%s] "str " [TX] : %s(%s) %s %s(%s) SEQNUM=%d" \
TXFATE_FMT"\n", ifname, tx?sabuf:dabuf, tx?seabuf:deabuf, \
tx?"->":"<-", tx?dabuf:sabuf, tx?deabuf:seabuf, seqnum, \
TX_PKTHASH(pkthash), TX_FATE(pktfate))); \
} else { \
DHD_PKTDUMP_MEM((DHD_LOG_PREFIX "[%s] "str " [RX] : %s(%s) %s %s(%s) SEQNUM=%d\n", \
DHD_PKTDUMP_MEM(("[%s] "str " [RX] : %s(%s) %s %s(%s) SEQNUM=%d\n", \
ifname, tx?sabuf:dabuf, tx?seabuf:deabuf, \
tx?"->":"<-", tx?dabuf:sabuf, tx?deabuf:seabuf, seqnum)); \
} \
@@ -1207,12 +1207,12 @@ dhd_check_icmp(uint8 *pktdata)
#define ICMP_PRINT(str) \
do { \
if (tx) { \
DHD_PKTDUMP_MEM((DHD_LOG_PREFIX "[%s] "str " [TX] : %s(%s) %s %s(%s) TYPE=%d, CODE=%d" \
DHD_PKTDUMP_MEM(("[%s] "str " [TX] : %s(%s) %s %s(%s) TYPE=%d, CODE=%d" \
TXFATE_FMT "\n", ifname, tx?sabuf:dabuf, tx?seabuf:deabuf, \
tx?"->":"<-", tx?dabuf:sabuf, tx?deabuf:seabuf, type, code, \
TX_PKTHASH(pkthash), TX_FATE(pktfate))); \
} else { \
DHD_PKTDUMP_MEM((DHD_LOG_PREFIX "[%s] "str " [RX] : %s(%s) %s %s(%s) TYPE=%d," \
DHD_PKTDUMP_MEM(("[%s] "str " [RX] : %s(%s) %s %s(%s) TYPE=%d," \
" CODE=%d\n", ifname, tx?sabuf:dabuf, tx?seabuf:deabuf, \
tx?"->":"<-", tx?dabuf:sabuf, tx?deabuf:seabuf, type, code)); \
} \
@@ -1293,18 +1293,18 @@ dhd_check_arp(uint8 *pktdata, uint16 ether_type)
do { \
if (tx) { \
if (dump_enabled && pktfate && !TX_FATE_ACKED(pktfate)) { \
DHD_PKTDUMP((DHD_LOG_PREFIX "[%s] "str " [TX] : %s(%s) %s %s(%s)"TXFATE_FMT"\n", \
DHD_PKTDUMP(("[%s] "str " [TX] : %s(%s) %s %s(%s)"TXFATE_FMT"\n", \
ifname, tx?sabuf:dabuf, tx?seabuf:deabuf, \
tx?"->":"<-", tx?dabuf:sabuf, tx?deabuf:seabuf, \
TX_PKTHASH(pkthash), TX_FATE(pktfate))); \
} else { \
DHD_PKTDUMP_MEM((DHD_LOG_PREFIX "[%s] "str " [TX] : %s(%s) %s %s(%s)"TXFATE_FMT"\n", \
DHD_PKTDUMP_MEM(("[%s] "str " [TX] : %s(%s) %s %s(%s)"TXFATE_FMT"\n", \
ifname, tx?sabuf:dabuf, tx?seabuf:deabuf, \
tx?"->":"<-", tx?dabuf:sabuf, tx?deabuf:seabuf, \
TX_PKTHASH(pkthash), TX_FATE(pktfate))); \
} \
} else { \
DHD_PKTDUMP_MEM((DHD_LOG_PREFIX "[%s] "str " [RX] : %s(%s) %s %s(%s)\n", \
DHD_PKTDUMP_MEM(("[%s] "str " [RX] : %s(%s) %s %s(%s)\n", \
ifname, tx?sabuf:dabuf, tx?seabuf:deabuf, \
tx?"->":"<-", tx?dabuf:sabuf, tx?deabuf:seabuf)); \
} \
@@ -1314,18 +1314,18 @@ dhd_check_arp(uint8 *pktdata, uint16 ether_type)
do { \
if (tx) { \
if (dump_enabled && pktfate && !TX_FATE_ACKED(pktfate)) { \
DHD_PKTDUMP((DHD_LOG_PREFIX "[%s] "str " [TX] : %s(%s) %s %s(%s) op_code=%d" \
DHD_PKTDUMP(("[%s] "str " [TX] : %s(%s) %s %s(%s) op_code=%d" \
TXFATE_FMT "\n", ifname, tx?sabuf:dabuf, tx?seabuf:deabuf, \
tx?"->":"<-", tx?dabuf:sabuf, tx?deabuf:seabuf, opcode, \
TX_PKTHASH(pkthash), TX_FATE(pktfate))); \
} else { \
DHD_PKTDUMP_MEM((DHD_LOG_PREFIX "[%s] "str " [TX] : %s(%s) %s %s(%s) op_code=%d" \
DHD_PKTDUMP_MEM(("[%s] "str " [TX] : %s(%s) %s %s(%s) op_code=%d" \
TXFATE_FMT "\n", ifname, tx?sabuf:dabuf, tx?seabuf:deabuf, \
tx?"->":"<-", tx?dabuf:sabuf, tx?deabuf:seabuf, opcode, \
TX_PKTHASH(pkthash), TX_FATE(pktfate))); \
} \
} else { \
DHD_PKTDUMP_MEM((DHD_LOG_PREFIX "[%s] "str " [RX] : %s(%s) %s %s(%s) op_code=%d\n", \
DHD_PKTDUMP_MEM(("[%s] "str " [RX] : %s(%s) %s %s(%s) op_code=%d\n", \
ifname, tx?sabuf:dabuf, tx?seabuf:deabuf, \
tx?"->":"<-", tx?dabuf:sabuf, tx?deabuf:seabuf, opcode)); \
} \
@@ -1429,18 +1429,18 @@ static const char dns_opcode_types[][11] = {
do { \
if (tx) { \
if (dump_enabled && pktfate && !TX_FATE_ACKED(pktfate)) { \
DHD_PKTDUMP((DHD_LOG_PREFIX "[%s] " str " [TX] : %s(%s) %s %s(%s) ID:0x%04X OPCODE:%s" \
DHD_PKTDUMP(("[%s] " str " [TX] : %s(%s) %s %s(%s) ID:0x%04X OPCODE:%s" \
TXFATE_FMT "\n", ifname, tx?sabuf:dabuf, tx?seabuf:deabuf, \
tx?"->":"<-", tx?dabuf:sabuf, tx?deabuf:seabuf, \
id, DNSOPCODE(opcode), TX_PKTHASH(pkthash), TX_FATE(pktfate))); \
} else { \
DHD_PKTDUMP_MEM((DHD_LOG_PREFIX "[%s] " str " [TX] : %s(%s) %s %s(%s) ID:0x%04X OPCODE:%s" \
DHD_PKTDUMP_MEM(("[%s] " str " [TX] : %s(%s) %s %s(%s) ID:0x%04X OPCODE:%s" \
TXFATE_FMT "\n", ifname, tx?sabuf:dabuf, tx?seabuf:deabuf, \
tx?"->":"<-", tx?dabuf:sabuf, tx?deabuf:seabuf, \
id, DNSOPCODE(opcode), TX_PKTHASH(pkthash), TX_FATE(pktfate))); \
} \
} else { \
DHD_PKTDUMP_MEM((DHD_LOG_PREFIX "[%s] " str " [RX] : %s(%s) %s %s(%s) ID:0x%04X OPCODE:%s\n", \
DHD_PKTDUMP_MEM(("[%s] " str " [RX] : %s(%s) %s %s(%s) ID:0x%04X OPCODE:%s\n", \
ifname, tx?sabuf:dabuf, tx?seabuf:deabuf, tx?"->":"<-", \
tx?dabuf:sabuf, tx?deabuf:seabuf, id, DNSOPCODE(opcode))); \
} \
@@ -1450,18 +1450,18 @@ static const char dns_opcode_types[][11] = {
do { \
if (tx) { \
if (dump_enabled && pktfate && !TX_FATE_ACKED(pktfate)) { \
DHD_PKTDUMP((DHD_LOG_PREFIX "[%s] " str " [TX] : %s(%s) %s %s(%s) ID:0x%04X OPCODE:%s RCODE:%d" \
DHD_PKTDUMP(("[%s] " str " [TX] : %s(%s) %s %s(%s) ID:0x%04X OPCODE:%s RCODE:%d" \
TXFATE_FMT "\n", ifname, tx?sabuf:dabuf, tx?seabuf:deabuf, \
tx?"->":"<-", tx?dabuf:sabuf, tx?deabuf:seabuf, id, DNSOPCODE(opcode), \
GET_DNS_RCODE(flags), TX_PKTHASH(pkthash), TX_FATE(pktfate))); \
} else { \
DHD_PKTDUMP_MEM((DHD_LOG_PREFIX "[%s] " str " [TX] : %s(%s) %s %s(%s) ID:0x%04X OPCODE:%s RCODE:%d" \
DHD_PKTDUMP_MEM(("[%s] " str " [TX] : %s(%s) %s %s(%s) ID:0x%04X OPCODE:%s RCODE:%d" \
TXFATE_FMT "\n", ifname, tx?sabuf:dabuf, tx?seabuf:deabuf, \
tx?"->":"<-", tx?dabuf:sabuf, tx?deabuf:seabuf, id, DNSOPCODE(opcode), \
GET_DNS_RCODE(flags), TX_PKTHASH(pkthash), TX_FATE(pktfate))); \
} \
} else { \
DHD_PKTDUMP_MEM((DHD_LOG_PREFIX "[%s] " str " [RX] : %s(%s) %s %s(%s) ID:0x%04X OPCODE:%s RCODE:%d\n", \
DHD_PKTDUMP_MEM(("[%s] " str " [RX] : %s(%s) %s %s(%s) ID:0x%04X OPCODE:%s RCODE:%d\n", \
ifname, tx?sabuf:dabuf, tx?seabuf:deabuf, \
tx?"->":"<-", tx?dabuf:sabuf, tx?deabuf:seabuf, \
id, DNSOPCODE(opcode), GET_DNS_RCODE(flags))); \
@@ -1557,13 +1557,13 @@ dhd_trx_pkt_dump(dhd_pub_t *dhdp, int ifidx, uint8 *pktdata, uint32 pktlen, bool
if (protocol != ETHER_TYPE_BRCM) {
if (pktdata[0] == 0xFF) {
DHD_PKTDUMP((DHD_LOG_PREFIX "[%s] %s BROADCAST DUMP - %s\n",
DHD_PKTDUMP(("[%s] %s BROADCAST DUMP - %s\n",
dhd_ifname(dhdp, ifidx), tx?"TX":"RX", pkttype));
} else if (pktdata[0] & 1) {
DHD_PKTDUMP((DHD_LOG_PREFIX "[%s] %s MULTICAST DUMP " MACDBG " - %s\n",
DHD_PKTDUMP(("[%s] %s MULTICAST DUMP " MACDBG " - %s\n",
dhd_ifname(dhdp, ifidx), tx?"TX":"RX", MAC2STRDBG(pktdata), pkttype));
} else {
DHD_PKTDUMP((DHD_LOG_PREFIX "[%s] %s DUMP - %s\n",
DHD_PKTDUMP(("[%s] %s DUMP - %s\n",
dhd_ifname(dhdp, ifidx), tx?"TX":"RX", pkttype));
}
#ifdef DHD_RX_FULL_DUMP
@@ -1571,8 +1571,165 @@ dhd_trx_pkt_dump(dhd_pub_t *dhdp, int ifidx, uint8 *pktdata, uint32 pktlen, bool
#endif /* DHD_RX_FULL_DUMP */
}
else {
DHD_PKTDUMP((DHD_LOG_PREFIX "[%s] %s DUMP - %s\n",
DHD_PKTDUMP(("[%s] %s DUMP - %s\n",
dhd_ifname(dhdp, ifidx), tx?"TX":"RX", pkttype));
}
}
#endif /* DHD_RX_DUMP */
#ifdef BCMPCIE
static bool
dhd_is_eapol_pkt(dhd_pub_t *dhd, uint8 *pktdata, uint32 pktlen)
{
eapol_header_t *eapol_hdr = (eapol_header_t *)pktdata;
eapol_hdr = (eapol_header_t *)pktdata;
if (eapol_hdr->type == EAP_PACKET) {
return TRUE;
} else if (eapol_hdr->type == EAPOL_START) {
return TRUE;
} else if (eapol_hdr->type == EAPOL_KEY) {
return TRUE;
} else {
return TRUE;
}
return FALSE;
}
static bool
dhd_is_arp_pkt(dhd_pub_t *dhdp, uint8 *pktdata)
{
uint8 *pkt = (uint8 *)&pktdata[ETHER_HDR_LEN];
struct bcmarp *arph = (struct bcmarp *)pkt;
uint16 opcode;
/* validation check */
if (arph->htype != hton16(HTYPE_ETHERNET) ||
arph->hlen != ETHER_ADDR_LEN ||
arph->plen != 4) {
return FALSE;
}
opcode = ntoh16(arph->oper);
if (opcode == ARP_OPC_REQUEST) {
return TRUE;
} else if (opcode == ARP_OPC_REPLY) {
return TRUE;
} else {
return TRUE;
}
return FALSE;
}
static bool
dhd_is_dhcp_pkt(dhd_pub_t *dhdp, uint8 *pktdata)
{
bootp_fmt_t *b = (bootp_fmt_t *)&pktdata[ETHER_HDR_LEN];
struct ipv4_hdr *iph = &b->iph;
uint8 *ptr, *opt, *end = (uint8 *) b + ntohs(b->iph.tot_len);
int len, opt_len;
/* check IP header */
if ((IPV4_HLEN(iph) < IPV4_HLEN_MIN) ||
IP_VER(iph) != IP_VER_4 ||
IPV4_PROT(iph) != IP_PROT_UDP) {
return FALSE;
}
/* check UDP port for bootp (67, 68) */
if (b->udph.src_port != htons(DHCP_PORT_SERVER) &&
b->udph.src_port != htons(DHCP_PORT_CLIENT) &&
b->udph.dst_port != htons(DHCP_PORT_SERVER) &&
b->udph.dst_port != htons(DHCP_PORT_CLIENT)) {
return FALSE;
}
/* check header length */
if (ntohs(iph->tot_len) < ntohs(b->udph.len) + sizeof(struct bcmudp_hdr)) {
return FALSE;
}
len = ntohs(b->udph.len) - sizeof(struct bcmudp_hdr);
opt_len = len - (sizeof(*b) - sizeof(struct ipv4_hdr) -
sizeof(struct bcmudp_hdr) - sizeof(b->options));
/* parse bootp options */
if (opt_len >= BOOTP_MAGIC_COOKIE_LEN &&
!memcmp(b->options, bootp_magic_cookie, BOOTP_MAGIC_COOKIE_LEN)) {
ptr = &b->options[BOOTP_MAGIC_COOKIE_LEN];
while (ptr < end && *ptr != 0xff) {
opt = ptr++;
if (*opt == 0) {
continue;
}
ptr += *ptr + 1;
if (ptr >= end) {
break;
}
if (*opt == DHCP_OPT_MSGTYPE) {
if (opt[1]) {
return TRUE;
}
}
}
}
return FALSE;
}
static bool
dhd_is_icmp_pkt(dhd_pub_t *dhd, uint8 *pktdata, uint32 pktlen)
{
uint8 *pkt;
struct ipv4_hdr *iph;
pkt = (uint8 *)&pktdata[ETHER_HDR_LEN];
iph = (struct ipv4_hdr *)pkt;
/* check IP header */
if ((IPV4_HLEN(iph) < IPV4_HLEN_MIN) ||
IP_VER(iph) != IP_VER_4 ||
IPV4_PROT(iph) != IP_PROT_ICMP) {
return FALSE;
}
/* check header length */
if (ntohs(iph->tot_len) - IPV4_HLEN(iph) < sizeof(struct bcmicmp_hdr)) {
return FALSE;
}
return TRUE;
}
bool
dhd_match_pkt_type(dhd_pub_t *dhd, uint8 *pktdata, uint32 pktlen)
{
struct ether_header *eh;
uint16 ether_type;
bool match = FALSE;
if (!pktdata || pktlen < ETHER_HDR_LEN) {
return match;
}
eh = (struct ether_header *)pktdata;
ether_type = ntoh16(eh->ether_type);
if ((dhd->conf->enq_hdr_pkt & ENQ_PKT_TYPE_EAPOL) &&
ether_type == ETHER_TYPE_802_1X) {
match = dhd_is_eapol_pkt(dhd, pktdata, pktlen);
}
else if ((dhd->conf->enq_hdr_pkt & ENQ_PKT_TYPE_ARP) &&
ntoh16(eh->ether_type) == ETHER_TYPE_ARP) {
match = dhd_is_arp_pkt(dhd, pktdata);
}
else if (ntoh16(eh->ether_type) == ETHER_TYPE_IP) {
if (dhd->conf->enq_hdr_pkt & ENQ_PKT_TYPE_ICMP)
match = dhd_is_icmp_pkt(dhd, pktdata, pktlen);
if (!match && dhd->conf->enq_hdr_pkt & ENQ_PKT_TYPE_DHCP)
match = dhd_is_dhcp_pkt(dhd, pktdata);
}
return match;
}
#endif /* BCMPCIE */

View File

@@ -59,6 +59,9 @@ enum pkt_type {
extern msg_eapol_t dhd_is_4way_msg(uint8 *pktdata);
extern void dhd_dump_pkt(dhd_pub_t *dhd, int ifidx, uint8 *pktdata,
uint32 pktlen, bool tx, uint32 *pkthash, uint16 *pktfate);
#ifdef BCMPCIE
extern bool dhd_match_pkt_type(dhd_pub_t *dhd, uint8 *pktdata, uint32 pktlen);
#endif /* BCMPCIE */
#ifdef DHD_PKTDUMP_ROAM
extern void dhd_dump_mod_pkt_timer(dhd_pub_t *dhdp, uint16 rsn);
extern void dhd_dump_pkt_init(dhd_pub_t *dhdp);

View File

@@ -570,12 +570,12 @@ static int wifi_ctrlfunc_register_drv(void)
}
adapter->name = "DHD generic adapter";
adapter->index = -1;
#ifdef BCMDHD_MDRIVER
#if defined(BCMDHD_MDRIVER) && !defined(DHD_STATIC_IN_DRIVER)
#ifdef BCMSDIO
adapter->index = 0;
#elif BCMPCIE
#elif defined(BCMPCIE)
adapter->index = 1;
#elif BCMUSB
#elif defined(BCMDBUS)
adapter->index = 2;
#endif
#endif

View File

@@ -4156,10 +4156,11 @@ dhd_prot_init(dhd_pub_t *dhd)
* only if dongle does not support EDL
*/
#ifdef EWP_EDL
if (dhd->bus->api.fw_rev >= PCIE_SHARED_VERSION_6 && !dhd->dongle_edl_support) {
if (dhd->bus->api.fw_rev >= PCIE_SHARED_VERSION_6 && !dhd->dongle_edl_support)
#else
if (dhd->bus->api.fw_rev >= PCIE_SHARED_VERSION_6) {
if (dhd->bus->api.fw_rev >= PCIE_SHARED_VERSION_6)
#endif /* EWP_EDL */
{
if ((ret = dhd_prot_init_info_rings(dhd)) != BCME_OK) {
/* For now log and proceed, further clean up action maybe necessary
* when we have more clarity.
@@ -13650,8 +13651,9 @@ dhd_prot_debug_info_print(dhd_pub_t *dhd)
prot->device_ipc_version,
prot->host_ipc_version,
prot->active_ipc_version));
DHD_ERROR(("d2h_intr_method -> %s\n",
dhd->bus->d2h_intr_method ? "PCIE_MSI" : "PCIE_INTX"));
DHD_ERROR(("d2h_intr_method -> %s d2h_intr_control -> %s\n",
dhd->bus->d2h_intr_method ? "PCIE_MSI" : "PCIE_INTX",
dhd->bus->d2h_intr_control ? "HOST_IRQ" : "D2H_INTMASK"));
DHD_ERROR(("max Host TS bufs to post: %d, posted %d\n",
prot->max_tsbufpost, prot->cur_ts_bufs_posted));
DHD_ERROR(("max INFO bufs to post: %d, posted %d\n",

View File

@@ -102,6 +102,7 @@
#if defined(DHD_CONTROL_PCIE_CPUCORE_WIFI_TURNON)
#include <dhd_linux_priv.h>
#endif /* DHD_CONTROL_PCIE_CPUCORE_WIFI_TURNON */
#include <dhd_linux_pktdump.h>
#define EXTENDED_PCIE_DEBUG_DUMP 1 /* Enable Extended pcie registers dump */
@@ -1080,6 +1081,13 @@ int dhdpcie_bus_attach(osl_t *osh, dhd_bus_t **bus_ptr,
bus->d2h_intr_method = PCIE_INTX;
#endif /* DHD_MSI_SUPPORT */
/* For MSI, use host irq based control and for INTX use D2H INTMASK based control */
if (bus->d2h_intr_method == PCIE_MSI) {
bus->d2h_intr_control = PCIE_HOST_IRQ_CTRL;
} else {
bus->d2h_intr_control = PCIE_D2H_INTMASK_CTRL;
}
#ifdef DHD_HP2P
bus->hp2p_txcpl_max_items = DHD_MAX_ITEMS_HPP_TXCPL_RING;
bus->hp2p_rxcpl_max_items = DHD_MAX_ITEMS_HPP_RXCPL_RING;
@@ -1545,16 +1553,16 @@ skip_intstatus_read:
bus->isr_intr_disable_count++;
#ifdef CHIP_INTR_CONTROL
dhdpcie_bus_intr_disable(bus); /* Disable interrupt using IntMask!! */
#else
/* For Linux, Macos etc (otherthan NDIS) instead of disabling
* dongle interrupt by clearing the IntMask, disable directly
* interrupt from the host side, so that host will not recieve
* any interrupts at all, even though dongle raises interrupts
*/
dhdpcie_disable_irq_nosync(bus); /* Disable interrupt!! */
#endif /* HOST_INTR_CONTROL */
if (bus->d2h_intr_control == PCIE_D2H_INTMASK_CTRL) {
dhdpcie_bus_intr_disable(bus); /* Disable interrupt using IntMask!! */
} else {
/* For Linux, Macos etc (otherthan NDIS) instead of disabling
* dongle interrupt by clearing the IntMask, disable directly
* interrupt from the host side, so that host will not recieve
* any interrupts at all, even though dongle raises interrupts
*/
dhdpcie_disable_irq_nosync(bus); /* Disable interrupt!! */
}
bus->intdis = TRUE;
#ifdef DHD_FLOW_RING_STATUS_TRACE
@@ -1779,6 +1787,7 @@ dhdpcie_cc_watchdog_reset(dhd_bus_t *bus)
(WD_SSRESET_PCIE_F0_EN | WD_SSRESET_PCIE_ALL_FN_EN);
pcie_watchdog_reset(bus->osh, bus->sih, WD_ENABLE_MASK, wd_en);
}
void
dhdpcie_dongle_reset(dhd_bus_t *bus)
{
@@ -2358,7 +2367,11 @@ dhdpcie_dongle_attach(dhd_bus_t *bus)
bus->deep_sleep = TRUE;
#endif
#ifdef CUSTOMER_HW_ROCKCHIP
bus->idma_enabled = FALSE;
#else
bus->idma_enabled = TRUE;
#endif
bus->ifrm_enabled = TRUE;
#ifdef BCMINTERNAL
bus->dma_chan = 0;
@@ -2565,10 +2578,11 @@ dhdpcie_advertise_bus_cleanup(dhd_pub_t *dhdp)
timeleft = dhd_os_busbusy_wait_negation(dhdp, &dhdp->dhd_bus_busy_state);
#ifdef LINUX
if ((timeleft == 0) || (timeleft == 1)) {
if ((timeleft == 0) || (timeleft == 1))
#else
if (timeleft == 0) {
if (timeleft == 0)
#endif
{
/* XXX This condition ideally should not occur, this means some
* bus usage context is not clearing the respective usage bit, print
* dhd_bus_busy_state and crash the host for further debugging.
@@ -3553,6 +3567,11 @@ dhd_set_bus_params(struct dhd_bus *bus)
bus->pollrate = 1;
printf("%s: set polling mode %d\n", __FUNCTION__, bus->dhd->conf->dhd_poll);
}
if (bus->dhd->conf->d2h_intr_control >= 0)
bus->d2h_intr_control = bus->dhd->conf->d2h_intr_control;
printf("d2h_intr_method -> %s(%d); d2h_intr_control -> %s(%d)\n",
bus->d2h_intr_method ? "PCIE_MSI" : "PCIE_INTX", bus->d2h_intr_method,
bus->d2h_intr_control ? "HOST_IRQ" : "D2H_INTMASK", bus->d2h_intr_control);
}
/**
@@ -3977,6 +3996,118 @@ exit:
}
#endif /* BCMINTERNAL */
#ifdef DHD_LINUX_STD_FW_API
static int
dhdpcie_download_code_file(struct dhd_bus *bus, char *pfw_path)
{
int bcmerror = BCME_ERROR;
int offset = 0;
int len = 0;
bool store_reset;
int offset_end = bus->ramsize;
const struct firmware *fw = NULL;
int buf_offset = 0, residual_len = 0;
#ifdef CHECK_DOWNLOAD_FW
uint8 *memptr_tmp = NULL; // terence: check downloaded firmware is correct
#endif
#if defined(DHD_FW_MEM_CORRUPTION)
if (dhd_bus_get_fw_mode(bus->dhd) == DHD_FLAG_MFG_MODE) {
dhd_tcm_test_enable = TRUE;
} else {
dhd_tcm_test_enable = FALSE;
}
#endif /* DHD_FW_MEM_CORRUPTION */
DHD_ERROR(("%s: dhd_tcm_test_enable %u\n", __FUNCTION__, dhd_tcm_test_enable));
/* TCM check */
if (dhd_tcm_test_enable && !dhd_bus_tcm_test(bus)) {
DHD_ERROR(("dhd_bus_tcm_test failed\n"));
bcmerror = BCME_ERROR;
goto err;
}
DHD_ERROR(("%s: download firmware %s\n", __FUNCTION__, pfw_path));
/* check if CR4/CA7 */
store_reset = (si_setcore(bus->sih, ARMCR4_CORE_ID, 0) ||
si_setcore(bus->sih, ARMCA7_CORE_ID, 0));
bcmerror = dhd_os_get_img_fwreq(&fw, bus->fw_path);
if (bcmerror < 0) {
DHD_ERROR(("dhd_os_get_img(Request Firmware API) error : %d\n",
bcmerror));
goto err;
}
#ifdef CHECK_DOWNLOAD_FW
if (bus->dhd->conf->fwchk) {
memptr_tmp = MALLOC(bus->dhd->osh, MEMBLOCK + DHD_SDALIGN);
if (memptr_tmp == NULL) {
DHD_ERROR(("%s: Failed to allocate memory %d bytes\n", __FUNCTION__, MEMBLOCK));
goto err;
}
}
#endif
residual_len = fw->size;
while (residual_len) {
len = MIN(residual_len, MEMBLOCK);
/* if address is 0, store the reset instruction to be written in 0 */
if (store_reset) {
ASSERT(offset == 0);
bus->resetinstr = *(((uint32*)fw->data + buf_offset));
/* Add start of RAM address to the address given by user */
offset += bus->dongle_ram_base;
offset_end += offset;
store_reset = FALSE;
}
bcmerror = dhdpcie_bus_membytes(bus, TRUE, offset,
(uint8 *)fw->data + buf_offset, len);
if (bcmerror) {
DHD_ERROR(("%s: error %d on writing %d membytes at 0x%08x\n",
__FUNCTION__, bcmerror, MEMBLOCK, offset));
goto err;
}
#ifdef CHECK_DOWNLOAD_FW
if (bus->dhd->conf->fwchk) {
bcmerror = dhdpcie_bus_membytes(bus, FALSE, offset, memptr_tmp, len);
if (bcmerror) {
DHD_ERROR(("%s: error %d on reading %d membytes at 0x%08x\n",
__FUNCTION__, bcmerror, MEMBLOCK, offset));
goto err;
}
if (memcmp(memptr_tmp, (uint8 *)fw->data + buf_offset, len)) {
DHD_ERROR(("%s: Downloaded image is corrupted at 0x%08x\n", __FUNCTION__, offset));
bcmerror = BCME_ERROR;
goto err;
} else
DHD_INFO(("%s: Download, Upload and compare succeeded.\n", __FUNCTION__));
}
#endif
offset += MEMBLOCK;
if (offset >= offset_end) {
DHD_ERROR(("%s: invalid address access to %x (offset end: %x)\n",
__FUNCTION__, offset, offset_end));
bcmerror = BCME_ERROR;
goto err;
}
residual_len -= len;
buf_offset += len;
}
err:
#ifdef CHECK_DOWNLOAD_FW
if (memptr_tmp)
MFREE(bus->dhd->osh, memptr_tmp, MEMBLOCK + DHD_SDALIGN);
#endif
if (fw) {
dhd_os_close_img_fwreq(fw);
}
return bcmerror;
} /* dhdpcie_download_code_file */
#else
/**
* Downloads a file containing firmware into dongle memory. In case of a .bea file, the DHD
* is updated with the event logging partitions within that file as well.
@@ -4092,15 +4223,21 @@ dhdpcie_download_code_file(struct dhd_bus *bus, char *pfw_path)
goto err;
}
residual_len = total_len;
#endif /* CACHE_FW_IMAGE */
/* Download image with MEMBLOCK size */
while (residual_len) {
#if defined(CACHE_FW_IMAGES)
while (residual_len)
#else
/* Download image with MEMBLOCK size */
while ((len = dhd_os_get_image_block((char*)memptr, MEMBLOCK, imgbuf)))
#endif /* CACHE_FW_IMAGE */
{
#if defined(CACHE_FW_IMAGES)
len = MIN(residual_len, MEMBLOCK);
memcpy(memptr, dnld_buf + buf_offset, len);
residual_len -= len;
buf_offset += len;
#else
/* Download image with MEMBLOCK size */
while ((len = dhd_os_get_image_block((char*)memptr, MEMBLOCK, imgbuf))) {
if (len < 0) {
DHD_ERROR(("%s: dhd_os_get_image_block failed (%d)\n", __FUNCTION__, len));
bcmerror = BCME_ERROR;
@@ -4177,6 +4314,7 @@ err:
return bcmerror;
} /* dhdpcie_download_code_file */
#endif /* DHD_LINUX_STD_FW_API */
#ifdef CUSTOMER_HW4_DEBUG
#define MIN_NVRAMVARS_SIZE 128
@@ -4186,7 +4324,7 @@ static int
dhdpcie_download_nvram(struct dhd_bus *bus)
{
int bcmerror = BCME_ERROR;
uint len;
uint len, memblock_len = 0;
char * memblock = NULL;
char *bufp;
char *pnv_path;
@@ -4233,6 +4371,11 @@ dhdpcie_download_nvram(struct dhd_bus *bus)
} else {
nvram_uefi_exists = TRUE;
}
#ifdef DHD_LINUX_STD_FW_API
memblock_len = len;
#else
memblock_len = MAX_NVRAMBUF_SIZE;
#endif /* DHD_LINUX_STD_FW_API */
DHD_ERROR(("%s: dhd_get_download_buffer len %d\n", __FUNCTION__, len));
@@ -4293,7 +4436,7 @@ err:
if (local_alloc) {
MFREE(bus->dhd->osh, memblock, MAX_NVRAMBUF_SIZE);
} else {
dhd_free_download_buffer(bus->dhd, memblock, MAX_NVRAMBUF_SIZE);
dhd_free_download_buffer(bus->dhd, memblock, memblock_len);
}
}
@@ -5669,6 +5812,7 @@ BCMFASTPATH(dhd_bus_txdata)(struct dhd_bus *bus, void *txp, uint8 ifidx)
void *ntxp = NULL;
uint8 prio = PKTPRIO(txp);
#endif
uint8 *pktdata = (uint8 *)PKTDATA(bus->dhd->osh, txp);
if (!bus->dhd->flowid_allocator) {
DHD_ERROR(("%s: Flow ring not intited yet \n", __FUNCTION__));
@@ -5757,6 +5901,10 @@ BCMFASTPATH(dhd_bus_txdata)(struct dhd_bus *bus, void *txp, uint8 ifidx)
}
}
#else /* !(defined(BCM_ROUTER_DHD) && defined(HNDCTF)) */
if (dhd_match_pkt_type(bus->dhd, pktdata, (uint32)PKTLEN(bus->dhd->osh, txp))) {
if ((ret = dhd_flow_queue_enqueue_head(bus->dhd, queue, txp)) != BCME_OK)
txp_pend = txp;
} else
if ((ret = dhd_flow_queue_enqueue(bus->dhd, queue, txp)) != BCME_OK)
txp_pend = txp;
#endif /* defined(BCM_ROUTER_DHD) && defined(HNDCTF */
@@ -5794,6 +5942,13 @@ BCMFASTPATH(dhd_bus_txdata)(struct dhd_bus *bus, void *txp, uint8 ifidx)
}
}
#else /* !(defined(BCM_ROUTER_DHD) && defined(HNDCTF)) */
if (dhd_match_pkt_type(bus->dhd, pktdata, (uint32)PKTLEN(bus->dhd->osh, txp))) {
if ((ret = dhd_flow_queue_enqueue_head(bus->dhd, queue, txp_pend)) != BCME_OK) {
DHD_FLOWRING_UNLOCK(flow_ring_node->lock, flags);
txp = txp_pend;
goto toss;
}
} else
if ((ret = dhd_flow_queue_enqueue(bus->dhd, queue, txp_pend)) != BCME_OK) {
DHD_FLOWRING_UNLOCK(flow_ring_node->lock, flags);
txp = txp_pend;
@@ -9272,11 +9427,13 @@ dhd_bus_dump_dar_registers(struct dhd_bus *bus)
dar_erraddr_val = si_corereg(bus->sih, bus->sih->buscoreidx, dar_erraddr_reg, 0, 0);
dar_pcie_mbint_val = si_corereg(bus->sih, bus->sih->buscoreidx, dar_pcie_mbint_reg, 0, 0);
DHD_ERROR(("%s: dar_clk_ctrl(0x%x:0x%x) dar_pwr_ctrl(0x%x:0x%x) dar_intstat(0x%x:0x%x)\n",
DHD_RPM(("%s: dar_clk_ctrl(0x%x:0x%x) dar_pwr_ctrl(0x%x:0x%x) "
"dar_intstat(0x%x:0x%x)\n",
__FUNCTION__, dar_clk_ctrl_reg, dar_clk_ctrl_val,
dar_pwr_ctrl_reg, dar_pwr_ctrl_val, dar_intstat_reg, dar_intstat_val));
DHD_ERROR(("%s: dar_errlog(0x%x:0x%x) dar_erraddr(0x%x:0x%x) dar_pcie_mbint(0x%x:0x%x)\n",
DHD_RPM(("%s: dar_errlog(0x%x:0x%x) dar_erraddr(0x%x:0x%x) "
"dar_pcie_mbint(0x%x:0x%x)\n",
__FUNCTION__, dar_errlog_reg, dar_errlog_val,
dar_erraddr_reg, dar_erraddr_val, dar_pcie_mbint_reg, dar_pcie_mbint_val));
}
@@ -9294,7 +9451,7 @@ dhd_bus_hostready(struct dhd_bus *bus)
return;
}
DHD_ERROR(("%s : Read PCICMD Reg: 0x%08X\n", __FUNCTION__,
DHD_ERROR_MEM(("%s : Read PCICMD Reg: 0x%08X\n", __FUNCTION__,
dhd_pcie_config_read(bus, PCI_CFG_CMD, sizeof(uint32))));
dhd_bus_dump_dar_registers(bus);
@@ -9304,7 +9461,7 @@ dhd_bus_hostready(struct dhd_bus *bus)
#endif /* defined(DHD_MMIO_TRACE) */
si_corereg(bus->sih, bus->sih->buscoreidx, dhd_bus_db1_addr_get(bus), ~0, 0x12345678);
bus->hostready_count ++;
DHD_ERROR(("%s: Ring Hostready:%d\n", __FUNCTION__, bus->hostready_count));
DHD_ERROR_MEM(("%s: Ring Hostready:%d\n", __FUNCTION__, bus->hostready_count));
}
/* Clear INTSTATUS */
@@ -9345,7 +9502,6 @@ dhdpcie_bus_suspend(struct dhd_bus *bus, bool state)
uint32 zero = 0;
#endif /* DHD_PCIE_NATIVE_RUNTIMEPM */
printf("%s: state=%d\n", __FUNCTION__, state);
if (bus->dhd == NULL) {
DHD_ERROR(("%s: bus not inited\n", __FUNCTION__));
return BCME_ERROR;
@@ -9396,7 +9552,7 @@ dhdpcie_bus_suspend(struct dhd_bus *bus, bool state)
}
/* Suspend */
DHD_ERROR(("%s: Entering suspend state\n", __FUNCTION__));
DHD_RPM(("%s: Entering suspend state\n", __FUNCTION__));
bus->dhd->dhd_watchdog_ms_backup = dhd_watchdog_ms;
if (bus->dhd->dhd_watchdog_ms_backup) {
@@ -9546,7 +9702,7 @@ dhdpcie_bus_suspend(struct dhd_bus *bus, bool state)
#endif /* OEM_ANDROID */
if (bus->wait_for_d3_ack) {
DHD_ERROR(("%s: Got D3 Ack \n", __FUNCTION__));
DHD_RPM(("%s: Got D3 Ack \n", __FUNCTION__));
/* Got D3 Ack. Suspend the bus */
#ifdef OEM_ANDROID
if (active) {
@@ -9808,7 +9964,7 @@ dhdpcie_bus_suspend(struct dhd_bus *bus, bool state)
#endif /* PCIE_OOB */
} else {
/* Resume */
DHD_ERROR(("%s: Entering resume state\n", __FUNCTION__));
DHD_RPM(("%s: Entering resume state\n", __FUNCTION__));
bus->last_resume_start_time = OSL_LOCALTIME_NS();
/**
@@ -11219,7 +11375,7 @@ dhdpcie_pme_active(osl_t *osh, bool enable)
}
pme_csr = OSL_PCI_READ_CONFIG(osh, cap_ptr + PME_CSR_OFFSET, sizeof(uint32));
DHD_ERROR(("%s : pme_sts_ctrl 0x%x\n", __FUNCTION__, pme_csr));
DHD_RPM(("%s : pme_sts_ctrl 0x%x\n", __FUNCTION__, pme_csr));
pme_csr |= PME_CSR_PME_STAT;
if (enable) {
@@ -11713,8 +11869,9 @@ void dhd_bus_dump(dhd_pub_t *dhdp, struct bcmstrbuf *strbuf)
dhdp->bus->inband_host_sleep_exit_to_cnt);
}
#endif /* PCIE_INB_DW */
bcm_bprintf(strbuf, "d2h_intr_method -> %s\n",
dhdp->bus->d2h_intr_method ? "PCIE_MSI" : "PCIE_INTX");
bcm_bprintf(strbuf, "d2h_intr_method -> %s d2h_intr_control -> %s\n",
dhdp->bus->d2h_intr_method ? "PCIE_MSI" : "PCIE_INTX",
dhdp->bus->d2h_intr_control ? "HOST_IRQ" : "D2H_INTMASK");
bcm_bprintf(strbuf, "\n\nDB7 stats - db7_send_cnt: %d, db7_trap_cnt: %d, "
"max duration: %lld (%lld - %lld), db7_timing_error_cnt: %d\n",
@@ -12303,7 +12460,7 @@ dhdpcie_bus_ringbell_fast(struct dhd_bus *bus, uint32 value)
{
/* Skip once bus enters low power state (D3_INFORM/D3_ACK) */
if (__DHD_CHK_BUS_IN_LPS(bus)) {
DHD_ERROR(("%s: trying to ring the doorbell after D3 inform %d\n",
DHD_RPM(("%s: trying to ring the doorbell after D3 inform %d\n",
__FUNCTION__, bus->bus_low_power_state));
return;
}
@@ -12347,7 +12504,7 @@ dhdpcie_bus_ringbell_2_fast(struct dhd_bus *bus, uint32 value, bool devwake)
{
/* Skip once bus enters low power state (D3_INFORM/D3_ACK) */
if (__DHD_CHK_BUS_IN_LPS(bus)) {
DHD_ERROR(("%s: trying to ring the doorbell after D3 inform %d\n",
DHD_RPM(("%s: trying to ring the doorbell after D3 inform %d\n",
__FUNCTION__, bus->bus_low_power_state));
return;
}
@@ -12488,18 +12645,18 @@ BCMFASTPATH(dhd_bus_dpc)(struct dhd_bus *bus)
#ifdef DHD_READ_INTSTATUS_IN_DPC
INTR_ON:
#endif /* DHD_READ_INTSTATUS_IN_DPC */
#ifdef CHIP_INTR_CONTROL
dhdpcie_bus_intr_enable(bus); /* Enable back interrupt using Intmask!! */
bus->dpc_intr_enable_count++;
#else
/* For Linux, Macos etc (otherthan NDIS) enable back the host interrupts
* which has been disabled in the dhdpcie_bus_isr()
*/
if ((dhdpcie_irq_disabled(bus)) && (!dhd_query_bus_erros(bus->dhd))) {
dhdpcie_enable_irq(bus); /* Enable back interrupt!! */
if (bus->d2h_intr_control == PCIE_D2H_INTMASK_CTRL) {
dhdpcie_bus_intr_enable(bus); /* Enable back interrupt using Intmask!! */
bus->dpc_intr_enable_count++;
} else {
/* For Linux, Macos etc (otherthan NDIS) enable back the host interrupts
* which has been disabled in the dhdpcie_bus_isr()
*/
if ((dhdpcie_irq_disabled(bus)) && (!dhd_query_bus_erros(bus->dhd))) {
dhdpcie_enable_irq(bus); /* Enable back interrupt!! */
bus->dpc_intr_enable_count++;
}
}
#endif /* HOST_INTR_CONTROL */
bus->dpc_exit_time = OSL_LOCALTIME_NS();
} else {
bus->resched_dpc_time = OSL_LOCALTIME_NS();
@@ -12621,7 +12778,7 @@ dhd_bus_handle_d3_ack(dhd_bus_t *bus)
#endif /* !NDIS */
DHD_SET_BUS_LPS_D3_ACKED(bus);
DHD_ERROR(("%s: D3_ACK Recieved\n", __FUNCTION__));
DHD_RPM(("%s: D3_ACK Recieved\n", __FUNCTION__));
if (bus->dhd->dhd_induce_error == DHD_INDUCE_D3_ACK_TIMEOUT) {
/* Set bus_low_power_state to DHD_BUS_D3_ACK_RECIEVED */
@@ -12639,6 +12796,7 @@ dhd_bus_handle_d3_ack(dhd_bus_t *bus)
DHD_ERROR(("%s: Inducing D3 ACK timeout\n", __FUNCTION__));
}
}
void
dhd_bus_handle_mb_data(dhd_bus_t *bus, uint32 d2h_mb_data)
{
@@ -13125,7 +13283,7 @@ dhdpci_bus_read_frames(dhd_bus_t *bus)
/* Do not process rest of ring buf once bus enters low power state (D3_INFORM/D3_ACK) */
if (DHD_CHK_BUS_IN_LPS(bus)) {
DHD_ERROR(("%s: Bus is in power save state (%d). "
DHD_RPM(("%s: Bus is in power save state (%d). "
"Skip processing rest of ring buffers.\n",
__FUNCTION__, bus->bus_low_power_state));
return FALSE;
@@ -15561,7 +15719,7 @@ dhd_get_rpm_state(dhd_pub_t *dhd)
void
dhd_set_rpm_state(dhd_pub_t *dhd, bool state)
{
DHD_ERROR(("%s: %d\n", __FUNCTION__, state));
DHD_RPM(("%s: %d\n", __FUNCTION__, state));
dhd->bus->rpm_enabled = state;
}

View File

@@ -402,6 +402,7 @@ typedef struct dhd_bus {
#endif /* PCIE_OOB */
bool irq_registered;
bool d2h_intr_method;
bool d2h_intr_control;
#ifdef SUPPORT_LINKDOWN_RECOVERY
#if defined(CONFIG_ARCH_MSM) || (defined(CONFIG_ARCH_EXYNOS) && \
!defined(SUPPORT_EXYNOS7420))
@@ -601,6 +602,11 @@ enum {
PCIE_MSI = 1
};
enum {
PCIE_D2H_INTMASK_CTRL = 0,
PCIE_HOST_IRQ_CTRL = 1
};
static INLINE bool
__dhd_check_bus_in_lps(dhd_bus_t *bus)
{

View File

@@ -47,7 +47,9 @@
#include <pcicfg.h>
#include <dhd_pcie.h>
#include <dhd_linux.h>
#ifdef CUSTOMER_HW_ROCKCHIP
#include <rk_dhd_pcie_linux.h>
#endif /* CUSTOMER_HW_ROCKCHIP */
#ifdef OEM_ANDROID
#ifdef CONFIG_ARCH_MSM
#if defined(CONFIG_PCI_MSM) || defined(CONFIG_ARCH_MSM8996)
@@ -618,8 +620,10 @@ dhd_bus_is_rc_ep_l1ss_capable(dhd_bus_t *bus)
uint32 rc_l1ss_cap;
uint32 ep_l1ss_cap;
#ifdef CUSTOMER_HW_ROCKCHIP
if (IS_ENABLED(CONFIG_PCIEASPM_ROCKCHIP_WIFI_EXTENSION))
return rk_dhd_bus_is_rc_ep_l1ss_capable(bus);
#endif
/* RC Extendend Capacility */
rc_l1ss_cap = dhdpcie_access_cap(bus->rc_dev, PCIE_EXTCAP_ID_L1SS,
PCIE_EXTCAP_L1SS_CONTROL_OFFSET, TRUE, FALSE, 0);
@@ -707,7 +711,9 @@ static int dhdpcie_pm_suspend(struct device *dev)
dhdpcie_info_t *pch = pci_get_drvdata(pdev);
dhd_bus_t *bus = NULL;
unsigned long flags;
int msglevel = dhd_msg_level;
printf("%s: Enter\n", __FUNCTION__);
if (pch) {
bus = pch->bus;
}
@@ -725,12 +731,15 @@ static int dhdpcie_pm_suspend(struct device *dev)
DHD_BUS_BUSY_SET_SUSPEND_IN_PROGRESS(bus->dhd);
DHD_GENERAL_UNLOCK(bus->dhd, flags);
dhd_msg_level |= DHD_RPM_VAL;
if (bus->dhd->up)
ret = dhdpcie_set_suspend_resume(bus, TRUE);
DHD_GENERAL_LOCK(bus->dhd, flags);
DHD_BUS_BUSY_CLEAR_SUSPEND_IN_PROGRESS(bus->dhd);
dhd_os_busbusy_wake(bus->dhd);
dhd_msg_level = msglevel;
printf("%s: Exit ret=%d\n", __FUNCTION__, ret);
DHD_GENERAL_UNLOCK(bus->dhd, flags);
return ret;
@@ -761,7 +770,9 @@ static int dhdpcie_pm_resume(struct device *dev)
dhdpcie_info_t *pch = pci_get_drvdata(pdev);
dhd_bus_t *bus = NULL;
unsigned long flags;
int msglevel = dhd_msg_level;
printf("%s: Enter\n", __FUNCTION__);
if (pch) {
bus = pch->bus;
}
@@ -773,12 +784,15 @@ static int dhdpcie_pm_resume(struct device *dev)
DHD_BUS_BUSY_SET_RESUME_IN_PROGRESS(bus->dhd);
DHD_GENERAL_UNLOCK(bus->dhd, flags);
dhd_msg_level |= DHD_RPM_VAL;
if (bus->dhd->up)
ret = dhdpcie_set_suspend_resume(bus, FALSE);
DHD_GENERAL_LOCK(bus->dhd, flags);
DHD_BUS_BUSY_CLEAR_RESUME_IN_PROGRESS(bus->dhd);
dhd_os_busbusy_wake(bus->dhd);
dhd_msg_level = msglevel;
printf("%s: Exit ret=%d\n", __FUNCTION__, ret);
DHD_GENERAL_UNLOCK(bus->dhd, flags);
return ret;
@@ -809,6 +823,7 @@ static int dhdpcie_pci_suspend(struct pci_dev * pdev, pm_message_t state)
unsigned long flags;
uint32 i = 0;
printf("%s: Enter\n", __FUNCTION__);
if (pch) {
bus = pch->bus;
}
@@ -861,6 +876,7 @@ static int dhdpcie_pci_suspend(struct pci_dev * pdev, pm_message_t state)
DHD_GENERAL_LOCK(bus->dhd, flags);
DHD_BUS_BUSY_CLEAR_SUSPEND_IN_PROGRESS(bus->dhd);
dhd_os_busbusy_wake(bus->dhd);
printf("%s: Exit ret=%d\n", __FUNCTION__, ret);
DHD_GENERAL_UNLOCK(bus->dhd, flags);
return ret;
@@ -925,6 +941,7 @@ static int dhdpcie_pci_resume(struct pci_dev *pdev)
dhd_bus_t *bus = NULL;
unsigned long flags;
printf("%s: Enter\n", __FUNCTION__);
if (pch) {
bus = pch->bus;
}
@@ -942,6 +959,7 @@ static int dhdpcie_pci_resume(struct pci_dev *pdev)
DHD_GENERAL_LOCK(bus->dhd, flags);
DHD_BUS_BUSY_CLEAR_RESUME_IN_PROGRESS(bus->dhd);
dhd_os_busbusy_wake(bus->dhd);
printf("%s: Exit ret=%d\n", __FUNCTION__, ret);
DHD_GENERAL_UNLOCK(bus->dhd, flags);
#ifdef DHD_CFG80211_SUSPEND_RESUME
@@ -970,6 +988,7 @@ dhdpcie_set_suspend_resume(dhd_bus_t *bus, bool state)
}
mutex_lock(&bus->pm_lock);
#endif /* DHD_PCIE_RUNTIMEPM */
DHD_RPM(("%s: Enter state=%d\n", __FUNCTION__, state));
/* When firmware is not loaded do the PCI bus */
/* suspend/resume only */
@@ -999,6 +1018,7 @@ dhdpcie_set_suspend_resume(dhd_bus_t *bus, bool state)
}
}
#endif /* LINUX_VERSION_CODE > 4.19.0 && DHD_TCP_LIMIT_OUTPUT */
DHD_RPM(("%s: Exit ret=%d\n", __FUNCTION__, ret));
#ifdef DHD_PCIE_RUNTIMEPM
mutex_unlock(&bus->pm_lock);
@@ -1117,7 +1137,7 @@ extern void dhd_dpc_tasklet_kill(dhd_pub_t *dhdp);
static void
dhdpcie_suspend_dump_cfgregs(struct dhd_bus *bus, char *suspend_state)
{
DHD_ERROR(("%s: BaseAddress0(0x%x)=0x%x, "
DHD_RPM(("%s: BaseAddress0(0x%x)=0x%x, "
"BaseAddress1(0x%x)=0x%x PCIE_CFG_PMCSR(0x%x)=0x%x "
"PCI_BAR1_WIN(0x%x)=(0x%x)\n",
suspend_state,
@@ -1147,7 +1167,7 @@ static int dhdpcie_suspend_dev(struct pci_dev *dev)
return BCME_ERROR;
}
#endif /* OEM_ANDROID && LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0) */
DHD_ERROR(("%s: Enter\n", __FUNCTION__));
DHD_RPM(("%s: Enter\n", __FUNCTION__));
#if defined(CONFIG_SOC_EXYNOS9810) || defined(CONFIG_SOC_EXYNOS9820) || \
defined(CONFIG_SOC_EXYNOS9830) || defined(CONFIG_SOC_EXYNOS2100) || \
defined(CONFIG_SOC_EXYNOS1000)
@@ -1218,7 +1238,7 @@ static int dhdpcie_resume_dev(struct pci_dev *dev)
#if defined(OEM_ANDROID) && (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0))
pci_load_and_free_saved_state(dev, &pch->state);
#endif /* OEM_ANDROID && LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0) */
DHD_ERROR(("%s: Enter\n", __FUNCTION__));
DHD_RPM(("%s: Enter\n", __FUNCTION__));
#ifdef OEM_ANDROID
// dev->state_saved = TRUE;
#endif /* OEM_ANDROID */
@@ -1953,12 +1973,12 @@ void dhdpcie_dump_resource(dhd_bus_t *bus)
}
/* BAR0 */
DHD_ERROR(("%s: BAR0(VA): 0x%pK, BAR0(PA): "PRINTF_RESOURCE", SIZE: %d\n",
DHD_RPM(("%s: BAR0(VA): 0x%pK, BAR0(PA): "PRINTF_RESOURCE", SIZE: %d\n",
__FUNCTION__, pch->regs, pci_resource_start(bus->dev, 0),
DONGLE_REG_MAP_SIZE));
/* BAR1 */
DHD_ERROR(("%s: BAR1(VA): 0x%pK, BAR1(PA): "PRINTF_RESOURCE", SIZE: %d\n",
DHD_RPM(("%s: BAR1(VA): 0x%pK, BAR1(PA): "PRINTF_RESOURCE", SIZE: %d\n",
__FUNCTION__, pch->tcm, pci_resource_start(bus->dev, 2),
pch->bar1_size));
}
@@ -2393,14 +2413,15 @@ dhdpcie_enable_irq(dhd_bus_t *bus)
int
dhdpcie_irq_disabled(dhd_bus_t *bus)
{
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0))
struct irq_desc *desc = irq_to_desc(bus->dev->irq);
struct irq_desc *desc = NULL;
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 11, 0))
desc = irq_data_to_desc(irq_get_irq_data(bus->dev->irq));
#else
desc = irq_to_desc(bus->dev->irq);
#endif // (LINUX_VERSION_CODE < KERNEL_VERSION(5, 11, 0))
/* depth will be zero, if enabled */
return desc->depth;
#else
/* return ERROR by default as there is no support for lower versions */
return BCME_ERROR;
#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0) */
}
#if defined(CONFIG_ARCH_EXYNOS)
@@ -3137,7 +3158,7 @@ bool dhd_runtimepm_state(dhd_pub_t *dhd)
bus->idlecount = 0;
if (DHD_BUS_BUSY_CHECK_IDLE(dhd) && !DHD_BUS_CHECK_DOWN_OR_DOWN_IN_PROGRESS(dhd) &&
!DHD_CHECK_CFG_IN_PROGRESS(dhd) && !dhd_os_check_wakelock_all(bus->dhd)) {
DHD_ERROR(("%s: DHD Idle state!! - idletime :%d, wdtick :%d \n",
DHD_RPM(("%s: DHD Idle state!! - idletime :%d, wdtick :%d \n",
__FUNCTION__, bus->idletime, dhd_runtimepm_ms));
bus->bus_wake = 0;
DHD_BUS_BUSY_SET_RPM_SUSPEND_IN_PROGRESS(dhd);
@@ -3216,7 +3237,7 @@ bool dhd_runtimepm_state(dhd_pub_t *dhd)
smp_wmb();
wake_up(&bus->rpm_queue);
DHD_ERROR(("%s : runtime resume ended \n", __FUNCTION__));
DHD_RPM(("%s : runtime resume ended \n", __FUNCTION__));
return TRUE;
} else {
DHD_GENERAL_UNLOCK(dhd, flags);
@@ -3257,7 +3278,8 @@ bool dhd_runtime_bus_wake(dhd_bus_t *bus, bool wait, void *func_addr)
DHD_GENERAL_UNLOCK(bus->dhd, flags);
DHD_ERROR_RLMT(("Runtime Resume is called in %pf\n", func_addr));
if (dhd_msg_level & DHD_RPM_VAL)
DHD_ERROR_RLMT(("%s: Runtime Resume is called in %pf\n", __FUNCTION__, func_addr));
smp_wmb();
wake_up(&bus->rpm_queue);
/* No need to wake up the RPM state thread */

View File

@@ -3389,7 +3389,7 @@ dhd_bus_rxctl(struct dhd_bus *bus, uchar *msg, uint msglen)
if (bus->dhd->conf->rxcnt_timeout)
max_rxcnt = bus->dhd->conf->rxcnt_timeout;
else
else
max_rxcnt = MAX_CNTL_RX_TIMEOUT;
if (bus->dhd->rxcnt_timeout >= max_rxcnt) {
#ifdef DHD_PM_CONTROL_FROM_FILE
@@ -3868,6 +3868,57 @@ xfer_done:
return bcmerror;
}
#if defined(BCMSDIO_RXLIM_POST) || defined(BCMSDIO_TXSEQ_SYNC)
static void
dhdsdio_txseq_sync(dhd_bus_t *bus, sdpcm_shared_t *sh)
{
struct dhd_conf *conf = bus->dhd->conf;
if (sh->flags & SDPCM_SHARED_RXLIM_POST) {
#ifdef BCMSDIO_RXLIM_POST
if (conf->rxlim_en) {
if (sh->msgtrace_addr) {
bus->rxlim_en = TRUE;
bus->rxlim_addr = sh->msgtrace_addr;
DHD_INFO(("%s: RXLIM_POST enabled with rxlim_addr=0x%x\n",
__FUNCTION__, bus->rxlim_addr));
} else {
DHD_INFO(("%s: RXLIM_POST not enabled in fw\n", __FUNCTION__));
}
} else
#endif /* BCMSDIO_RXLIM_POST */
#ifdef BCMSDIO_TXSEQ_SYNC
if (conf->txseq_sync) {
uint8 val = 0;
sh->txseq_sync_addr = ltoh32(sh->txseq_sync_addr);
DHD_INFO(("%s: TXSEQ_SYNC enabled\n", __FUNCTION__));
if (0 == dhdsdio_membytes(bus, FALSE, sh->txseq_sync_addr, (uint8 *)&val, 1)) {
if (bus->tx_seq != val) {
DHD_INFO(("%s: Sync tx_seq from %d to %d\n",
__FUNCTION__, bus->tx_seq, val));
bus->tx_seq = val;
bus->tx_max = bus->tx_seq + 4;
}
}
} else
#endif /* BCMSDIO_TXSEQ_SYNC */
{
DHD_INFO(("%s: rxlim_en and txseq_sync not enabled in config.txt\n", __FUNCTION__));
}
sh->flags &= ~SDPCM_SHARED_RXLIM_POST;
}
else {
#ifdef BCMSDIO_RXLIM_POST
bus->rxlim_en = 0;
#endif /* BCMSDIO_RXLIM_POST */
#ifdef BCMSDIO_TXSEQ_SYNC
conf->txseq_sync = FALSE;
#endif /* BCMSDIO_TXSEQ_SYNC */
DHD_INFO(("%s: TXSEQ_SYNC and RXLIM_POST not supported in fw\n", __FUNCTION__));
}
}
#endif /* BCMSDIO_RXLIM_POST || BCMSDIO_TXSEQ_SYNC */
static int
dhdsdio_readshared(dhd_bus_t *bus, sdpcm_shared_t *sh)
{
@@ -3934,41 +3985,9 @@ dhdsdio_readshared(dhd_bus_t *bus, sdpcm_shared_t *sh)
sh->console_addr = ltoh32(sh->console_addr);
sh->msgtrace_addr = ltoh32(sh->msgtrace_addr);
#ifdef BCMSDIO_RXLIM_POST
if (sh->flags & SDPCM_SHARED_RXLIM_POST) {
if (bus->dhd->conf->rxlim_en)
bus->rxlim_en = !!sh->msgtrace_addr;
bus->rxlim_addr = sh->msgtrace_addr;
DHD_INFO(("%s: rxlim_en=%d, rxlim enable=%d, rxlim_addr=%d\n",
__FUNCTION__,
bus->dhd->conf->rxlim_en, bus->rxlim_en, bus->rxlim_addr));
sh->flags &= ~SDPCM_SHARED_RXLIM_POST;
} else {
bus->rxlim_en = 0;
DHD_INFO(("%s: FW has no rx limit post support\n", __FUNCTION__));
}
#endif /* BCMSDIO_RXLIM_POST */
#ifdef BCMSDIO_TXSEQ_SYNC
if (bus->dhd->conf->txseq_sync) {
sh->txseq_sync_addr = ltoh32(sh->txseq_sync_addr);
if (sh->flags & SDPCM_SHARED_TXSEQ_SYNC) {
uint8 val = 0;
DHD_INFO(("%s: TXSEQ_SYNC enabled in fw\n", __FUNCTION__));
if (0 == dhdsdio_membytes(bus, FALSE, sh->txseq_sync_addr, (uint8 *)&val, 1)) {
if (bus->tx_seq != val) {
DHD_INFO(("%s: Sync tx_seq from %d to %d\n",
__FUNCTION__, bus->tx_seq, val));
bus->tx_seq = val;
bus->tx_max = bus->tx_seq + 4;
}
}
sh->flags &= ~SDPCM_SHARED_TXSEQ_SYNC;
} else {
bus->dhd->conf->txseq_sync = FALSE;
}
}
#endif /* BCMSDIO_TXSEQ_SYNC */
#if defined(BCMSDIO_RXLIM_POST) || defined(BCMSDIO_TXSEQ_SYNC)
dhdsdio_txseq_sync(bus, sh);
#endif
/*
* XXX - Allow a sdpcm_shared_t version mismatch between dhd structure
@@ -8217,7 +8236,7 @@ dhd_bus_dump_txpktstatics(dhd_pub_t *dhdp)
printk("\n");
printk(KERN_CONT DHD_LOG_PREFIXS);
}
}
}
printk("\n");
printk(KERN_CONT DHD_LOG_PREFIXS);
for (i=0;i<bus->tx_statics.glom_max;i++) {
@@ -8240,7 +8259,7 @@ dhd_bus_dump_txpktstatics(dhd_pub_t *dhdp)
printk("\n");
printk(KERN_CONT DHD_LOG_PREFIXS);
}
}
}
printk("\n");
if (total) {
printf("%s: data(%d)/glom(%d)=%d, glom_max=%d\n",
@@ -8257,7 +8276,7 @@ dhd_bus_dump_txpktstatics(dhd_pub_t *dhdp)
printk(KERN_CONT DHD_LOG_PREFIXS);
for (i=0; i<10; i++) {
printk(KERN_CONT "[%d]: %d, ", i, dhdp->conf->kso_try_array[i]);
}
}
printk("\n");
#endif
}
@@ -8609,6 +8628,13 @@ int dhd_bus_get_oob_irq_num(dhd_pub_t *dhdp)
return irq_num;
}
#ifdef LINUX
struct device *dhd_bus_to_dev(struct dhd_bus *bus)
{
return (struct device *)bcmsdh_get_dev(bus->sdh);
}
#endif /* LINUX */
void dhd_bus_dev_pm_stay_awake(dhd_pub_t *dhdpub)
{
#ifdef LINUX
@@ -10057,6 +10083,7 @@ dhdsdio_suspend(void *context)
/* resume all interface network queue. */
dhd_txflowcontrol(bus->dhd, ALL_INTERFACES, OFF);
}
bus->dhd->hostsleep = 2;
DHD_BUS_BUSY_CLEAR_SUSPEND_IN_PROGRESS(bus->dhd);
dhd_os_busbusy_wake(bus->dhd);
DHD_LINUX_GENERAL_UNLOCK(bus->dhd, flags);
@@ -10088,6 +10115,7 @@ dhdsdio_resume(void *context)
DHD_LINUX_GENERAL_LOCK(bus->dhd, flags);
DHD_BUS_BUSY_CLEAR_RESUME_IN_PROGRESS(bus->dhd);
bus->dhd->hostsleep = 0;
bus->dhd->busstate = DHD_BUS_DATA;
dhd_os_busbusy_wake(bus->dhd);
/* resume all interface network queue. */
@@ -10228,6 +10256,144 @@ err:
}
#endif /* BCMEMBEDIMAGE */
#ifdef DHD_LINUX_STD_FW_API
static int
dhdsdio_download_code_file(struct dhd_bus *bus, char *pfw_path)
{
int bcmerror = -1;
int offset = 0;
int len;
uint8 *memblock = NULL, *memptr;
#ifdef CHECK_DOWNLOAD_FW
uint8 *memptr_tmp = NULL; // terence: check downloaded firmware is correct
#endif
uint memblock_size = MEMBLOCK;
#ifdef DHD_DEBUG_DOWNLOADTIME
unsigned long initial_jiffies = 0;
uint firmware_sz = 0;
#endif
int offset_end = bus->ramsize;
const struct firmware *fw = NULL;
int buf_offset = 0, residual_len = 0;
DHD_INFO(("%s: download firmware %s\n", __FUNCTION__, pfw_path));
/* XXX: Should succeed in opening image if it is actually given through registry
* entry or in module param.
*/
bcmerror = dhd_os_get_img_fwreq(&fw, bus->fw_path);
if (bcmerror < 0) {
DHD_ERROR(("dhd_os_get_img(Request Firmware API) error : %d\n",
bcmerror));
goto err;
}
residual_len = fw->size;
/* Update the dongle image download block size depending on the F1 block size */
#ifndef NDIS
if (sd_f1_blocksize == 512)
memblock_size = MAX_MEMBLOCK;
#endif /* !NDIS */
memptr = memblock = MALLOC(bus->dhd->osh, memblock_size + DHD_SDALIGN);
if (memblock == NULL) {
DHD_ERROR(("%s: Failed to allocate memory %d bytes\n", __FUNCTION__,
memblock_size));
goto err;
}
if ((uint32)(uintptr)memblock % DHD_SDALIGN)
memptr += (DHD_SDALIGN - ((uint32)(uintptr)memblock % DHD_SDALIGN));
#ifdef CHECK_DOWNLOAD_FW
if (bus->dhd->conf->fwchk) {
memptr_tmp = MALLOC(bus->dhd->osh, MEMBLOCK + DHD_SDALIGN);
if (memptr_tmp == NULL) {
DHD_ERROR(("%s: Failed to allocate memory %d bytes\n", __FUNCTION__, MEMBLOCK));
goto err;
}
}
#endif
#ifdef DHD_DEBUG_DOWNLOADTIME
initial_jiffies = jiffies;
#endif
/* Download image */
while (residual_len) {
len = MIN(residual_len, memblock_size);
bcopy((uint8 *)fw->data + buf_offset, (uint8 *)memptr, len);
/* check if CR4 */
if (si_setcore(bus->sih, ARMCR4_CORE_ID, 0)) {
/* if address is 0, store the reset instruction to be written in 0 */
if (offset == 0) {
bus->resetinstr = *(((uint32*)memptr));
/* Add start of RAM address to the address given by user */
offset += bus->dongle_ram_base;
offset_end += offset;
}
}
bcmerror = dhdsdio_membytes(bus, TRUE, offset, (uint8 *)memptr, len);
if (bcmerror) {
DHD_ERROR(("%s: error %d on writing %d membytes at 0x%08x\n",
__FUNCTION__, bcmerror, memblock_size, offset));
goto err;
}
#ifdef CHECK_DOWNLOAD_FW
if (bus->dhd->conf->fwchk) {
bcmerror = dhdsdio_membytes(bus, FALSE, offset, memptr_tmp, len);
if (bcmerror) {
DHD_ERROR(("%s: error %d on reading %d membytes at 0x%08x\n",
__FUNCTION__, bcmerror, MEMBLOCK, offset));
goto err;
}
if (memcmp(memptr_tmp, memptr, len)) {
DHD_ERROR(("%s: Downloaded image is corrupted at 0x%08x\n", __FUNCTION__, offset));
bcmerror = BCME_ERROR;
goto err;
} else
DHD_INFO(("%s: Download, Upload and compare succeeded.\n", __FUNCTION__));
}
#endif
offset += memblock_size;
#ifdef DHD_DEBUG_DOWNLOADTIME
firmware_sz += len;
#endif
if (offset >= offset_end) {
DHD_ERROR(("%s: invalid address access to %x (offset end: %x)\n",
__FUNCTION__, offset, offset_end));
bcmerror = BCME_ERROR;
goto err;
}
residual_len -= len;
buf_offset += len;
}
#ifdef DHD_DEBUG_DOWNLOADTIME
DHD_ERROR(("Firmware download time for %u bytes: %u ms\n",
firmware_sz, jiffies_to_msecs(jiffies - initial_jiffies)));
#endif
err:
if (memblock)
MFREE(bus->dhd->osh, memblock, memblock_size + DHD_SDALIGN);
#ifdef CHECK_DOWNLOAD_FW
if (bus->dhd->conf->fwchk) {
if (memptr_tmp)
MFREE(bus->dhd->osh, memptr_tmp, MEMBLOCK + DHD_SDALIGN);
}
#endif
if (fw) {
dhd_os_close_img_fwreq(fw);
}
return bcmerror;
}
#else
static int
dhdsdio_download_code_file(struct dhd_bus *bus, char *pfw_path)
{
@@ -10268,6 +10434,9 @@ dhdsdio_download_code_file(struct dhd_bus *bus, char *pfw_path)
memblock_size));
goto err;
}
if ((uint32)(uintptr)memblock % DHD_SDALIGN)
memptr += (DHD_SDALIGN - ((uint32)(uintptr)memblock % DHD_SDALIGN));
#ifdef CHECK_DOWNLOAD_FW
if (bus->dhd->conf->fwchk) {
memptr_tmp = MALLOC(bus->dhd->osh, MEMBLOCK + DHD_SDALIGN);
@@ -10277,8 +10446,6 @@ dhdsdio_download_code_file(struct dhd_bus *bus, char *pfw_path)
}
}
#endif
if ((uint32)(uintptr)memblock % DHD_SDALIGN)
memptr += (DHD_SDALIGN - ((uint32)(uintptr)memblock % DHD_SDALIGN));
#ifdef DHD_DEBUG_DOWNLOADTIME
initial_jiffies = jiffies;
@@ -10360,6 +10527,7 @@ err:
return bcmerror;
}
#endif /* DHD_LINUX_STD_FW_API */
#ifdef DHD_UCODE_DOWNLOAD
/* Currently supported only for the chips in which ucode RAM is AXI addressable */
@@ -10495,8 +10663,7 @@ static int
dhdsdio_download_nvram(struct dhd_bus *bus)
{
int bcmerror = -1;
uint len;
void * image = NULL;
uint len, memblock_len = 0;
char * memblock = NULL;
char *bufp;
char *pnv_path;
@@ -10506,24 +10673,21 @@ dhdsdio_download_nvram(struct dhd_bus *bus)
nvram_file_exists = ((pnv_path != NULL) && (pnv_path[0] != '\0'));
/* For Get nvram from UEFI */
if (nvram_file_exists) {
image = dhd_os_open_image1(bus->dhd, pnv_path);
if (image == NULL) {
printf("%s: Open nvram file failed %s\n", __FUNCTION__, pnv_path);
goto err;
}
}
len = MAX_NVRAMBUF_SIZE;
if (nvram_file_exists)
bcmerror = dhd_get_download_buffer(bus->dhd, pnv_path, NVRAM, &memblock,
(int *)&len);
else
bcmerror = dhd_get_download_buffer(bus->dhd, NULL, NVRAM, &memblock, (int *)&len);
memblock = MALLOC(bus->dhd->osh, MAX_NVRAMBUF_SIZE);
if (memblock == NULL) {
DHD_ERROR(("%s: Failed to allocate memory %d bytes\n",
__FUNCTION__, MAX_NVRAMBUF_SIZE));
if (bcmerror != BCME_OK)
goto err;
}
/* For Get nvram from image or UEFI (when image == NULL ) */
len = dhd_os_get_image_block(memblock, MAX_NVRAMBUF_SIZE, image);
#ifdef DHD_LINUX_STD_FW_API
memblock_len = len;
#else
memblock_len = MAX_NVRAMBUF_SIZE;
#endif /* DHD_LINUX_STD_FW_API */
if (len > 0 && len < MAX_NVRAMBUF_SIZE) {
bufp = (char *)memblock;
@@ -10548,10 +10712,7 @@ dhdsdio_download_nvram(struct dhd_bus *bus)
err:
if (memblock)
MFREE(bus->dhd->osh, memblock, MAX_NVRAMBUF_SIZE);
if (image)
dhd_os_close_image1(bus->dhd, image);
dhd_free_download_buffer(bus->dhd, memblock, memblock_len);
return bcmerror;
}

View File

@@ -7,7 +7,7 @@
#include <linux/err.h>
#include <linux/skbuff.h>
#define DHD_STATIC_VERSION_STR "101.10.361.12 (wlan=r892223-20210928-1)"
#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)
@@ -173,7 +173,7 @@ 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 *
@@ -184,11 +184,15 @@ dhd_wlan_mem_prealloc(
int section, unsigned long size)
{
#ifndef BCMDHD_MDRIVER
uint bus_type = 0;
int index = 0;
#endif
#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("sectoin %d, size %ld\n", section, size);
#endif
if (section == DHD_PREALLOC_PROT)
return wlan_static_prot[index];
@@ -338,7 +342,9 @@ dhd_wlan_mem_prealloc(
return NULL;
}
#ifndef DHD_STATIC_IN_DRIVER
EXPORT_SYMBOL(dhd_wlan_mem_prealloc);
#endif
static void
dhd_deinit_wlan_mem(int index)
@@ -584,11 +590,11 @@ dhd_init_wlan_mem(int index)
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:
DHD_STATIC_ERROR("Failed to allocate memory for index %d\n", index);
DHD_STATIC_ERROR("Failed to allocate memory for index %d\n", index);
return -ENOMEM;
}
@@ -615,7 +621,7 @@ dhd_static_buf_init(void)
dhd_deinit_wlan_mem(i);
}
return 0;
return ret;
}
#ifdef DHD_STATIC_IN_DRIVER

View File

@@ -256,6 +256,7 @@ extern void bcmsdh_oob_intr_unregister(bcmsdh_info_t *sdh);
extern void bcmsdh_oob_intr_set(bcmsdh_info_t *sdh, bool enable);
extern int bcmsdh_get_oob_intr_num(bcmsdh_info_t *bcmsdh);
#endif /* defined(OOB_INTR_ONLY) || defined(BCMSPI_ANDROID) */
extern void *bcmsdh_get_dev(bcmsdh_info_t *sdh);
extern void bcmsdh_dev_pm_stay_awake(bcmsdh_info_t *sdh);
extern void bcmsdh_dev_relax(bcmsdh_info_t *sdh);
extern bool bcmsdh_dev_pm_enabled(bcmsdh_info_t *sdh);

View File

@@ -24,7 +24,6 @@
#ifndef __BCMSDH_SDMMC_H__
#define __BCMSDH_SDMMC_H__
#ifdef BCMDBG
#define sd_err(x) do { if (sd_msglevel & SDH_ERROR_VAL) printf x; } while (0)
#define sd_trace(x) do { if (sd_msglevel & SDH_TRACE_VAL) printf x; } while (0)
#define sd_info(x) do { if (sd_msglevel & SDH_INFO_VAL) printf x; } while (0)
@@ -32,15 +31,6 @@
#define sd_data(x) do { if (sd_msglevel & SDH_DATA_VAL) printf x; } while (0)
#define sd_ctrl(x) do { if (sd_msglevel & SDH_CTRL_VAL) printf x; } while (0)
#define sd_cost(x) do { if (sd_msglevel & SDH_COST_VAL) printf x; } while (0)
#else
#define sd_err(x) do { if (sd_msglevel & SDH_ERROR_VAL) printf x; } while (0)
#define sd_trace(x)
#define sd_info(x)
#define sd_debug(x)
#define sd_data(x)
#define sd_ctrl(x)
#define sd_cost(x) do { if (sd_msglevel & SDH_COST_VAL) printf x; } while (0)
#endif
#define sd_sync_dma(sd, read, nbytes)
#define sd_init_dma(sd)

View File

@@ -194,8 +194,6 @@ extern void *pktlast(osl_t *osh, void *p);
extern uint pktsegcnt(osl_t *osh, void *p);
extern uint8 *pktdataoffset(osl_t *osh, void *p, uint offset);
extern void *pktoffset(osl_t *osh, void *p, uint offset);
/* Add to adjust 802.1x priority */
extern void pktset8021xprio(void *pkt, int prio);
#ifdef WLCSO
extern uint pkttotlen_no_sfhtoe_hdr(osl_t *osh, void *p, uint toe_hdr_len);

View File

@@ -262,8 +262,10 @@ typedef enum dhd_iface_mgmt_policy {
#define DHD_MSGTRACE_VAL 0x200000
#define DHD_FWLOG_VAL 0x400000
#define DHD_DBGIF_VAL 0x800000
#ifdef DHD_PCIE_NATIVE_RUNTIMEPM
#ifdef DHD_PCIE_RUNTIMEPM
#define DHD_RPM_VAL 0x1000000
#else
#define DHD_RPM_VAL DHD_ERROR_VAL
#endif /* DHD_PCIE_NATIVE_RUNTIMEPM */
#define DHD_PKT_MON_VAL 0x2000000
#define DHD_PKT_MON_DUMP_VAL 0x4000000

View File

@@ -45,7 +45,7 @@
#elif (defined (BCMDBG_ASSERT) && !defined (BCMDBG_ASSERT_DISABLED))
#define EPI_VERSION_STR "101.10.361 (wlan=r892223 ASSRT)"
#else
#define EPI_VERSION_STR "101.10.361.16 (wlan=r892223-20220221-1)"
#define EPI_VERSION_STR "101.10.361.20 (wlan=r892223-20220701-3)"
#endif /* BCMINTERNAL */
#endif /* _epivers_h_ */

View File

@@ -350,7 +350,7 @@ extern uint64 osl_systztime_us(void);
#define OSL_LOCALTIME_NS() osl_localtime_ns()
#define OSL_GET_LOCALTIME(sec, usec) osl_get_localtime((sec), (usec))
#define OSL_SYSTZTIME_US() osl_systztime_us()
#define printf(fmt, args...) printk(DHD_LOG_PREFIXS fmt , ## args)
#define printf(fmt, args...) printk(PERCENT_S DHD_LOG_PREFIXS fmt, PRINTF_SYSTEM_TIME, ## args)
#include <linux/kernel.h> /* for vsn/printf's */
#include <linux/string.h> /* for mem*, str* */
/* bcopy's: Linux kernel doesn't provide these (anymore) */

View File

@@ -623,12 +623,26 @@ typedef struct {
/* ANDREY: new MACROs to start stop threads(OLD kthread API STYLE) */
/* requires tsk_ctl_t tsk argument, the caller's priv data is passed in owner ptr */
/* note this macro assumes there may be only one context waiting on thread's completion */
#ifdef KERNEL_TIMESTAMP
extern char *dhd_log_dump_get_timestamp(void);
#ifdef SYSTEM_TIMESTAMP
extern char* dhd_dbg_get_system_timestamp(void);
#define PRINTF_SYSTEM_TIME dhd_log_dump_get_timestamp(), dhd_dbg_get_system_timestamp()
#define PERCENT_S "[%s][%s]"
#else
#define PRINTF_SYSTEM_TIME dhd_log_dump_get_timestamp()
#define PERCENT_S "[%s]"
#endif
#else
#define PRINTF_SYSTEM_TIME ""
#define PERCENT_S "%s"
#endif
#ifndef DHD_LOG_PREFIX
#define DHD_LOG_PREFIX "[dhd]"
#endif
#define DHD_LOG_PREFIXS DHD_LOG_PREFIX" "
#ifdef DHD_DEBUG
#define printf_thr(fmt, args...) printk(DHD_LOG_PREFIXS fmt , ## args)
#define printf_thr(fmt, args...) printk(PERCENT_S DHD_LOG_PREFIXS fmt, PRINTF_SYSTEM_TIME, ## args)
#define DBG_THR(args) do {printf_thr args;} while (0)
#else
#define DBG_THR(x)
@@ -927,5 +941,21 @@ int kernel_read_compat(struct file *file, loff_t offset, char *addr, unsigned lo
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 32)
#define netdev_tx_t int
#endif
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 17, 0))
#define complete_and_exit(a, b) kthread_complete_and_exit(a, b)
#else
#define dev_addr_set(net, addr) memcpy(net->dev_addr, addr, ETHER_ADDR_LEN)
#endif /* LINUX_VERSION_CODE > KERNEL_VERSION(5, 17, 0) */
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0))
#define netif_rx_ni(skb) netif_rx(skb)
#define pci_free_consistent(a, b, c, d) dma_free_coherent(&((struct pci_dev *)a)->dev, b, c, d)
#define pci_map_single(a, b, c, d) dma_map_single(&((struct pci_dev *)a)->dev, b, c, d)
#define pci_unmap_single(a, b, c, d) dma_unmap_single(&((struct pci_dev *)a)->dev, b, c, d)
#define pci_dma_mapping_error(a, b) dma_mapping_error(&((struct pci_dev *)a)->dev, b)
#ifndef PCI_DMA_TODEVICE
#define PCI_DMA_TODEVICE 1
#define PCI_DMA_FROMDEVICE 2
#endif
#endif
#endif /* _linuxver_h_ */

View File

@@ -200,11 +200,11 @@ osl_dma_map_dump(osl_t *osh)
osl_get_localtime(&ts_sec, &ts_usec);
if (map_log && unmap_log) {
printk("%s: map_idx=%d unmap_idx=%d "
printf("%s: map_idx=%d unmap_idx=%d "
"current time=[%5lu.%06lu]\n", __FUNCTION__,
map_log->idx, unmap_log->idx, (unsigned long)ts_sec,
(unsigned long)ts_usec);
printk("%s: dhd_map_log(pa)=0x%llx size=%d,"
printf("%s: dhd_map_log(pa)=0x%llx size=%d,"
" dma_unmap_log(pa)=0x%llx size=%d\n", __FUNCTION__,
(uint64)__virt_to_phys((ulong)(map_log->map)),
(uint32)(sizeof(dhd_map_item_t) * map_log->items),
@@ -253,7 +253,7 @@ osl_dma_map_logging(osl_t *osh, void *handle, dmaaddr_t pa, uint32 len)
uint32 idx;
if (log == NULL) {
printk("%s: log is NULL\n", __FUNCTION__);
printf("%s: log is NULL\n", __FUNCTION__);
return;
}
@@ -277,14 +277,15 @@ osl_error(int bcmerror)
/* Array bounds covered by ASSERT in osl_attach */
return linuxbcmerrormap[-bcmerror];
}
osl_t *
osl_attach(void *pdev, uint bustype, bool pkttag
#ifdef SHARED_OSL_CMN
osl_t *
osl_attach(void *pdev, uint bustype, bool pkttag, void **osl_cmn)
{
#else
osl_t *
osl_attach(void *pdev, uint bustype, bool pkttag)
, void **osl_cmn
#endif /* SHARED_OSL_CMN */
)
{
#ifndef SHARED_OSL_CMN
void **osl_cmn = NULL;
#endif /* SHARED_OSL_CMN */
osl_t *osh;
@@ -364,12 +365,12 @@ osl_attach(void *pdev, uint bustype, bool pkttag)
#ifdef DHD_MAP_LOGGING
osh->dhd_map_log = osl_dma_map_log_init(DHD_MAP_LOG_SIZE);
if (osh->dhd_map_log == NULL) {
printk("%s: Failed to alloc dhd_map_log\n", __FUNCTION__);
printf("%s: Failed to alloc dhd_map_log\n", __FUNCTION__);
}
osh->dhd_unmap_log = osl_dma_map_log_init(DHD_MAP_LOG_SIZE);
if (osh->dhd_unmap_log == NULL) {
printk("%s: Failed to alloc dhd_unmap_log\n", __FUNCTION__);
printf("%s: Failed to alloc dhd_unmap_log\n", __FUNCTION__);
}
#endif /* DHD_MAP_LOGGING */
@@ -490,7 +491,7 @@ osl_pci_read_config(osl_t *osh, uint offset, uint size)
#ifdef BCMDBG
if (retry < PCI_CFG_RETRY)
printk("PCI CONFIG READ access to %d required %d retries\n", offset,
printf("PCI CONFIG READ access to %d required %d retries\n", offset,
(PCI_CFG_RETRY - retry));
#endif /* BCMDBG */
@@ -520,7 +521,7 @@ osl_pci_write_config(osl_t *osh, uint offset, uint size, uint val)
#ifdef BCMDBG
if (retry < PCI_CFG_RETRY)
printk("PCI CONFIG WRITE access to %d required %d retries\n", offset,
printf("PCI CONFIG WRITE access to %d required %d retries\n", offset,
(PCI_CFG_RETRY - retry));
#endif /* BCMDBG */
}
@@ -616,7 +617,7 @@ osl_malloc(osl_t *osh, uint size)
if (i == STATIC_BUF_MAX_NUM)
{
OSL_STATIC_BUF_UNLOCK(&bcm_static_buf->static_lock, irq_flags);
printk("all static buff in use!\n");
printf("all static buff in use!\n");
goto original;
}
@@ -809,7 +810,7 @@ osl_debug_malloc(osl_t *osh, uint size, int line, const char* file)
const char* basename;
unsigned long flags = 0;
if (!size) {
printk("%s: allocating zero sized mem at %s line %d\n", __FUNCTION__, file, line);
printf("%s: allocating zero sized mem at %s line %d\n", __FUNCTION__, file, line);
ASSERT(0);
}
@@ -876,7 +877,7 @@ osl_debug_mfree(osl_t *osh, void *addr, uint size, int line, const char* file)
p = (bcm_mem_link_t *)((int8*)addr - sizeof(bcm_mem_link_t));
if (p->size == 0) {
printk("osl_debug_mfree: double free on addr %p size %d at line %d file %s\n",
printf("osl_debug_mfree: double free on addr %p size %d at line %d file %s\n",
addr, size, line, file);
prhex("bcm_mem_link_t", (void *)p, sizeof(*p));
ASSERT(p->size);
@@ -884,19 +885,19 @@ osl_debug_mfree(osl_t *osh, void *addr, uint size, int line, const char* file)
}
if (p->size != size) {
printk("%s: dealloca size does not match alloc size\n", __FUNCTION__);
printk("Dealloc addr %p size %d at line %d file %s\n", addr, size, line, file);
printk("Alloc size %d line %d file %s\n", p->size, p->line, p->file);
printf("%s: dealloca size does not match alloc size\n", __FUNCTION__);
printf("Dealloc addr %p size %d at line %d file %s\n", addr, size, line, file);
printf("Alloc size %d line %d file %s\n", p->size, p->line, p->file);
prhex("bcm_mem_link_t", (void *)p, sizeof(*p));
ASSERT(p->size == size);
return;
}
if (osh && ((osl_t*)p->osh)->cmn != osh->cmn) {
printk("osl_debug_mfree: alloc osh %p does not match dealloc osh %p\n",
printf("osl_debug_mfree: alloc osh %p does not match dealloc osh %p\n",
((osl_t*)p->osh)->cmn, osh->cmn);
printk("Dealloc addr %p size %d at line %d file %s\n", addr, size, line, file);
printk("Alloc size %d line %d file %s\n", p->size, p->line, p->file);
printf("Dealloc addr %p size %d at line %d file %s\n", addr, size, line, file);
printf("Alloc size %d line %d file %s\n", p->size, p->line, p->file);
prhex("bcm_mem_link_t", (void *)p, sizeof(*p));
ASSERT(((osl_t*)p->osh)->cmn == osh->cmn);
return;
@@ -928,7 +929,7 @@ osl_debug_vmalloc(osl_t *osh, uint size, int line, const char* file)
const char* basename;
unsigned long flags = 0;
if (!size) {
printk("%s: allocating zero sized mem at %s line %d\n", __FUNCTION__, file, line);
printf("%s: allocating zero sized mem at %s line %d\n", __FUNCTION__, file, line);
ASSERT(0);
}
@@ -990,25 +991,25 @@ osl_debug_vmfree(osl_t *osh, void *addr, uint size, int line, const char* file)
ASSERT(osh == NULL || osh->magic == OS_HANDLE_MAGIC);
if (p->size == 0) {
printk("osl_debug_mfree: double free on addr %p size %d at line %d file %s\n",
printf("osl_debug_mfree: double free on addr %p size %d at line %d file %s\n",
addr, size, line, file);
ASSERT(p->size);
return;
}
if (p->size != size) {
printk("%s: dealloca size does not match alloc size\n", __FUNCTION__);
printk("Dealloc addr %p size %d at line %d file %s\n", addr, size, line, file);
printk("Alloc size %d line %d file %s\n", p->size, p->line, p->file);
printf("%s: dealloca size does not match alloc size\n", __FUNCTION__);
printf("Dealloc addr %p size %d at line %d file %s\n", addr, size, line, file);
printf("Alloc size %d line %d file %s\n", p->size, p->line, p->file);
ASSERT(p->size == size);
return;
}
if (osh && ((osl_t*)p->osh)->cmn != osh->cmn) {
printk("osl_debug_mfree: alloc osh %p does not match dealloc osh %p\n",
printf("osl_debug_mfree: alloc osh %p does not match dealloc osh %p\n",
((osl_t*)p->osh)->cmn, osh->cmn);
printk("Dealloc addr %p size %d at line %d file %s\n", addr, size, line, file);
printk("Alloc size %d line %d file %s\n", p->size, p->line, p->file);
printf("Dealloc addr %p size %d at line %d file %s\n", addr, size, line, file);
printf("Alloc size %d line %d file %s\n", p->size, p->line, p->file);
ASSERT(((osl_t*)p->osh)->cmn == osh->cmn);
return;
}
@@ -1046,7 +1047,7 @@ osl_debug_memdump(osl_t *osh, struct bcmstrbuf *b)
if (b != NULL)
bcm_bprintf(b, " Address Size File:line\n");
else
printk(" Address Size File:line\n");
printf(" Address Size File:line\n");
for (p = osh->cmn->dbgmem_list; p; p = p->next) {
if (b != NULL)
@@ -1073,7 +1074,7 @@ osl_debug_memdump(osl_t *osh, struct bcmstrbuf *b)
if (b != NULL)
bcm_bprintf(b, "Vmem\n Address Size File:line\n");
else
printk("Vmem\n Address Size File:line\n");
printf("Vmem\n Address Size File:line\n");
for (p = osh->cmn->dbgvmem_list; p; p = p->next) {
if (b != NULL)
@@ -1204,7 +1205,7 @@ BCMFASTPATH(osl_dma_map)(osl_t *osh, void *va, uint size, int direction, void *p
ret = pci_dma_mapping_error(osh->pdev, map_addr);
if (ret) {
printk("%s: Failed to map memory\n", __FUNCTION__);
printf("%s: Failed to map memory\n", __FUNCTION__);
PHYSADDRLOSET(ret_addr, 0);
PHYSADDRHISET(ret_addr, 0);
} else {
@@ -1296,8 +1297,8 @@ osl_assert(const char *exp, const char *file, int line)
/* Print assert message and give it time to be written to /var/log/messages */
if (!in_interrupt() && g_assert_type != 1 && g_assert_type != 3) {
const int delay = 3;
printk("%s", tempbuf);
printk("panic in %d seconds\n", delay);
printf("%s", tempbuf);
printf("panic in %d seconds\n", delay);
set_current_state(TASK_INTERRUPTIBLE);
schedule_timeout(delay * HZ);
}
@@ -1305,16 +1306,16 @@ osl_assert(const char *exp, const char *file, int line)
switch (g_assert_type) {
case 0:
printk("%s", tempbuf);
printf("%s", tempbuf);
BUG();
break;
case 1:
/* fall through */
case 3:
printk("%s", tempbuf);
printf("%s", tempbuf);
break;
case 2:
printk("%s", tempbuf);
printf("%s", tempbuf);
BUG();
break;
default:
@@ -1516,11 +1517,11 @@ osl_printf(const char *format, ...)
va_end(args);
if (len > sizeof(printbuf)) {
printk("osl_printf: buffer overrun\n");
printf("osl_printf: buffer overrun\n");
return (0);
}
return (printk("%s", printbuf));
return (printf("%s", printbuf));
}
int
@@ -1731,7 +1732,7 @@ osl_os_open_image(char *filename)
* ???
*/
if (IS_ERR(fp)) {
printk("ERROR %ld: Unable to open file %s\n", PTR_ERR(fp), filename);
printf("ERROR %ld: Unable to open file %s\n", PTR_ERR(fp), filename);
fp = NULL;
}
@@ -1839,7 +1840,7 @@ osl_timer_init(osl_t *osh, const char *name, void (*fn)(void *arg), void *arg)
osl_timer_t *t;
BCM_REFERENCE(fn);
if ((t = MALLOCZ(NULL, sizeof(osl_timer_t))) == NULL) {
printk(KERN_ERR "osl_timer_init: out of memory, malloced %d bytes\n",
printf(KERN_ERR "osl_timer_init: out of memory, malloced %d bytes\n",
(int)sizeof(osl_timer_t));
return (NULL);
}

View File

@@ -73,12 +73,12 @@ int osl_static_mem_init(osl_t *osh, void *adapter)
if (!bcm_static_buf && adapter) {
if (!(bcm_static_buf = (bcm_static_buf_t *)wifi_platform_prealloc(adapter,
DHD_PREALLOC_OSL_BUF, STATIC_BUF_SIZE + STATIC_BUF_TOTAL_LEN))) {
printk("can not alloc static buf!\n");
printf("can not alloc static buf!\n");
bcm_static_skb = NULL;
ASSERT(osh->magic == OS_HANDLE_MAGIC);
return -ENOMEM;
} else {
printk("succeed to alloc static buf\n");
printf("succeed to alloc static buf\n");
}
spin_lock_init(&bcm_static_buf->static_lock);
@@ -93,7 +93,7 @@ int osl_static_mem_init(osl_t *osh, void *adapter)
bcm_static_skb = (bcm_static_pkt_t *)((char *)bcm_static_buf + 2048);
skb_buff_ptr = wifi_platform_prealloc(adapter, DHD_PREALLOC_SKB_BUF, 0);
if (!skb_buff_ptr) {
printk("cannot alloc static buf!\n");
printf("cannot alloc static buf!\n");
bcm_static_buf = NULL;
bcm_static_skb = NULL;
ASSERT(osh->magic == OS_HANDLE_MAGIC);
@@ -347,14 +347,14 @@ BCMFASTPATH(linux_pktfree)(osl_t *osh, void *p, bool send)
#if defined(CONFIG_DHD_USE_STATIC_BUF) && defined(DHD_USE_STATIC_CTRLBUF)
if (skb && (skb->mac_len == PREALLOC_USED_MAGIC)) {
printk("%s: pkt %p is from static pool\n",
printf("%s: pkt %p is from static pool\n",
__FUNCTION__, p);
dump_stack();
return;
}
if (skb && (skb->mac_len == PREALLOC_FREE_MAGIC)) {
printk("%s: pkt %p is from static pool and not in used\n",
printf("%s: pkt %p is from static pool and not in used\n",
__FUNCTION__, p);
dump_stack();
return;
@@ -409,7 +409,7 @@ osl_pktget_static(osl_t *osh, uint len)
return linux_pktget(osh, len);
if (len > DHD_SKB_MAX_BUFSIZE) {
printk("%s: attempt to allocate huge packet (0x%x)\n", __FUNCTION__, len);
printf("%s: attempt to allocate huge packet (0x%x)\n", __FUNCTION__, len);
return linux_pktget(osh, len);
}
@@ -452,7 +452,7 @@ osl_pktget_static(osl_t *osh, uint len)
}
OSL_STATIC_PKT_UNLOCK(&bcm_static_skb->osl_pkt_lock, flags);
printk("%s: all static pkt in use!\n", __FUNCTION__);
printf("%s: all static pkt in use!\n", __FUNCTION__);
return NULL;
#else
down(&bcm_static_skb->osl_pkt_sem);
@@ -523,7 +523,7 @@ osl_pktget_static(osl_t *osh, uint len)
#endif /* ENHANCED_STATIC_BUF */
up(&bcm_static_skb->osl_pkt_sem);
printk("%s: all static pkt in use!\n", __FUNCTION__);
printf("%s: all static pkt in use!\n", __FUNCTION__);
return linux_pktget(osh, len);
#endif /* DHD_USE_STATIC_CTRLBUF */
}
@@ -552,14 +552,14 @@ osl_pktfree_static(osl_t *osh, void *p, bool send)
for (i = 0; i < STATIC_PKT_2PAGE_NUM; i++) {
if (p == bcm_static_skb->skb_8k[i]) {
if (bcm_static_skb->pkt_use[i] == 0) {
printk("%s: static pkt idx %d(%p) is double free\n",
printf("%s: static pkt idx %d(%p) is double free\n",
__FUNCTION__, i, p);
} else {
bcm_static_skb->pkt_use[i] = 0;
}
if (skb->mac_len != PREALLOC_USED_MAGIC) {
printk("%s: static pkt idx %d(%p) is not in used\n",
printf("%s: static pkt idx %d(%p) is not in used\n",
__FUNCTION__, i, p);
}
@@ -570,7 +570,7 @@ osl_pktfree_static(osl_t *osh, void *p, bool send)
}
OSL_STATIC_PKT_UNLOCK(&bcm_static_skb->osl_pkt_lock, flags);
printk("%s: packet %p does not exist in the pool\n", __FUNCTION__, p);
printf("%s: packet %p does not exist in the pool\n", __FUNCTION__, p);
#else
down(&bcm_static_skb->osl_pkt_sem);
for (i = 0; i < STATIC_PKT_1PAGE_NUM; i++) {
@@ -685,7 +685,7 @@ void osl_ctrace_dump(osl_t *osh, struct bcmstrbuf *b)
if (b != NULL)
bcm_bprintf(b, " Total %d sbk not free\n", osh->ctrace_num);
else
printk(" Total %d sbk not free\n", osh->ctrace_num);
printf(" Total %d sbk not free\n", osh->ctrace_num);
list_for_each_entry(skb, &osh->ctrace_list, ctrace_list) {
if (b != NULL)

View File

@@ -93,19 +93,19 @@ uint android_msg_level = ANDROID_ERROR_LEVEL | ANDROID_MSG_LEVEL;
#define ANDROID_ERROR_MSG(x, args...) \
do { \
if (android_msg_level & ANDROID_ERROR_LEVEL) { \
printk(KERN_ERR DHD_LOG_PREFIXS "ANDROID-ERROR) " x, ## args); \
printf("ANDROID-ERROR) " x, ## args); \
} \
} while (0)
#define ANDROID_TRACE_MSG(x, args...) \
do { \
if (android_msg_level & ANDROID_TRACE_LEVEL) { \
printk(KERN_INFO DHD_LOG_PREFIXS "ANDROID-TRACE) " x, ## args); \
printf("ANDROID-TRACE) " x, ## args); \
} \
} while (0)
#define ANDROID_INFO_MSG(x, args...) \
do { \
if (android_msg_level & ANDROID_INFO_LEVEL) { \
printk(KERN_INFO DHD_LOG_PREFIXS "ANDROID-INFO) " x, ## args); \
printf("ANDROID-INFO) " x, ## args); \
} \
} while (0)
#define ANDROID_ERROR(x) ANDROID_ERROR_MSG x
@@ -4901,10 +4901,10 @@ int wl_android_wifi_on(struct net_device *dev)
dhd_net_wifi_platform_set_power(dev, TRUE, WIFI_TURNON_DELAY);
#ifdef BCMSDIO
ret = dhd_net_bus_resume(dev, 0);
if (ret)
goto retry_power;
#endif /* BCMSDIO */
#ifdef BCMPCIE
ret = dhd_net_bus_devreset(dev, FALSE);
#endif /* BCMPCIE */
#ifdef WBRC
if (dhdp->dhd_induce_bh_error == DHD_INDUCE_BH_ON_FAIL_ONCE) {
ANDROID_ERROR(("%s: dhd_induce_bh_error = %d\n",
@@ -4921,14 +4921,30 @@ int wl_android_wifi_on(struct net_device *dev)
ret = BCME_ERROR;
}
#endif /* WBRC */
if (ret)
goto retry_power;
#if defined(BCMSDIO) || defined(BCMDBUS)
#ifdef BCMSDIO
dhd_net_bus_resume(dev, 1);
#endif /* BCMSDIO */
ret = dhd_dev_init_ioctl(dev);
if (ret < 0) {
goto retry_bus;
}
#endif /* BCMSDIO || BCMDBUS */
if (ret == 0) {
break;
}
#if defined(BCMSDIO) || defined(BCMDBUS)
retry_bus:
#ifdef BCMSDIO
dhd_net_bus_suspend(dev);
#endif /* BCMSDIO */
#endif /* BCMSDIO || BCMDBUS */
retry_power:
ANDROID_ERROR(("failed to power up wifi chip, retry again (%d left) **\n\n",
retry));
#ifdef BCMPCIE
dhd_net_bus_devreset(dev, TRUE);
#endif /* BCMPCIE */
dhd_net_wifi_platform_set_power(dev, FALSE, WIFI_TURNOFF_DELAY);
#ifdef WBRC
/* Inform BT reset which will internally wait till BT reset is done */
@@ -4944,41 +4960,16 @@ int wl_android_wifi_on(struct net_device *dev)
#endif /* BCM_DETECT_TURN_ON_FAILURE */
goto exit;
}
#if defined(BCMSDIO) || defined(BCMDBUS)
ret = dhd_net_bus_devreset(dev, FALSE);
if (ret)
goto err;
#ifdef BCMSDIO
dhd_net_bus_resume(dev, 1);
#endif /* BCMSDIO */
#endif /* BCMSDIO || BCMDBUS */
#if defined(BCMSDIO) || defined(BCMDBUS)
if (!ret) {
if (dhd_dev_init_ioctl(dev) < 0) {
ret = -EFAULT;
goto err;
}
}
#endif /* BCMSDIO || BCMDBUS */
g_wifi_on = TRUE;
}
exit:
WL_MSG(dev->name, "Success\n");
if (ret)
WL_MSG(dev->name, "Failed %d\n", ret);
else
WL_MSG(dev->name, "Success\n");
dhd_net_if_unlock(dev);
return ret;
#if defined(BCMSDIO) || defined(BCMDBUS)
err:
dhd_net_bus_devreset(dev, TRUE);
#ifdef BCMSDIO
dhd_net_bus_suspend(dev);
#endif /* BCMSDIO */
dhd_net_wifi_platform_set_power(dev, FALSE, WIFI_TURNOFF_DELAY);
WL_MSG(dev->name, "Failed\n");
dhd_net_if_unlock(dev);
return ret;
#endif /* BCMSDIO || BCMDBUS */
}
int wl_android_wifi_off(struct net_device *dev, bool on_failure)
@@ -13372,7 +13363,7 @@ wl_cfg80211_static_if_open(struct net_device *net)
if (cfg->static_ndev_state[static_ifidx] != NDEV_STATE_FW_IF_CREATED) {
#ifdef CUSTOM_MULTI_MAC
if (!wifi_platform_get_mac_addr(dhd->info->adapter, hw_ether, static_ifidx+1))
memcpy(net->dev_addr, hw_ether, ETHER_ADDR_LEN);
dev_addr_set(net, hw_ether);
#endif
wdev = wl_cfg80211_add_if(cfg, primary_ndev, wl_iftype, net->name, net->dev_addr);
if (!wdev) {
@@ -13424,7 +13415,7 @@ wl_cfg80211_post_static_ifcreate(struct bcm_cfg80211 *cfg,
wdev = new_ndev->ieee80211_ptr;
ASSERT(wdev);
wdev->iftype = iface_type;
(void)memcpy_s(new_ndev->dev_addr, ETH_ALEN, addr, ETH_ALEN);
dev_addr_set(new_ndev, addr);
}
cfg->static_ndev_state[static_ifidx] = NDEV_STATE_FW_IF_CREATED;

View File

@@ -29,6 +29,7 @@
#include <wldev_common.h>
#include <dngl_stats.h>
#include <dhd.h>
#include <wl_android_ext.h>
#ifdef WL_EXT_IAPSTA
#ifdef WL_ESCAN
#include <wl_escan.h>
@@ -42,7 +43,6 @@
#endif
#include <wl_event.h>
#endif
#include <wl_android_ext.h>
/* If any feature uses the Generic Netlink Interface, put it here to enable WL_GENL
* automatically
@@ -87,7 +87,7 @@ typedef struct _compat_android_wifi_priv_cmd {
#define WL_MSG(name, arg1, args...) \
do { \
if (android_msg_level & ANDROID_MSG_LEVEL) { \
printk(KERN_ERR DHD_LOG_PREFIX "[%s] %s : " arg1, name, __func__, ## args); \
printf("[%s] %s : " arg1, name, __func__, ## args); \
} \
} while (0)
@@ -105,7 +105,7 @@ do { \
memcmp(&static_tmp, cmp, size)) { \
__err_ts = __cur_ts; \
memcpy(static_tmp, cmp, size); \
printk(KERN_ERR DHD_LOG_PREFIX "[%s] %s : [%u times] " arg1, \
printf("[%s] %s : [%u times] " arg1, \
name, __func__, __err_cnt, ## args); \
__err_cnt = 0; \
} else { \

View File

@@ -35,25 +35,25 @@
#define AEXT_ERROR(name, arg1, args...) \
do { \
if (android_msg_level & ANDROID_ERROR_LEVEL) { \
printk(KERN_ERR DHD_LOG_PREFIX "[%s] AEXT-ERROR) %s : " arg1, name, __func__, ## args); \
printf("[%s] AEXT-ERROR) %s : " arg1, name, __func__, ## args); \
} \
} while (0)
#define AEXT_TRACE(name, arg1, args...) \
do { \
if (android_msg_level & ANDROID_TRACE_LEVEL) { \
printk(KERN_INFO DHD_LOG_PREFIX "[%s] AEXT-TRACE) %s : " arg1, name, __func__, ## args); \
printf("[%s] AEXT-TRACE) %s : " arg1, name, __func__, ## args); \
} \
} while (0)
#define AEXT_INFO(name, arg1, args...) \
do { \
if (android_msg_level & ANDROID_INFO_LEVEL) { \
printk(KERN_INFO DHD_LOG_PREFIX "[%s] AEXT-INFO) %s : " arg1, name, __func__, ## args); \
printf("[%s] AEXT-INFO) %s : " arg1, name, __func__, ## args); \
} \
} while (0)
#define AEXT_DBG(name, arg1, args...) \
do { \
if (android_msg_level & ANDROID_DBG_LEVEL) { \
printk(KERN_INFO DHD_LOG_PREFIX "[%s] AEXT-DBG) %s : " arg1, name, __func__, ## args); \
printf("[%s] AEXT-DBG) %s : " arg1, name, __func__, ## args); \
} \
} while (0)
@@ -163,22 +163,23 @@ typedef struct auth_name_map_t {
const auth_name_map_t auth_name_map[] = {
{WL_AUTH_OPEN_SYSTEM, WPA_AUTH_DISABLED, "open"},
{WL_AUTH_SHARED_KEY, WPA_AUTH_DISABLED, "shared"},
{WL_AUTH_OPEN_SYSTEM, WPA_AUTH_PSK, "wpapsk"},
{WL_AUTH_OPEN_SYSTEM, WPA2_AUTH_PSK, "wpa2psk"},
{WL_AUTH_OPEN_SYSTEM, WPA2_AUTH_PSK_SHA256|WPA2_AUTH_PSK, "wpa2psksha256"},
{WL_AUTH_OPEN_SYSTEM, WPA2_AUTH_FT|WPA2_AUTH_PSK, "wpa2psk-ft"},
{WL_AUTH_OPEN_SYSTEM, WPA2_AUTH_UNSPECIFIED, "wpa2eap"},
{WL_AUTH_OPEN_SYSTEM, WPA2_AUTH_FT|WPA2_AUTH_UNSPECIFIED, "wpa2eap-ft"},
{WL_AUTH_OPEN_SYSTEM, WPA3_AUTH_SAE_PSK, "wpa3psk"},
{WL_AUTH_SAE_KEY, WPA3_AUTH_SAE_PSK, "wpa3psk"},
{WL_AUTH_OPEN_SYSTEM, WPA3_AUTH_SAE_PSK|WPA2_AUTH_PSK, "wpa3psk"},
{WL_AUTH_SAE_KEY, WPA3_AUTH_SAE_PSK|WPA2_AUTH_PSK, "wpa3psk"},
{WL_AUTH_OPEN_SYSTEM, 0x20, "wpa3psk"},
{WL_AUTH_SAE_KEY, 0x20, "wpa3psk"},
{WL_AUTH_OPEN_SYSTEM, WPA3_AUTH_SAE_PSK|WPA2_AUTH_PSK_SHA256|WPA2_AUTH_PSK, "wpa3psksha256"},
{WL_AUTH_SAE_KEY, WPA3_AUTH_SAE_PSK|WPA2_AUTH_PSK_SHA256|WPA2_AUTH_PSK, "wpa3psksha256"},
{WL_AUTH_OPEN_SYSTEM, 0x20|WPA2_AUTH_PSK_SHA256|WPA2_AUTH_PSK, "wpa3psksha256"},
{WL_AUTH_SAE_KEY, 0x20|WPA2_AUTH_PSK_SHA256|WPA2_AUTH_PSK, "wpa3psksha256"},
{WL_AUTH_OPEN_SYSTEM, WPA_AUTH_PSK, "wpa/psk"},
{WL_AUTH_OPEN_SYSTEM, WPA2_AUTH_PSK, "wpa2/psk"},
{WL_AUTH_OPEN_SYSTEM, WPA2_AUTH_PSK_SHA256|WPA2_AUTH_PSK, "wpa2/psk/sha256"},
{WL_AUTH_OPEN_SYSTEM, WPA2_AUTH_FT|WPA2_AUTH_PSK, "wpa2/psk/ft"},
{WL_AUTH_OPEN_SYSTEM, WPA2_AUTH_UNSPECIFIED, "wpa2/eap"},
{WL_AUTH_OPEN_SYSTEM, WPA2_AUTH_FT|WPA2_AUTH_UNSPECIFIED, "wpa2/eap/ft"},
{WL_AUTH_OPEN_SYSTEM, WPA3_AUTH_SAE_PSK, "wpa3/psk"},
{WL_AUTH_SAE_KEY, WPA3_AUTH_SAE_PSK, "wpa3sae/psk"},
{WL_AUTH_OPEN_SYSTEM, WPA3_AUTH_SAE_PSK|WPA2_AUTH_PSK, "wpa3/psk"},
{WL_AUTH_SAE_KEY, WPA3_AUTH_SAE_PSK|WPA2_AUTH_PSK, "wpa3sae/psk"},
{WL_AUTH_OPEN_SYSTEM, 0x20, "wpa3/psk"},
{WL_AUTH_SAE_KEY, 0x20, "wpa3sae/psk"},
{WL_AUTH_OPEN_SYSTEM, WPA3_AUTH_SAE_PSK|WPA2_AUTH_PSK_SHA256|WPA2_AUTH_PSK, "wpa3/psk/sha256"},
{WL_AUTH_SAE_KEY, WPA3_AUTH_SAE_PSK|WPA2_AUTH_PSK_SHA256|WPA2_AUTH_PSK, "wpa3sae/psk/sha256"},
{WL_AUTH_OPEN_SYSTEM, 0x20|WPA2_AUTH_PSK_SHA256|WPA2_AUTH_PSK, "wpa3/psk/sha256"},
{WL_AUTH_SAE_KEY, 0x20|WPA2_AUTH_PSK_SHA256|WPA2_AUTH_PSK, "wpa3sae/psk/sha256"},
{WL_AUTH_OPEN_SYSTEM, WPA3_AUTH_OWE, "owe"},
};
typedef struct wsec_name_map_t {
@@ -191,7 +192,7 @@ const wsec_name_map_t wsec_name_map[] = {
{WEP_ENABLED, "wep"},
{TKIP_ENABLED, "tkip"},
{AES_ENABLED, "aes"},
{TKIP_ENABLED|AES_ENABLED, "tkipaes"},
{TKIP_ENABLED|AES_ENABLED, "tkip/aes"},
};
static int wl_ext_wl_iovar(struct net_device *dev, char *command, int total_len);
@@ -409,6 +410,29 @@ wl_ext_chspec_driver_to_host(int ioctl_ver, chanspec_t chanspec)
}
#endif /* WL_EXT_IAPSTA || WL_CFG80211 || WL_ESCAN */
chanspec_band_t
wl_ext_wlcband_to_chanspec_band(int band)
{
chanspec_band_t chanspec_band = WLC_BAND_INVALID;
switch (band) {
#ifdef WL_6G_BAND
case WLC_BAND_6G:
chanspec_band = WL_CHANSPEC_BAND_6G;
break;
#endif /* WL_6G_BAND */
case WLC_BAND_5G:
chanspec_band = WL_CHANSPEC_BAND_5G;
break;
case WLC_BAND_2G:
chanspec_band = WL_CHANSPEC_BAND_2G;
break;
default:
break;
}
return chanspec_band;
}
bool
wl_ext_check_scan(struct net_device *dev, dhd_pub_t *dhdp)
{
@@ -584,10 +608,10 @@ wl_ext_bss_iovar_war(struct net_device *ndev, s32 *val)
}
int
wl_ext_set_chanspec(struct net_device *dev, int ioctl_ver,
uint16 channel, chanspec_t *ret_chspec)
wl_ext_set_chanspec(struct net_device *dev, struct wl_chan_info *chan_info,
chanspec_t *ret_chspec)
{
s32 _chan = channel;
s32 _chan = chan_info->chan;
chanspec_t chspec = 0;
chanspec_t fw_chspec = 0;
u32 bw = WL_CHANSPEC_BW_20;
@@ -598,53 +622,53 @@ wl_ext_set_chanspec(struct net_device *dev, int ioctl_ver,
u32 band;
u32 bw_cap;
} param = {0, 0};
uint band;
chanspec_band_t chanspec_band = 0;
int ioctl_ver;
if (_chan <= CH_MAX_2G_CHANNEL)
band = IEEE80211_BAND_2GHZ;
else
band = IEEE80211_BAND_5GHZ;
if (band == IEEE80211_BAND_5GHZ) {
param.band = WLC_BAND_5G;
err = wl_ext_iovar_getbuf(dev, "bw_cap", &param, sizeof(param),
iovar_buf, WLC_IOCTL_SMLEN, NULL);
if (err) {
if (err != BCME_UNSUPPORTED) {
AEXT_ERROR(dev->name, "bw_cap failed, %d\n", err);
return err;
} else {
err = wl_ext_iovar_getint(dev, "mimo_bw_cap", &bw_cap);
if (bw_cap != WLC_N_BW_20ALL)
bw = WL_CHANSPEC_BW_40;
}
} else {
if (WL_BW_CAP_80MHZ(iovar_buf[0]))
bw = WL_CHANSPEC_BW_80;
else if (WL_BW_CAP_40MHZ(iovar_buf[0]))
bw = WL_CHANSPEC_BW_40;
else
bw = WL_CHANSPEC_BW_20;
}
if ((chan_info->band != WLC_BAND_2G) && (chan_info->band != WLC_BAND_5G) &&
(chan_info->band != WLC_BAND_6G)) {
AEXT_ERROR(dev->name, "bad band %d\n", chan_info->band);
return BCME_BADBAND;
}
param.band = chan_info->band;
err = wl_ext_iovar_getbuf(dev, "bw_cap", &param, sizeof(param),
iovar_buf, WLC_IOCTL_SMLEN, NULL);
if (err) {
if (err != BCME_UNSUPPORTED) {
AEXT_ERROR(dev->name, "bw_cap failed, %d\n", err);
return err;
} else {
err = wl_ext_iovar_getint(dev, "mimo_bw_cap", &bw_cap);
if (bw_cap != WLC_N_BW_20ALL)
bw = WL_CHANSPEC_BW_40;
}
} else {
if (WL_BW_CAP_80MHZ(iovar_buf[0]))
bw = WL_CHANSPEC_BW_80;
else if (WL_BW_CAP_40MHZ(iovar_buf[0]))
bw = WL_CHANSPEC_BW_40;
else
bw = WL_CHANSPEC_BW_20;
}
else if (band == IEEE80211_BAND_2GHZ)
bw = WL_CHANSPEC_BW_20;
set_channel:
chspec = wf_channel2chspec(_chan, bw);
chanspec_band = wl_ext_wlcband_to_chanspec_band(chan_info->band);
chspec = wf_create_chspec_from_primary(chan_info->chan, bw, chanspec_band);
if (wf_chspec_valid(chspec)) {
wl_ext_get_ioctl_ver(dev, &ioctl_ver);
fw_chspec = wl_ext_chspec_host_to_driver(ioctl_ver, chspec);
if (fw_chspec != INVCHANSPEC) {
if ((err = wl_ext_iovar_setint(dev, "chanspec", fw_chspec)) == BCME_BADCHAN) {
if (bw == WL_CHANSPEC_BW_80)
goto change_bw;
err = wl_ext_ioctl(dev, WLC_SET_CHANNEL, &_chan, sizeof(_chan), 1);
WL_MSG(dev->name, "channel %d\n", _chan);
WL_MSG(dev->name, "channel %s-%d\n", CHSPEC2BANDSTR(chspec), _chan);
} else if (err) {
AEXT_ERROR(dev->name, "failed to set chanspec error %d\n", err);
} else
WL_MSG(dev->name, "channel %d, 0x%x\n", channel, chspec);
WL_MSG(dev->name, "channel %s-%d(0x%x)\n",
CHSPEC2BANDSTR(chspec), chan_info->chan, chspec);
} else {
AEXT_ERROR(dev->name, "failed to convert host chanspec to fw chanspec\n");
err = BCME_ERROR;
@@ -670,20 +694,35 @@ change_bw:
static int
wl_ext_channel(struct net_device *dev, char* command, int total_len)
{
struct wl_chan_info chan_info;
int ret;
int channel=0;
char band[16]="";
int channel = 0;
channel_info_t ci;
int bytes_written = 0;
chanspec_t fw_chspec;
int ioctl_ver = 0;
AEXT_TRACE(dev->name, "cmd %s", command);
sscanf(command, "%*s %d", &channel);
sscanf(command, "%*s %d %s", &channel, band);
if (strnicmp(band, "band=auto", strlen("band=auto")) == 0) {
chan_info.band = WLC_BAND_AUTO;
}
#ifdef WL_6G_BAND
else if (strnicmp(band, "band=6g", strlen("band=6g")) == 0) {
chan_info.band = WLC_BAND_6G;
}
#endif /* WL_6G_BAND */
else if (strnicmp(band, "band=5g", strlen("band=5g")) == 0) {
chan_info.band = WLC_BAND_5G;
}
else if (strnicmp(band, "band=2g", strlen("band=2g")) == 0) {
chan_info.band = WLC_BAND_2G;
}
if (channel > 0) {
wl_ext_get_ioctl_ver(dev, &ioctl_ver);
ret = wl_ext_set_chanspec(dev, ioctl_ver, channel, &fw_chspec);
chan_info.chan = channel;
ret = wl_ext_set_chanspec(dev, &chan_info, &fw_chspec);
} else {
if (!(ret = wl_ext_ioctl(dev, WLC_GET_CHANNEL, &ci,
sizeof(channel_info_t), FALSE))) {
@@ -835,7 +874,7 @@ wl_ext_connect(struct net_device *dev, struct wl_conn_info *conn_info)
u32 chan_cnt = 0;
s8 *iovar_buf = NULL;
int ioctl_ver = 0;
char sec[32];
char sec[64];
wl_ext_get_ioctl_ver(dev, &ioctl_ver);
@@ -1041,9 +1080,9 @@ wl_ext_get_sec(struct net_device *dev, int ifmode, char *sec, int total_len, boo
}
bool
wl_ext_dfs_chan(uint16 chan)
wl_ext_dfs_chan(struct wl_chan_info *chan_info)
{
if (chan >= 52 && chan <= 144)
if (chan_info->band == WLC_BAND_5G && chan_info->chan >= 52 && chan_info->chan <= 144)
return TRUE;
return FALSE;
}
@@ -1053,6 +1092,7 @@ wl_ext_get_default_chan(struct net_device *dev,
uint16 *chan_2g, uint16 *chan_5g, bool nodfs)
{
struct dhd_pub *dhd = dhd_get_pub(dev);
struct wl_chan_info chan_info;
uint16 chan_tmp = 0, chan = 0;
wl_uint32_list_t *list;
u8 valid_chan_list[sizeof(u32)*(WL_NUMCHANNELS + 1)];
@@ -1074,7 +1114,9 @@ wl_ext_get_default_chan(struct net_device *dev,
if (chan_tmp <= 13 && !*chan_2g) {
*chan_2g = chan_tmp;
} else if (chan_tmp >= 36 && chan_tmp <= 161 && !*chan_5g) {
if (wl_ext_dfs_chan(chan_tmp) && nodfs)
chan_info.band = WLC_BAND_5G;
chan_info.chan = chan_tmp;
if (wl_ext_dfs_chan(&chan_info) && nodfs)
continue;
else
*chan_5g = chan_tmp;
@@ -2592,7 +2634,7 @@ wl_ext_get_country(struct net_device *dev, char *data, char *command,
if (data) {
char *country_code = data;
char *rev_info_delim = country_code + 2; /* 2 bytes of country code */
int revinfo = -1;
int revinfo = 0;
if ((rev_info_delim) &&
(strnicmp(rev_info_delim, "/", strlen("/")) == 0) && (rev_info_delim + 1)) {
revinfo = bcm_atoi(rev_info_delim + 1);
@@ -2686,6 +2728,7 @@ wl_ext_wl_iovar(struct net_device *dev, char *command, int total_len)
int bytes_written=-1;
const wl_ext_iovar_tpl_t *tpl = wl_ext_iovar_tpl_list;
int tpl_count = ARRAY_SIZE(wl_ext_iovar_tpl_list);
char *pEnd;
AEXT_TRACE(dev->name, "cmd %s\n", command);
pick_tmp = command;
@@ -2699,14 +2742,14 @@ wl_ext_wl_iovar(struct net_device *dev, char *command, int total_len)
goto exit;
memset(name, 0 , sizeof (name));
cmd = (int)simple_strtol(pch, NULL, 0);
if (cmd == 0) {
cmd = bcm_strtoul(pch, &pEnd, 0);
if (cmd == 0 || strlen(pEnd)) {
strcpy(name, pch);
}
data = bcmstrtok(&pick_tmp, "", 0); // pick data
if (data && cmd == 0) {
if (data && (cmd == 0|| strlen(pEnd))) {
cmd = WLC_SET_VAR;
} else if (cmd == 0) {
} else if (cmd == 0|| strlen(pEnd)) {
cmd = WLC_GET_VAR;
}
@@ -2884,6 +2927,85 @@ wl_android_ext_priv_cmd(struct net_device *net, char *command,
return ret;
}
#define CH_MIN_5G_CHANNEL 34
int
wl_construct_ctl_chanspec_list(struct net_device *dev, wl_uint32_list_t *chan_list)
{
void *list;
u32 i, channel;
chanspec_t chspec = 0;
s32 err = BCME_OK;
bool legacy_chan_info = FALSE;
u16 list_count;
#define LOCAL_BUF_LEN 4096
list = kmalloc(LOCAL_BUF_LEN, GFP_KERNEL);
if (list == NULL) {
WL_ERR(("failed to allocate local buf\n"));
return -ENOMEM;
}
err = wl_ext_iovar_getbuf(dev, "chan_info_list", NULL,
0, list, LOCAL_BUF_LEN, NULL);
if (err == BCME_UNSUPPORTED) {
err = wl_ext_iovar_getbuf(dev, "chanspecs", NULL,
0, list, LOCAL_BUF_LEN, NULL);
if (err != BCME_OK) {
WL_ERR(("get chanspecs err(%d)\n", err));
kfree(list);
return err;
}
/* Update indicating legacy chan info usage */
legacy_chan_info = TRUE;
} else if (err != BCME_OK) {
WL_ERR(("get chan_info_list err(%d)\n", err));
kfree(list);
return err;
}
list_count = legacy_chan_info ? ((wl_uint32_list_t *)list)->count :
((wl_chanspec_list_v1_t *)list)->count;
for (i = 0; i < dtoh32(list_count); i++) {
if (legacy_chan_info) {
chspec = (chanspec_t)dtoh32(((wl_uint32_list_t *)list)->element[i]);
} else {
chspec = (chanspec_t)dtoh32
(((wl_chanspec_list_v1_t *)list)->chspecs[i].chanspec);
}
chspec = wl_chspec_driver_to_host(chspec);
channel = wf_chspec_ctlchan(chspec);
if (!CHSPEC_IS20(chspec)) {
continue;
}
if (CHSPEC_IS2G(chspec) && (channel >= CH_MIN_2G_CHANNEL) &&
(channel <= CH_MAX_2G_CHANNEL)) {
chan_list->element[chan_list->count] = chspec;
chan_list->count++;
}
#ifdef WL_6G_BAND
else if (CHSPEC_IS6G(chspec) && (channel >= CH_MIN_6G_CHANNEL) &&
(channel <= CH_MAX_6G_CHANNEL)) {
if (channel == 2)
continue;
chan_list->element[chan_list->count] = chspec;
chan_list->count++;
}
#endif /* WL_6G_BAND */
else if (CHSPEC_IS5G(chspec) && (channel >= CH_MIN_5G_CHANNEL) &&
(channel <= 165)) {
chan_list->element[chan_list->count] = chspec;
chan_list->count++;
} else {
continue;
}
}
kfree(list);
#undef LOCAL_BUF_LEN
return err;
}
#if defined(WL_CFG80211) || defined(WL_ESCAN)
int
wl_ext_get_distance(struct net_device *net, u32 band)
@@ -2938,8 +3060,7 @@ wl_ext_get_best_channel(struct net_device *net,
#else
wl_scan_results_t *bss_list,
#endif /* BSSCACHE */
int ioctl_ver, int *best_2g_ch, int *best_5g_ch
)
int ioctl_ver, int *best_2g_ch, int *best_5g_ch, int *best_6g_ch)
{
struct wl_bss_info *bi = NULL; /* must be initialized */
s32 i, j;
@@ -2947,41 +3068,69 @@ wl_ext_get_best_channel(struct net_device *net,
wl_bss_cache_t *node;
#endif /* BSSCACHE */
int b_band[CH_MAX_2G_CHANNEL]={0}, a_band1[4]={0}, a_band4[5]={0};
s32 cen_ch, distance, distance_2g, distance_5g, ch, min_ap=999;
u8 valid_chan_list[sizeof(u32)*(WL_NUMCHANNELS + 1)];
#ifdef WL_6G_BAND
int six_g_band5[24]={0}, six_g_band6[5]={0}, six_g_band7[18]={0}, six_g_band8[13]={0};
s32 distance_6g;
#endif /* WL_6G_BAND */
s32 cen_ch, distance, distance_2g, distance_5g, chanspec, min_ap=999;
u8 valid_chan_list[sizeof(u32)*(MAX_CTRL_CHANSPECS + 1)];
wl_uint32_list_t *list;
int ret;
chanspec_t chanspec;
struct dhd_pub *dhd = dhd_get_pub(net);
chanspec_t chspec;
u32 channel;
memset(b_band, -1, sizeof(b_band));
memset(a_band1, -1, sizeof(a_band1));
memset(a_band4, -1, sizeof(a_band4));
#ifdef WL_6G_BAND
memset(six_g_band5, -1, sizeof(six_g_band5));
memset(six_g_band6, -1, sizeof(six_g_band6));
memset(six_g_band7, -1, sizeof(six_g_band7));
memset(six_g_band8, -1, sizeof(six_g_band8));
#endif /* WL_6G_BAND */
memset(valid_chan_list, 0, sizeof(valid_chan_list));
list = (wl_uint32_list_t *)(void *) valid_chan_list;
list->count = htod32(WL_NUMCHANNELS);
ret = wl_ext_ioctl(net, WLC_GET_VALID_CHANNELS, &valid_chan_list,
sizeof(valid_chan_list), 0);
if (ret<0) {
ret = wl_construct_ctl_chanspec_list(net, list);
if (ret < 0) {
AEXT_ERROR(net->name, "get channels failed with %d\n", ret);
return 0;
} else {
for (i = 0; i < dtoh32(list->count); i++) {
ch = dtoh32(list->element[i]);
if (!dhd_conf_match_channel(dhd, ch))
continue;
if (ch < CH_MAX_2G_CHANNEL)
b_band[ch-1] = 0;
else if (ch <= 48)
a_band1[(ch-36)/4] = 0;
else if (ch >= 149 && ch <= 161)
a_band4[(ch-149)/4] = 0;
for (i = 0; i < list->count; i++) {
chspec = list->element[i];
channel = wf_chspec_ctlchan(chspec);
if (CHSPEC_IS2G(chspec) && (channel >= CH_MIN_2G_CHANNEL) &&
(channel <= CH_MAX_2G_CHANNEL)) {
b_band[channel-1] = 0;
}
#ifdef WL_6G_BAND
else if (CHSPEC_IS6G(chspec) && (channel >= CH_MIN_6G_CHANNEL) &&
(channel <= CH_MAX_6G_CHANNEL)) {
if (channel <= 93)
six_g_band5[(channel-1)/4] = 0;
else if (channel >= 97 && channel <= 109)
six_g_band6[(channel-97)/4] = 0;
else if (channel >= 117 && channel <= 181)
six_g_band7[(channel-117)/4] = 0;
else if (channel >= 189 && channel <= 221)
six_g_band8[(channel-189)/4] = 0;
}
#endif /* WL_6G_BAND */
else if (CHSPEC_IS5G(chspec) && channel >= CH_MIN_5G_CHANNEL) {
if (channel <= 48)
a_band1[(channel-36)/4] = 0;
else if (channel >= 149 && channel <= 161)
a_band4[(channel-149)/4] = 0;
}
}
}
distance_2g = wl_ext_get_distance(net, WLC_BAND_2G);
distance_5g = wl_ext_get_distance(net, WLC_BAND_5G);
#ifdef WL_6G_BAND
distance_6g = wl_ext_get_distance(net, WLC_BAND_6G);
#endif /* WL_6G_BAND */
#if defined(BSSCACHE)
node = bss_cache_ctrl->m_cache_head;
@@ -3013,14 +3162,45 @@ wl_ext_get_best_channel(struct net_device *net,
if (b_band[j] >= 0 && abs(cen_ch-(1+j)) <= distance)
b_band[j] += 1;
}
} else {
}
#ifdef WL_6G_BAND
else if (CHSPEC_IS6G(chanspec)) {
distance += distance_6g;
if (cen_ch <= 93) {
for (j=0; j<ARRAYSIZE(a_band1); j++) {
if (six_g_band5[j] >= 0 && abs(cen_ch-(93+j*4)) <= distance)
six_g_band5[j] += 1;
}
}
else if (channel >= 97 && channel <= 109) {
for (j=0; j<ARRAYSIZE(a_band4); j++) {
if (six_g_band6[j] >= 0 && abs(cen_ch-(97+j*4)) <= distance)
six_g_band6[j] += 1;
}
}
else if (channel >= 117 && channel <= 181) {
for (j=0; j<ARRAYSIZE(a_band4); j++) {
if (six_g_band7[j] >= 0 && abs(cen_ch-(117+j*4)) <= distance)
six_g_band7[j] += 1;
}
}
else if (channel >= 189 && channel <= 221) {
for (j=0; j<ARRAYSIZE(a_band4); j++) {
if (six_g_band8[j] >= 0 && abs(cen_ch-(189+j*4)) <= distance)
six_g_band8[j] += 1;
}
}
}
#endif /* WL_6G_BAND */
else {
distance += distance_5g;
if (cen_ch <= 48) {
for (j=0; j<ARRAYSIZE(a_band1); j++) {
if (a_band1[j] >= 0 && abs(cen_ch-(36+j*4)) <= distance)
a_band1[j] += 1;
}
} else if (cen_ch >= 149) {
}
else if (cen_ch >= 149) {
for (j=0; j<ARRAYSIZE(a_band4); j++) {
if (a_band4[j] >= 0 && abs(cen_ch-(149+j*4)) <= distance)
a_band4[j] += 1;
@@ -3054,27 +3234,80 @@ wl_ext_get_best_channel(struct net_device *net,
*best_5g_ch = i*4 + 149;
}
}
#ifdef WL_6G_BAND
*best_6g_ch = 0;
min_ap = 999;
for (i=0; i<ARRAYSIZE(six_g_band5); i++) {
if(six_g_band5[i] < min_ap && six_g_band5[i] >= 0) {
min_ap = six_g_band5[i];
*best_6g_ch = i*4 + 1;
}
}
for (i=0; i<ARRAYSIZE(six_g_band6); i++) {
if(six_g_band6[i] < min_ap && six_g_band6[i] >= 0) {
min_ap = six_g_band6[i];
*best_6g_ch = i*4 + 97;
}
}
for (i=0; i<ARRAYSIZE(six_g_band7); i++) {
if(six_g_band7[i] < min_ap && six_g_band7[i] >= 0) {
min_ap = six_g_band7[i];
*best_6g_ch = i*4 + 117;
}
}
for (i=0; i<ARRAYSIZE(six_g_band8); i++) {
if(six_g_band8[i] < min_ap && six_g_band8[i] >= 0) {
min_ap = six_g_band8[i];
*best_6g_ch = i*4 + 189;
}
}
#endif /* WL_6G_BAND */
if (android_msg_level & ANDROID_INFO_LEVEL) {
struct bcmstrbuf strbuf;
char *tmp_buf = NULL;
tmp_buf = kmalloc(WLC_IOCTL_SMLEN, GFP_KERNEL);
tmp_buf = kmalloc(WLC_IOCTL_MEDLEN, GFP_KERNEL);
if (tmp_buf == NULL) {
AEXT_ERROR(net->name, "Failed to allocate buffer of %d bytes\n", WLC_IOCTL_SMLEN);
goto exit;
}
bcm_binit(&strbuf, tmp_buf, WLC_IOCTL_SMLEN);
bcm_binit(&strbuf, tmp_buf, WLC_IOCTL_MEDLEN);
bcm_bprintf(&strbuf, "2g: ");
for (j=0; j<ARRAYSIZE(b_band); j++)
bcm_bprintf(&strbuf, "%d/%d, ", b_band[j], 1+j);
bcm_bprintf(&strbuf, "\n");
bcm_bprintf(&strbuf, "5g band 1: ");
for (j=0; j<ARRAYSIZE(a_band1); j++)
bcm_bprintf(&strbuf, "%d/%d, ", a_band1[j], 36+j*4);
bcm_bprintf(&strbuf, "\n");
bcm_bprintf(&strbuf, "5g band 4: ");
for (j=0; j<ARRAYSIZE(a_band4); j++)
bcm_bprintf(&strbuf, "%d/%d, ", a_band4[j], 149+j*4);
bcm_bprintf(&strbuf, "\n");
bcm_bprintf(&strbuf, "best_2g_ch=%d, best_5g_ch=%d\n",
#ifdef WL_6G_BAND
bcm_bprintf(&strbuf, "6g band 5: ");
for (j=0; j<ARRAYSIZE(six_g_band5); j++)
bcm_bprintf(&strbuf, "%d/%d, ", six_g_band5[j], 1+j*4);
bcm_bprintf(&strbuf, "\n");
bcm_bprintf(&strbuf, "6g band 6: ");
for (j=0; j<ARRAYSIZE(six_g_band6); j++)
bcm_bprintf(&strbuf, "%d/%d, ", six_g_band6[j], 97+j*4);
bcm_bprintf(&strbuf, "\n");
bcm_bprintf(&strbuf, "6g band 7: ");
for (j=0; j<ARRAYSIZE(six_g_band7); j++)
bcm_bprintf(&strbuf, "%d/%d, ", six_g_band7[j], 117+j*4);
bcm_bprintf(&strbuf, "\n");
bcm_bprintf(&strbuf, "6g band 8: ");
for (j=0; j<ARRAYSIZE(six_g_band8); j++)
bcm_bprintf(&strbuf, "%d/%d, ", six_g_band8[j], 189+j*4);
bcm_bprintf(&strbuf, "\n");
#endif /* WL_6G_BAND */
bcm_bprintf(&strbuf, "best_2g_ch=%d, best_5g_ch=%d",
*best_2g_ch, *best_5g_ch);
#ifdef WL_6G_BAND
bcm_bprintf(&strbuf, ", best_6g_ch=%d", *best_6g_ch);
#endif /* WL_6G_BAND */
bcm_bprintf(&strbuf, "\n");
AEXT_INFO(net->name, "\n%s", strbuf.origbuf);
if (tmp_buf) {
kfree(tmp_buf);
@@ -3094,6 +3327,7 @@ wl_ext_fw_apcs(struct net_device *dev, uint32 band)
int channel = 0, chosen = 0, retry = 0, ret = 0, spect = 0;
u8 *reqbuf = NULL;
uint32 buf_size;
chanspec_band_t acs_band = WLC_BAND_INVALID;
ret = wldev_ioctl_get(dev, WLC_GET_SPECT_MANAGMENT, &spect, sizeof(spect));
if (ret) {
@@ -3116,35 +3350,20 @@ wl_ext_fw_apcs(struct net_device *dev, uint32 band)
}
memset(reqbuf, 0, CHANSPEC_BUF_SIZE);
if (band == WLC_BAND_AUTO) {
AEXT_INFO(dev->name, "ACS full channel scan \n");
reqbuf[0] = htod32(0);
} else if (band == WLC_BAND_5G) {
AEXT_INFO(dev->name, "ACS 5G band scan \n");
ret = wl_android_get_band_chanspecs(dev, (void *)reqbuf, CHANSPEC_BUF_SIZE,
WL_CHANSPEC_BAND_5G, false);
if (ret < 0) {
AEXT_ERROR(dev->name, "ACS 5g chanspec retreival failed! \n");
goto done;
}
} else if (band == WLC_BAND_2G) {
/*
* If channel argument is not provided/ argument 20 is provided,
* Restrict channel to 2GHz, 20MHz BW, No SB
*/
AEXT_INFO(dev->name, "ACS 2G band scan \n");
ret = wl_android_get_band_chanspecs(dev, (void *)reqbuf, CHANSPEC_BUF_SIZE,
WL_CHANSPEC_BAND_2G, false);
if (ret < 0) {
AEXT_ERROR(dev->name, "ACS 2g chanspec retreival failed! \n");
goto done;
}
} else {
AEXT_ERROR(dev->name, "ACS: No band chosen\n");
acs_band = wl_ext_wlcband_to_chanspec_band(band);
if ((uint32)acs_band == WLC_BAND_INVALID) {
acs_band = WL_CHANSPEC_BAND_2G;
}
if ((ret = wl_android_get_band_chanspecs(dev, reqbuf, CHANSPEC_BUF_SIZE,
acs_band, true)) < 0) {
WL_ERR(("ACS chanspec retrieval failed!\n"));
goto done;
}
buf_size = (band == WLC_BAND_AUTO) ? sizeof(int) : CHANSPEC_BUF_SIZE;
AEXT_INFO(dev->name, "ACS chanspec band 0x%x\n", acs_band);
buf_size = CHANSPEC_BUF_SIZE;
ret = wldev_ioctl_set(dev, WLC_START_CHANNEL_SEL, (void *)reqbuf,
buf_size);
if (ret < 0) {
@@ -3154,7 +3373,7 @@ wl_ext_fw_apcs(struct net_device *dev, uint32 band)
}
/* Wait for auto channel selection, max 3000 ms */
if ((band == WLC_BAND_2G) || (band == WLC_BAND_5G)) {
if ((band == WLC_BAND_2G) || (band == WLC_BAND_5G) || (band == WLC_BAND_6G)) {
OSL_SLEEP(500);
} else {
/*
@@ -3174,24 +3393,12 @@ wl_ext_fw_apcs(struct net_device *dev, uint32 band)
chosen = dtoh32(chosen);
}
if (chosen) {
int chosen_band;
int apcs_band;
#ifdef D11AC_IOTYPES
if (wl_cfg80211_get_ioctl_version() == 1) {
channel = LCHSPEC_CHANNEL((chanspec_t)chosen);
} else {
channel = CHSPEC_CHANNEL((chanspec_t)chosen);
}
#else
channel = CHSPEC_CHANNEL((chanspec_t)chosen);
#endif /* D11AC_IOTYPES */
apcs_band = (band == WLC_BAND_AUTO) ? WLC_BAND_2G : band;
chosen_band = (channel <= CH_MAX_2G_CHANNEL) ? WLC_BAND_2G : WLC_BAND_5G;
if (apcs_band == chosen_band) {
WL_MSG(dev->name, "selected channel = %d\n", channel);
break;
}
if (wf_chspec_valid((chanspec_t)chosen)) {
channel = wf_chspec_ctlchan((chanspec_t)chosen);
acs_band = CHSPEC_BAND((chanspec_t)chosen);
WL_MSG(dev->name, "selected channel = %d(band %d)\n",
channel, CHSPEC2WLC_BAND((chanspec_t)chosen));
break;
}
AEXT_INFO(dev->name, "%d tried, ret = %d, chosen = 0x%x\n",
(APCS_MAX_RETRY - retry), ret, chosen);
@@ -3228,18 +3435,35 @@ wl_ext_drv_scan(struct net_device *dev, uint32 band, bool fast_scan)
}
memset(&scan_info, 0, sizeof(wl_scan_info_t));
if (band == WLC_BAND_2G || band == WLC_BAND_AUTO) {
for (i=0; i<13; i++)
scan_info.channels.channel[i] = i + 1;
for (i=0; i<13; i++) {
scan_info.channels.channel[i+cnt] = wf_create_chspec_from_primary(i+1,
WL_CHANSPEC_BW_20, WL_CHANSPEC_BAND_2G);
}
cnt += 13;
}
if (band == WLC_BAND_5G || band == WLC_BAND_AUTO) {
for (i=0; i<4; i++)
scan_info.channels.channel[i+cnt] = 36 + i*4;
for (i=0; i<4; i++) {
scan_info.channels.channel[i+cnt] = wf_create_chspec_from_primary(36+i*4,
WL_CHANSPEC_BW_20, WL_CHANSPEC_BAND_5G);
}
cnt += 4;
for (i=0; i<4; i++)
scan_info.channels.channel[i+cnt] = 149 + i*4;
for (i=0; i<4; i++) {
scan_info.channels.channel[i+cnt] = wf_create_chspec_from_primary(149+i*4,
WL_CHANSPEC_BW_20, WL_CHANSPEC_BAND_5G);
}
cnt += 4;
}
#ifdef WL_6G_BAND
if (band == WLC_BAND_6G || band == WLC_BAND_AUTO) {
for (i=0; i<59; i++) {
scan_info.channels.channel[i+cnt] = wf_create_chspec_from_primary(1+i*4,
WL_CHANSPEC_BW_20, WL_CHANSPEC_BAND_6G);
}
cnt += 59;
}
#endif /* WL_6G_BAND */
if (band == WLC_BAND_2G)
fast_scan = FALSE;
scan_info.channels.count = cnt;
if (fast_scan)
scan_info.scan_time = 40;
@@ -3279,6 +3503,10 @@ wl_ext_drv_apcs(struct net_device *dev, uint32 band)
if (escan->escan_state == ESCAN_STATE_IDLE) {
if (band == WLC_BAND_5G)
channel = escan->best_5g_ch;
#ifdef WL_6G_BAND
else if (band == WLC_BAND_6G)
channel = escan->best_6g_ch;
#endif /* WL_6G_BAND */
else
channel = escan->best_2g_ch;
WL_MSG(dev->name, "selected channel = %d\n", channel);
@@ -4039,4 +4267,3 @@ wl_release_bss_cache_ctrl(wl_bss_cache_ctrl_t *bss_cache_ctrl)
wl_free_bss_cache(bss_cache_ctrl);
}
#endif /* BSSCACHE */

View File

@@ -1,6 +1,12 @@
#ifndef _wl_android_ext_
#define _wl_android_ext_
typedef struct wl_chan_info {
uint band;
uint16 chan;
} wl_chan_info_t;
typedef struct bcol_gtk_para {
int enable;
int ptk_len;
@@ -10,6 +16,7 @@ typedef struct bcol_gtk_para {
#define ACS_FW_BIT (1<<0)
#define ACS_DRV_BIT (1<<1)
int wl_ext_autochannel(struct net_device *dev, uint acs, uint32 band);
chanspec_band_t wl_ext_wlcband_to_chanspec_band(int band);
int wl_android_ext_priv_cmd(struct net_device *net, char *command, int total_len,
int *bytes_written);
void wl_ext_get_sec(struct net_device *dev, int ifmode, char *sec, int total_len, bool dump);
@@ -19,6 +26,7 @@ int wl_ext_set_scan_time(struct net_device *dev, int scan_time,
void wl_ext_wait_event_complete(struct dhd_pub *dhd, int ifidx);
int wl_ext_add_del_ie(struct net_device *dev, uint pktflag, char *ie_data, const char* add_del_cmd);
#ifdef WL_ESCAN
int wl_construct_ctl_chanspec_list(struct net_device *dev, wl_uint32_list_t *chan_list);
int wl_ext_drv_scan(struct net_device *dev, uint band, bool fast_scan);
#endif
#ifdef WL_EXT_GENL
@@ -41,11 +49,11 @@ int wl_ext_iovar_setbuf_bsscfg(struct net_device *dev, s8 *iovar_name,
struct mutex* buf_sync);
chanspec_t wl_ext_chspec_driver_to_host(int ioctl_ver, chanspec_t chanspec);
chanspec_t wl_ext_chspec_host_to_driver(int ioctl_ver, chanspec_t chanspec);
bool wl_ext_dfs_chan(uint16 chan);
bool wl_ext_dfs_chan(struct wl_chan_info *chan_info);
uint16 wl_ext_get_default_chan(struct net_device *dev,
uint16 *chan_2g, uint16 *chan_5g, bool nodfs);
int wl_ext_set_chanspec(struct net_device *dev, int ioctl_ver,
uint16 channel, chanspec_t *ret_chspec);
int wl_ext_set_chanspec(struct net_device *dev, struct wl_chan_info *chan_info,
chanspec_t *ret_chspec);
int wl_ext_get_ioctl_ver(struct net_device *dev, int *ioctl_ver);
#endif
#if defined(WL_CFG80211) || defined(WL_ESCAN)
@@ -117,7 +125,7 @@ void wl_free_rssi_cache(wl_rssi_cache_ctrl_t *rssi_cache_ctrl);
void wl_delete_dirty_rssi_cache(wl_rssi_cache_ctrl_t *rssi_cache_ctrl);
void wl_delete_disconnected_rssi_cache(wl_rssi_cache_ctrl_t *rssi_cache_ctrl, u8 *bssid);
void wl_reset_rssi_cache(wl_rssi_cache_ctrl_t *rssi_cache_ctrl);
void wl_update_rssi_cache(wl_rssi_cache_ctrl_t *rssi_cache_ctrl, wl_scan_results_t *ss_list);
void wl_update_rssi_cache(wl_rssi_cache_ctrl_t *rssi_cache_ctrl, wl_scan_results_v109_t *ss_list);
int wl_update_connected_rssi_cache(struct net_device *net, wl_rssi_cache_ctrl_t *rssi_cache_ctrl, int *rssi_avg);
int16 wl_get_avg_rssi(wl_rssi_cache_ctrl_t *rssi_cache_ctrl, void *addr);
#endif
@@ -145,7 +153,7 @@ typedef struct wl_bss_cache {
struct wl_bss_cache *next;
int dirty;
struct osl_timespec tv;
wl_scan_results_t results;
wl_scan_results_v109_t results;
} wl_bss_cache_t;
typedef struct wl_bss_cache_ctrl {
@@ -161,16 +169,27 @@ void wl_update_bss_cache(wl_bss_cache_ctrl_t *bss_cache_ctrl,
#if defined(RSSIAVG)
wl_rssi_cache_ctrl_t *rssi_cache_ctrl,
#endif
wl_scan_results_t *ss_list);
wl_scan_results_v109_t *ss_list);
void wl_release_bss_cache_ctrl(wl_bss_cache_ctrl_t *bss_cache_ctrl);
#endif
int wl_ext_get_best_channel(struct net_device *net,
#if defined(BSSCACHE)
wl_bss_cache_ctrl_t *bss_cache_ctrl,
#else
wl_scan_results_t *bss_list,
wl_scan_results_v109_t *bss_list,
#endif
int ioctl_ver, int *best_2g_ch, int *best_5g_ch
int ioctl_ver, int *best_2g_ch, int *best_5g_ch, int *best_6g_ch
);
#endif
#ifdef WL_6G_BAND
#define CHSPEC2BANDSTR(chspec) (CHSPEC_IS2G(chspec) ? "2g" : CHSPEC_IS5G(chspec) ? \
"5g" : CHSPEC_IS6G(chspec) ? "6g" : "0g")
#define WLCBAND2STR(band) ((band == WLC_BAND_2G) ? "2g" : (band == WLC_BAND_5G) ? \
"5g" : (band == WLC_BAND_6G) ? "6g" : "0g")
#else
#define CHSPEC2BANDSTR(chspec) (CHSPEC_IS2G(chspec) ? "2g" : CHSPEC_IS5G(chspec) ? \
"5g" : "0g")
#define WLCBAND2STR(band) ((band == WLC_BAND_2G) ? "2g" : (band == WLC_BAND_5G) ? \
"5g" : "0g")
#endif /* WL_6G_BAND */
#endif

View File

@@ -3719,15 +3719,19 @@ wl_cfg80211_post_ifcreate(struct net_device *ndev,
#ifdef WLDWDS
/* set wds0.x to 4addr interface here */
if (event->role == WLC_E_IF_ROLE_WDS) {
WL_MSG(ndev->name, "set vwdev 4addr to %s\n", event->name);
struct dhd_if *ifp = dhd_get_ifp(cfg->pub, event->ifidx);
ifp->dwds = TRUE;
WL_MSG(event->name, "set to 4addr\n");
wdev->use_4addr = true;
}
#endif /* WLDWDS */
SET_NETDEV_DEV(new_ndev, wiphy_dev(wdev->wiphy));
memcpy(new_ndev->dev_addr, addr, ETH_ALEN);
dev_addr_set(new_ndev, addr);
#ifdef WL_EXT_IAPSTA
wl_ext_iapsta_ifadding(new_ndev, event->ifidx);
if (event->role != WLC_E_IF_ROLE_WDS) {
wl_ext_iapsta_ifadding(new_ndev, event->ifidx);
}
#endif /* WL_EXT_IAPSTA */
if (wl_cfg80211_register_if(cfg, event->ifidx, new_ndev, rtnl_lock_reqd)
!= BCME_OK) {
@@ -3759,7 +3763,7 @@ wl_cfg80211_post_ifcreate(struct net_device *ndev,
wl_set_drv_status(cfg, AP_CREATING, new_ndev);
}
#ifdef WL_EXT_IAPSTA
wl_ext_iapsta_update_iftype(new_ndev, event->ifidx, wl_iftype);
wl_ext_iapsta_update_iftype(new_ndev, wl_iftype);
#endif
WL_INFORM_MEM(("Network Interface (%s) registered with host."
@@ -4190,10 +4194,11 @@ wl_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *dev,
s32 err = 0;
size_t join_params_size;
chanspec_t chanspec = 0;
char sec[64];
WL_TRACE(("In\n"));
RETURN_EIO_IF_NOT_UP(cfg);
WL_INFORM_MEM(("IBSS JOIN BSSID:" MACDBG "\n", MAC2STRDBG(params->bssid)));
WL_INFORM_MEM(("IBSS JOIN\n"));
if (!params->ssid || params->ssid_len <= 0 ||
params->ssid_len > DOT11_MAX_SSID_LEN) {
WL_ERR(("Invalid parameter\n"));
@@ -4205,7 +4210,12 @@ wl_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *dev,
chan = params->channel;
#endif /* WL_CFG80211_P2P_DEV_IF */
if (chan) {
cfg->channel = wl_freq_to_chanspec(chan->center_freq);
#ifdef WL_EXT_IAPSTA
chanspec = wl_freq_to_chanspec(chan->center_freq);
wl_ext_iapsta_update_iftype(dev, WL_IF_TYPE_IBSS);
chanspec = wl_ext_iapsta_update_channel(dev, chanspec);
#endif /* WL_EXT_IAPSTA */
cfg->channel = chanspec;
}
if (wl_get_drv_status(cfg, CONNECTED, dev)) {
struct wlc_ssid *lssid = (struct wlc_ssid *)wl_read_prof(cfg, dev, WL_PROF_SSID);
@@ -4228,6 +4238,7 @@ wl_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *dev,
bss = cfg80211_get_ibss(wiphy, NULL, params->ssid, params->ssid_len);
if (!bss) {
if (IBSS_INITIAL_SCAN_ALLOWED == TRUE) {
int retry = 4;
memcpy(ssid.ssid, params->ssid, params->ssid_len);
ssid.ssid_len = params->ssid_len;
do {
@@ -4245,7 +4256,13 @@ wl_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *dev,
*/
/* wait 4 secons till scan done.... */
schedule_timeout_interruptible(msecs_to_jiffies(4000));
// schedule_timeout_interruptible(msecs_to_jiffies(4000));
while (retry--) {
if (!wl_get_drv_status_all(cfg, SCANNING)) {
break;
}
wl_delay(150);
}
bss = cfg80211_get_ibss(wiphy, NULL,
params->ssid, params->ssid_len);
@@ -4314,6 +4331,10 @@ wl_cfg80211_join_ibss(struct wiphy *wiphy, struct net_device *dev,
wldev_iovar_setint(dev, "wpa_auth", WPA_AUTH_DISABLED);
wldev_iovar_setint(dev, "wsec", 0);
wl_ext_get_sec(dev, 0, sec, sizeof(sec), TRUE);
WL_MSG(dev->name, "Join IBSS %pM ssid \"%s\", len (%d), channel=%d, sec=%s\n",
&join_params.params.bssid, join_params.ssid.SSID, join_params.ssid.SSID_len,
wf_chspec_ctlchan(chanspec), sec);
err = wldev_ioctl_set(dev, WLC_SET_SSID, &join_params,
join_params_size);
if (unlikely(err)) {
@@ -4352,7 +4373,7 @@ static s32 wl_cfg80211_leave_ibss(struct wiphy *wiphy, struct net_device *dev)
RETURN_EIO_IF_NOT_UP(cfg);
wl_link_down(cfg);
WL_INFORM_MEM(("Leave IBSS\n"));
WL_MSG(dev->name, "Leave IBSS\n");
curbssid = wl_read_prof(cfg, dev, WL_PROF_BSSID);
wl_set_drv_status(cfg, DISCONNECTING, dev);
scbval.val = 0;
@@ -6171,7 +6192,7 @@ void
wl_conn_debug_info(struct bcm_cfg80211 *cfg, struct net_device *dev, wlcfg_assoc_info_t *info)
{
struct wl_security *sec = wl_read_prof(cfg, dev, WL_PROF_SEC);
char sec_info[32];
char sec_info[64];
u32 chanspec = info->chanspecs[0];
u32 chan_cnt = info->chan_cnt;
s32 cur_rssi = 0, target_rssi = 0;
@@ -6191,14 +6212,16 @@ wl_conn_debug_info(struct bcm_cfg80211 *cfg, struct net_device *dev, wlcfg_assoc
if (!err)
cur_rssi = dtoh32(scb_val.val);
WL_MSG(dev->name, "Reconnecting with " MACDBG " ssid \"%s\", len (%d), "
"channel=%d(chan_cnt=%d), sec=%s, rssi=%d => %d\n",
"channel=%s-%d(chan_cnt=%d), sec=%s, rssi=%d => %d\n",
MAC2STRDBG((u8*)(&info->bssid)), info->ssid, info->ssid_len,
wf_chspec_ctlchan(chanspec), chan_cnt, sec_info, cur_rssi, target_rssi);
CHSPEC2BANDSTR(chanspec), wf_chspec_ctlchan(chanspec), chan_cnt,
sec_info, cur_rssi, target_rssi);
} else {
WL_MSG(dev->name, "Connecting with " MACDBG " ssid \"%s\", len (%d), "
"channel=%d(chan_cnt=%d), sec=%s, rssi=%d\n",
"channel=%s-%d(chan_cnt=%d), sec=%s, rssi=%d\n",
MAC2STRDBG((u8*)(&info->bssid)), info->ssid, info->ssid_len,
wf_chspec_ctlchan(chanspec), chan_cnt, sec_info, target_rssi);
CHSPEC2BANDSTR(chanspec), wf_chspec_ctlchan(chanspec), chan_cnt,
sec_info, target_rssi);
}
if (wl_dbg_level & WL_DBG_DBG) {
WL_MSG(dev->name, "akm:0x%x auth:0x%x wpaver:0x%x pwise:0x%x gwise:0x%x\n",
@@ -6251,7 +6274,7 @@ wl_handle_join(struct bcm_cfg80211 *cfg,
}
#ifdef WL_EXT_IAPSTA
wl_ext_iapsta_update_channel(dev, wf_chspec_ctlchan(assoc_info->chanspecs[0]));
wl_ext_iapsta_update_channel(dev, assoc_info->chanspecs[0]);
#endif
/* print relevant info for debug purpose */
wl_conn_debug_info(cfg, dev, assoc_info);
@@ -6304,7 +6327,7 @@ wl_handle_reassoc(struct bcm_cfg80211 *cfg, struct net_device *dev,
reassoc_params->chanspec_num = htod32(chan_cnt);
#ifdef WL_EXT_IAPSTA
wl_ext_iapsta_update_channel(dev, wf_chspec_ctlchan(chanspec));
wl_ext_iapsta_update_channel(dev, chanspec);
#endif
/* print relevant info for debug purpose */
wl_conn_debug_info(cfg, dev, info);
@@ -7793,7 +7816,7 @@ wl_cfg80211_get_station(struct wiphy *wiphy, struct net_device *dev,
STA_INFO_BIT(INFO_TX_PACKETS) |
STA_INFO_BIT(INFO_TX_FAILED));
get_station_err:
#ifndef BCMDBUS
#if 0
if (err && (err != -ENODATA)) {
/* Disconnect due to zero BSSID or error to get RSSI */
scb_val_t scbval;
@@ -10316,6 +10339,35 @@ s32 wl_mode_to_nl80211_iftype(s32 mode)
return err;
}
static bool
wl_is_ccode_change_allowed(struct net_device *net)
{
struct wireless_dev *wdev = ndev_to_wdev(net);
struct wiphy *wiphy = wdev->wiphy;
struct bcm_cfg80211 *cfg = wiphy_priv(wiphy);
struct net_info *iter, *next;
/* Country code isn't allowed change on AP/GO, NDP established */
GCC_DIAGNOSTIC_PUSH_SUPPRESS_CAST();
for_each_ndev(cfg, iter, next) {
GCC_DIAGNOSTIC_POP();
if (iter->ndev) {
if (wl_get_drv_status(cfg, AP_CREATED, iter->ndev)) {
WL_ERR(("AP active. skip coutry ccode change"));
return false;
}
}
}
#ifdef WL_NAN
if (wl_cfgnan_is_enabled(cfg) && wl_cfgnan_is_dp_active(net)) {
WL_ERR(("NDP established. skip coutry ccode change"));
return false;
}
#endif /* WL_NAN */
return true;
}
static bool
wl_is_ccode_change_required(struct net_device *net,
char *country_code, int revinfo)
@@ -10394,6 +10446,73 @@ wl_cfg80211_cleanup_connection(struct net_device *net, bool user_enforced)
#endif /* WL_NAN */
}
static int wl_copy_regd(const struct ieee80211_regdomain *regd_orig,
struct ieee80211_regdomain *regd_copy)
{
int i;
if (memcpy_s(regd_copy, sizeof(*regd_copy), regd_orig, sizeof(*regd_orig))) {
return BCME_ERROR;
}
for (i = 0; i < regd_orig->n_reg_rules; i++) {
if (memcpy_s(&regd_copy->reg_rules[i], sizeof(regd_copy->reg_rules[i]),
&regd_orig->reg_rules[i], sizeof(regd_orig->reg_rules[i]))) {
return BCME_ERROR;
}
}
return BCME_OK;
}
static void wl_notify_regd(struct wiphy *wiphy, char *country_code)
{
struct ieee80211_regdomain *regd_copy = NULL;
int regd_len;
struct bcm_cfg80211 *cfg = wiphy_priv(wiphy);
regd_len = sizeof(brcm_regdom) + (brcm_regdom.n_reg_rules *
sizeof(struct ieee80211_reg_rule));
regd_copy = (struct ieee80211_regdomain *)MALLOCZ(cfg->osh, regd_len);
if (!regd_copy) {
WL_ERR(("failed to alloc regd_copy\n"));
return;
}
/* the upper layer function below requires non-const type */
if (wl_copy_regd(&brcm_regdom, regd_copy)) {
WL_ERR(("failed to copy new regd\n"));
goto exit;
}
if (country_code) {
if (memcpy_s(regd_copy->alpha2, sizeof(regd_copy->alpha2),
country_code, WL_CCODE_LEN)) {
WL_ERR(("failed to copy new ccode:%s\n", country_code));
goto exit;
}
}
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 0, 0))
if (rtnl_is_locked()) {
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 12, 0))
wiphy_lock(wiphy);
regulatory_set_wiphy_regd_sync(wiphy, regd_copy);
wiphy_unlock(wiphy);
#else
regulatory_set_wiphy_regd_sync_rtnl(wiphy, regd_copy);
#endif /* LINUX_VERSION > 5.12.0 */
} else {
regulatory_set_wiphy_regd(wiphy, regd_copy);
}
#else
wiphy_apply_custom_regulatory(wiphy, regd_copy);
#endif /* LINUX_VERSION > 4.0.0 */
exit:
MFREE(cfg->osh, regd_copy, regd_len);
return;
}
s32
wl_cfg80211_set_country_code(struct net_device *net, char *country_code,
bool notify, bool user_enforced, int revinfo)
@@ -10415,12 +10534,25 @@ wl_cfg80211_set_country_code(struct net_device *net, char *country_code,
goto exit;
}
if (wl_is_ccode_change_allowed(net) == false) {
WL_ERR(("country code change isn't allowed during AP role/NAN connected\n"));
ret = BCME_EPERM;
goto exit;
}
wl_cfg80211_cleanup_connection(net, user_enforced);
/* Store before applying - so that if event comes earlier that is handled properly */
if (strlcpy(cfg->country, country_code, WL_CCODE_LEN) >= WLC_CNTRY_BUF_SZ) {
WL_ERR(("country code copy failed :%d\n", ret));
goto exit;
}
ret = wldev_set_country(net, country_code,
notify, revinfo);
if (ret < 0) {
WL_ERR(("set country Failed :%d\n", ret));
bzero(cfg->country, sizeof(cfg->country));
goto exit;
}
@@ -10430,10 +10562,12 @@ wl_cfg80211_set_country_code(struct net_device *net, char *country_code,
*/
if (!IS_REGDOM_SELF_MANAGED(wiphy)) {
regulatory_hint(wiphy, country_code);
} else {
wl_notify_regd(wiphy, country_code);
}
exit:
return ret;
return OSL_ERROR(ret);
}
#ifdef CONFIG_CFG80211_INTERNAL_REGDB
@@ -10521,12 +10655,10 @@ static
void wl_config_custom_regulatory(struct wiphy *wiphy)
{
#if defined(WL_SELF_MANAGED_REGDOM) && \
(LINUX_VERSION_CODE >= KERNEL_VERSION(4, 0, 0))
#if defined(WL_SELF_MANAGED_REGDOM) && (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 0, 0))
/* Use self managed regulatory domain */
wiphy->regulatory_flags |= REGULATORY_WIPHY_SELF_MANAGED |
REGULATORY_IGNORE_STALE_KICKOFF;
wiphy->regd = &brcm_regdom;
WL_DBG(("Self managed regdom\n"));
return;
#else /* WL_SELF_MANAGED_REGDOM && KERNEL >= 4.0 */
@@ -10540,7 +10672,7 @@ void wl_config_custom_regulatory(struct wiphy *wiphy)
#else /* KERNEL VER >= 3.14 */
wiphy->flags |= WIPHY_FLAG_CUSTOM_REGULATORY;
#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) */
wiphy_apply_custom_regulatory(wiphy, &brcm_regdom);
wl_notify_regd(wiphy, NULL);
WL_DBG(("apply custom regulatory\n"));
#endif /* WL_SELF_MANAGED_REGDOM && KERNEL >= 4.0 */
}
@@ -10753,13 +10885,6 @@ static s32 wl_setup_wiphy(struct wireless_dev *wdev, struct device *sdiofunc_dev
wdev->wiphy->max_num_csa_counters = WL_MAX_NUM_CSA_COUNTERS;
#endif /* LINUX_VERSION_CODE > KERNEL_VERSION(3, 12, 0) */
/* Now we can register wiphy with cfg80211 module */
err = wiphy_register(wdev->wiphy);
if (unlikely(err < 0)) {
WL_ERR(("Couldn not register wiphy device (%d)\n", err));
wiphy_free(wdev->wiphy);
}
#if ((LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0)) && \
(LINUX_VERSION_CODE <= KERNEL_VERSION(3, 3, 0))) && defined(WL_IFACE_COMB_NUM_CHANNELS)
/* Workaround for a cfg80211 bug */
@@ -10791,6 +10916,23 @@ static s32 wl_setup_wiphy(struct wireless_dev *wdev, struct device *sdiofunc_dev
wdev->wiphy->features |= NL80211_FEATURE_LOW_PRIORITY_SCAN;
#endif /* WL_SCAN_TYPE */
/* Now we can register wiphy with cfg80211 module */
err = wiphy_register(wdev->wiphy);
if (unlikely(err < 0)) {
WL_ERR(("Couldn not register wiphy device (%d)\n", err));
wiphy_free(wdev->wiphy);
return err;
}
/* set wiphy->regd through reg_process_self_managed_hints
* need to call it after wiphy_register
* since wiphy_register adds rdev to cfg80211_rdev_list
*/
if (IS_REGDOM_SELF_MANAGED(wdev->wiphy)) {
rtnl_lock();
wl_notify_regd(wdev->wiphy, NULL);
rtnl_unlock();
}
return err;
}
@@ -10815,8 +10957,7 @@ static void wl_free_wdev(struct bcm_cfg80211 *cfg)
wdev->wiphy->wowlan = NULL;
#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0) */
#endif /* CONFIG_PM && WL_CFG80211_P2P_DEV_IF */
#if defined(WL_SELF_MANAGED_REGDOM) && \
(LINUX_VERSION_CODE >= KERNEL_VERSION(4, 0, 0))
#if defined(WL_SELF_MANAGED_REGDOM) && (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 0, 0))
/* Making regd ptr NULL, to avoid reference/freeing by regulatory unregister */
wiphy->regd = NULL;
#endif /* WL_SELF_MANAGED_REGDOM && KERNEL >= 4.0 */
@@ -11308,9 +11449,8 @@ wl_notify_connect_status_ibss(struct bcm_cfg80211 *cfg, struct net_device *ndev,
MACDBG "), ignore it\n", MAC2STRDBG(cur_bssid)));
return err;
}
WL_INFORM_MEM(("[%s] IBSS BSSID is changed from " MACDBG " to " MACDBG "\n",
ndev->name, MAC2STRDBG(cur_bssid),
MAC2STRDBG((const u8 *)&e->addr)));
WL_MSG(ndev->name, "IBSS BSSID is changed from " MACDBG " to " MACDBG "\n",
MAC2STRDBG(cur_bssid), MAC2STRDBG((const u8 *)&e->addr));
wl_get_assoc_ies(cfg, ndev);
wl_update_prof(cfg, ndev, NULL, (const void *)&e->addr, WL_PROF_BSSID);
wl_update_bss_info(cfg, ndev, false);
@@ -11322,8 +11462,8 @@ wl_notify_connect_status_ibss(struct bcm_cfg80211 *cfg, struct net_device *ndev,
}
else {
/* New connection */
WL_INFORM_MEM(("[%s] IBSS connected to " MACDBG "\n",
ndev->name, MAC2STRDBG((const u8 *)&e->addr)));
WL_MSG(ndev->name, "IBSS connected to " MACDBG "\n",
MAC2STRDBG((const u8 *)&e->addr));
wl_link_up(cfg);
wl_get_assoc_ies(cfg, ndev);
wl_update_prof(cfg, ndev, NULL, (const void *)&e->addr, WL_PROF_BSSID);
@@ -13800,6 +13940,7 @@ wl_bss_connect_done(struct bcm_cfg80211 *cfg, struct net_device *ndev,
WL_ERR(("ssid_len=0. Indicate assoc event failure\n"));
completed = false;
sec->auth_assoc_res_status = WLAN_STATUS_UNSPECIFIED_FAILURE;
wl_clr_drv_status(cfg, CONNECTED, ndev);
}
}
@@ -14459,19 +14600,76 @@ exit:
return err;
}
#ifdef CUSTOMER_HW6
static void
wl_map_brcm_specifc_country_code(char *country_code)
{
/* If country code is default locale, change the domain to world domain
* Default locale formats: AA, ZZ, XA-XZ, QM-QZ
*/
if (!strcmp("AA", country_code) || !strcmp("ZZ", country_code) ||
((country_code[0] == 'X') && (country_code[1] >= 'A') &&
(country_code[1] <= 'Z')) || ((country_code[0] == 'Q') &&
(country_code[1] >= 'M') && (country_code[1] <= 'Z'))) {
WL_DBG(("locale mapped to world domain\n"));
country_code[0] = '0';
country_code[1] = '0';
}
}
static s32
wl_cfg80211_ccode_evt_handler(struct bcm_cfg80211 *cfg, bcm_struct_cfgdev *cfgdev,
const wl_event_msg_t *event, void *data)
{
s32 err = 0;
struct wiphy *wiphy = bcmcfg_to_wiphy(cfg);
char country_str[WLC_CNTRY_BUF_SZ] = { 0 };
struct net_device *dev = bcmcfg_to_prmry_ndev(cfg);
wl_country_t cspec = {{0}, 0, {0}};
if (strlcpy(country_str, data, WL_CCODE_LEN + 1) >= WLC_CNTRY_BUF_SZ) {
return -EINVAL;
}
if (strncmp(cfg->country, country_str, WL_CCODE_LEN) == 0) {
/* If country code is updated from command context, skip wiphy update */
WL_MSG(dev->name, "No change in country (%s)\n", country_str);
return BCME_OK;
}
WL_MSG(dev->name, "Updating new country %s\n", country_str);
strlcpy(cspec.country_abbrev, country_str, WL_CCODE_LEN + 1);
strlcpy(cspec.ccode, country_str, WL_CCODE_LEN + 1);
err = dhd_conf_map_country_list(dhd_get_pub(dev), &cspec);
if (err)
dhd_get_customized_country_code(dev, (char *)&cspec.country_abbrev, &cspec);
err = dhd_conf_set_country(dhd_get_pub(dev), &cspec);
if (err < 0) {
WL_ERR(("set country for %s as %s rev %d failed\n",
country_str, cspec.ccode, cspec.rev));
}
dhd_conf_fix_country(dhd_get_pub(dev));
/* Indicate to upper layer for regdom change */
WL_INFORM_MEM(("Received country code change event\n"));
err = wl_update_wiphybands(cfg, true);
if (err != BCME_OK) {
WL_ERR(("update wiphy bands failed\n"));
return err;
}
wl_map_brcm_specifc_country_code(country_str);
if (!IS_REGDOM_SELF_MANAGED(wiphy)) {
err = regulatory_hint(wiphy, country_str);
if (err) {
WL_ERR(("update country change failed\n"));
return err;
}
WL_DBG_MEM(("regulatory hint notified for ccode change\n"));
}
return err;
}
#endif /* CUSTOMER_HW6 */
static void wl_init_conf(struct wl_conf *conf)
{
@@ -14575,9 +14773,7 @@ static void wl_init_event_handler(struct bcm_cfg80211 *cfg)
cfg->evt_handler[WLC_E_ADPS] = wl_adps_event_handler;
#endif /* WL_BAM */
cfg->evt_handler[WLC_E_PSK_SUP] = wl_cfg80211_sup_event_handler;
#ifdef CUSTOMER_HW6
cfg->evt_handler[WLC_E_COUNTRY_CODE_CHANGED] = wl_cfg80211_ccode_evt_handler;
#endif /* CUSTOMER_HW6 */
#ifdef WL_BCNRECV
cfg->evt_handler[WLC_E_BCNRECV_ABORTED] = wl_bcnrecv_aborted_event_handler;
#endif /* WL_BCNRECV */
@@ -15632,7 +15828,7 @@ wl_cfg80211_net_attach(struct net_device *primary_ndev)
}
#ifdef WL_STATIC_IF
/* Register dummy n/w iface. FW init will happen only from dev_open */
#ifdef WLEASYMESH
#ifdef WLDWDS
ntype = NL80211_IFTYPE_AP;
#else
ntype = NL80211_IFTYPE_STATION;
@@ -16858,13 +17054,7 @@ static s32 __wl_update_wiphybands(struct bcm_cfg80211 *cfg, bool notify)
if (notify) {
if (!IS_REGDOM_SELF_MANAGED(wiphy)) {
WL_UPDATE_CUSTOM_REGULATORY(wiphy);
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 12, 0))
rtnl_unlock();
#endif
wiphy_apply_custom_regulatory(wiphy, &brcm_regdom);
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 12, 0))
rtnl_lock();
#endif
wl_notify_regd(wiphy, NULL);
}
}
@@ -22729,7 +22919,7 @@ wl_cfg80211_mgmt_auth_tx(struct net_device *dev, bcm_struct_cfgdev *cfgdev,
ack = false;
} else {
err = wldev_iovar_setbuf(dev, "assoc_mgr_cmd", ambuf, param_len,
cfg->ioctl_buf, WLC_IOCTL_SMLEN, &cfg->ioctl_buf_sync);
cfg->ioctl_buf, WLC_IOCTL_MEDLEN, &cfg->ioctl_buf_sync);
if (unlikely(err)) {
WL_ERR(("Failed to send auth(%d)\n", err));
ack = false;

View File

@@ -332,6 +332,13 @@ extern char *dhd_dbg_get_system_timestamp(void);
#endif /* SUPPORT_AP_RADIO_PWRSAVE */
#ifdef BCMWAPI_WPI
#ifdef CFG80211_WAPI_BKPORT
#define IS_WAPI_VER(version) (version == NL80211_WAPI_VERSION_1)
#undef WLAN_AKM_SUITE_WAPI_PSK
#define WLAN_AKM_SUITE_WAPI_PSK 0x000FAC13
#undef WLAN_AKM_SUITE_WAPI_CERT
#define WLAN_AKM_SUITE_WAPI_CERT 0x000FAC14
#else
#ifdef OEM_ANDROID
#undef NL80211_WAPI_VERSION_1
#define NL80211_WAPI_VERSION_1 0
@@ -354,6 +361,7 @@ extern char *dhd_dbg_get_system_timestamp(void);
#define NL80211_WAPI_VERSION_1 1 << 2
#define IS_WAPI_VER(version) (version & NL80211_WAPI_VERSION_1)
#endif /* OEM_ANDROID */
#endif /* CFG80211_WAPI_BKPORT */
#endif /* BCMWAPI_WPI */
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 0, 0))
@@ -425,19 +433,19 @@ extern char *dhd_dbg_get_system_timestamp(void);
#define CFG80211_TRACE_TEXT USER_PREFIX_CFG80211
#define CFG80211_DEBUG_TEXT USER_PREFIX_CFG80211
#else
#define CFG80211_INFO_TEXT DHD_LOG_PREFIXS "CFG80211-INFO) "
#define CFG80211_INFO_TEXT "CFG80211-INFO) "
/* Samsung want to print INFO2 instead of ERROR
* because most of case, ERROR message is not a real ERROR.
* but it can be regarded as real error case for Tester
*/
#ifdef CUSTOMER_HW4_DEBUG
#define CFG80211_ERROR_TEXT DHD_LOG_PREFIXS "CFG80211-INFO2) "
#define CFG80211_ERROR_TEXT "CFG80211-INFO2) "
#else
#define CFG80211_ERROR_TEXT DHD_LOG_PREFIXS "CFG80211-ERROR) "
#define CFG80211_ERROR_TEXT "CFG80211-ERROR) "
#endif /* CUSTOMER_HW4_DEBUG */
#define CFG80211_SCAN_TEXT DHD_LOG_PREFIXS "CFG80211-SCAN) "
#define CFG80211_TRACE_TEXT DHD_LOG_PREFIXS "CFG80211-TRACE) "
#define CFG80211_DEBUG_TEXT DHD_LOG_PREFIXS "CFG80211-DEBUG) "
#define CFG80211_SCAN_TEXT "CFG80211-SCAN) "
#define CFG80211_TRACE_TEXT "CFG80211-TRACE) "
#define CFG80211_DEBUG_TEXT "CFG80211-DEBUG) "
#endif /* defined(CUSTOMER_DBG_PREFIX_ENABLE) */
#ifdef DHD_DEBUG
@@ -445,8 +453,7 @@ extern char *dhd_dbg_get_system_timestamp(void);
#define WL_ERR_MSG(x, args...) \
do { \
if (wl_dbg_level & WL_DBG_ERR) { \
WL_DBG_PRINT_SYSTEM_TIME; \
pr_cont(CFG80211_ERROR_TEXT "%s : " x, __func__, ## args); \
printf(CFG80211_ERROR_TEXT "%s : " x, __func__, ## args); \
DHD_LOG_DUMP_WRITE_TS_FN; \
DHD_LOG_DUMP_WRITE(x, ## args); \
} \
@@ -455,8 +462,7 @@ do { \
#define WL_ERR_KERN_MSG(x, args...) \
do { \
if (wl_dbg_level & WL_DBG_ERR) { \
WL_DBG_PRINT_SYSTEM_TIME; \
pr_cont(CFG80211_ERROR_TEXT "%s : " x, __func__, ## args); \
printf(CFG80211_ERROR_TEXT "%s : " x, __func__, ## args); \
} \
} while (0)
#define WL_ERR_KERN(x) WL_ERR_KERN_MSG x
@@ -473,8 +479,7 @@ do { \
#define WL_DBG_MEM_MSG(x, args...) \
do { \
if (wl_dbg_level & WL_DBG_DBG) { \
WL_DBG_PRINT_SYSTEM_TIME; \
pr_cont(CFG80211_INFO_TEXT "%s : " x, __func__, ## args); \
printf(CFG80211_INFO_TEXT "%s : " x, __func__, ## args); \
} \
DHD_LOG_DUMP_WRITE_TS_FN; \
DHD_LOG_DUMP_WRITE(x, ## args); \
@@ -484,8 +489,7 @@ do { \
#define WL_INFORM_MEM_MSG(x, args...) \
do { \
if (wl_dbg_level & WL_DBG_INFO) { \
WL_DBG_PRINT_SYSTEM_TIME; \
pr_cont(CFG80211_INFO_TEXT "%s : " x, __func__, ## args); \
printf(CFG80211_INFO_TEXT "%s : " x, __func__, ## args); \
DHD_LOG_DUMP_WRITE_TS_FN; \
DHD_LOG_DUMP_WRITE(x, ## args); \
} \
@@ -494,8 +498,7 @@ do { \
#define WL_ERR_EX_MSG(x, args...) \
do { \
if (wl_dbg_level & WL_DBG_ERR) { \
WL_DBG_PRINT_SYSTEM_TIME; \
pr_cont(CFG80211_ERROR_TEXT "%s : " x, __func__, ## args); \
printf(CFG80211_ERROR_TEXT "%s : " x, __func__, ## args); \
DHD_LOG_DUMP_WRITE_EX_TS_FN; \
DHD_LOG_DUMP_WRITE_EX(x, ## args); \
} \
@@ -510,8 +513,7 @@ do { \
#define WL_ERR_MSG(x, args...) \
do { \
if (wl_dbg_level & WL_DBG_ERR) { \
WL_DBG_PRINT_SYSTEM_TIME; \
pr_cont(CFG80211_ERROR_TEXT "%s : " x, __func__, ## args); \
printf(CFG80211_ERROR_TEXT "%s : " x, __func__, ## args); \
} \
} while (0)
#define WL_ERR(x) WL_ERR_MSG x
@@ -526,8 +528,7 @@ do { \
#define WL_ERR_MSG(x, args...) \
do { \
if ((wl_dbg_level & WL_DBG_ERR) && net_ratelimit()) { \
WL_DBG_PRINT_SYSTEM_TIME; \
pr_cont(CFG80211_ERROR_TEXT "%s : " x, __func__, ## args); \
printf(CFG80211_ERROR_TEXT "%s : " x, __func__, ## args); \
} \
} while (0)
#define WL_ERR(x) WL_ERR_MSG x
@@ -572,8 +573,7 @@ do { \
#define WL_INFORM_MSG(x, args...) \
do { \
if (wl_dbg_level & WL_DBG_INFO) { \
WL_DBG_PRINT_SYSTEM_TIME; \
pr_cont(CFG80211_INFO_TEXT "%s : " x, __func__, ## args); \
printf(CFG80211_INFO_TEXT "%s : " x, __func__, ## args); \
} \
} while (0)
#define WL_INFORM(x) WL_INFORM_MSG x
@@ -584,8 +584,7 @@ do { \
#define WL_SCAN_MSG(x, args...) \
do { \
if (wl_dbg_level & WL_DBG_SCAN) { \
WL_DBG_PRINT_SYSTEM_TIME; \
pr_cont(CFG80211_SCAN_TEXT "%s : " x, __func__, ## args); \
printf(CFG80211_SCAN_TEXT "%s : " x, __func__, ## args); \
} \
} while (0)
#define WL_SCAN(x) WL_SCAN_MSG x
@@ -595,8 +594,7 @@ do { \
#define WL_TRACE_MSG(x, args...) \
do { \
if (wl_dbg_level & WL_DBG_TRACE) { \
WL_DBG_PRINT_SYSTEM_TIME; \
pr_cont(CFG80211_TRACE_TEXT "%s : " x, __func__, ## args); \
printf(CFG80211_TRACE_TEXT "%s : " x, __func__, ## args); \
} \
} while (0)
#define WL_TRACE(x) WL_TRACE_MSG x
@@ -607,8 +605,7 @@ do { \
#define WL_TRACE_HW4_MSG(x, args...) \
do { \
if (wl_dbg_level & WL_DBG_ERR) { \
WL_DBG_PRINT_SYSTEM_TIME; \
pr_cont(CFG80211_TRACE_TEXT "%s : " x, __func__, ## args); \
printf(CFG80211_TRACE_TEXT "%s : " x, __func__, ## args); \
} \
} while (0)
#define WL_TRACE_HW4(x) WL_TRACE_HW4_MSG x
@@ -619,8 +616,7 @@ do { \
#define WL_DBG_MSG(x, args...) \
do { \
if (wl_dbg_level & WL_DBG_DBG) { \
WL_DBG_PRINT_SYSTEM_TIME; \
pr_cont(CFG80211_DEBUG_TEXT "%s : " x, __func__, ## args); \
printf(CFG80211_DEBUG_TEXT "%s : " x, __func__, ## args); \
} \
} while (0)
#define WL_DBG(x) WL_DBG_MSG x
@@ -1967,6 +1963,7 @@ struct bcm_cfg80211 {
bool p2p_6g_enabled; /* P2P 6G support enabled */
#endif /* WL_P2P_6G */
u32 halpid;
u8 country[WLC_CNTRY_BUF_SZ];
#if defined(RSSIAVG)
wl_rssi_cache_ctrl_t g_rssi_cache_ctrl;
wl_rssi_cache_ctrl_t g_connected_rssi_cache_ctrl;
@@ -1977,6 +1974,7 @@ struct bcm_cfg80211 {
int autochannel;
int best_2g_ch;
int best_5g_ch;
int best_6g_ch;
};
/* Max auth timeout allowed in case of EAP is 70sec, additional 5 sec for

View File

@@ -3960,7 +3960,7 @@ wl_cfgnan_cache_svc_info(struct bcm_cfg80211 *cfg,
goto fail;
}
if (cmd_data->sde_control_flag & NAN_SDE_CF_RANGING_REQUIRED) {
WL_TRACE(("%s: updating ranging info, enabling", __FUNCTION__));
WL_TRACE(("%s: updating ranging info, enabling\n", __FUNCTION__));
svc_info->status = 1;
svc_info->ranging_interval = cmd_data->ranging_intvl_msec;
svc_info->ranging_ind = cmd_data->ranging_indication;
@@ -3968,7 +3968,7 @@ wl_cfgnan_cache_svc_info(struct bcm_cfg80211 *cfg,
svc_info->egress_limit = cmd_data->egress_limit;
svc_info->ranging_required = 1;
} else {
WL_TRACE(("%s: updating ranging info, disabling", __FUNCTION__));
WL_TRACE(("%s: updating ranging info, disabling\n", __FUNCTION__));
svc_info->status = 0;
svc_info->ranging_interval = 0;
svc_info->ranging_ind = 0;

View File

@@ -95,8 +95,8 @@
#define NMR2STR(a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5], (a)[6], (a)[7]
#define NMRSTR "%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x"
#define NAN_DBG_ENTER() {WL_DBG(("Enter: %s\n", __FUNCTION__));}
#define NAN_DBG_EXIT() {WL_DBG(("Exit: %s\n", __FUNCTION__));}
#define NAN_DBG_ENTER() {WL_DBG(("Enter\n"));}
#define NAN_DBG_EXIT() {WL_DBG(("Exit\n"));}
/* Service Control Type length */
#define NAN_SVC_CONTROL_TYPE_MASK ((1 << NAN_SVC_CONTROL_TYPE_LEN) - 1)
@@ -217,6 +217,7 @@
#define NAN_RNG_GEOFENCE_MAX_RETRY_CNT 3u
#define NAN_MAX_CHANNEL_INFO_SUPPORTED 4u
/*
* Discovery Beacon Interval config,
* Default value is 128 msec in 2G DW and 176 msec in 2G/5G DW.
@@ -384,6 +385,17 @@ typedef struct nan_mac_list {
uint8 *list;
} nan_mac_list_t;
typedef struct nan_channel_info {
uint32 channel;
uint32 bandwidth;
uint32 nss;
} nan_channel_info_t;
typedef struct nan_ndl_sched_info {
uint32 num_channels;
nan_channel_info_t channel_info[NAN_MAX_CHANNEL_INFO_SUPPORTED];
} nan_ndl_sched_info_t;
typedef struct wl_nan_sid_beacon_tune {
uint8 sid_enable; /* flag for sending service id in beacon */
uint8 sid_count; /* Limit for number of SIDs to be included in Beacons */
@@ -946,7 +958,12 @@ typedef enum {
NAN_ATTRIBUTE_DISCOVERY_BEACON_INTERVAL = 224,
NAN_ATTRIBUTE_NSS = 225,
NAN_ATTRIBUTE_ENABLE_RANGING = 226,
NAN_ATTRIBUTE_DW_EARLY_TERM = 227
NAN_ATTRIBUTE_DW_EARLY_TERM = 227,
NAN_ATTRIBUTE_CHANNEL_INFO = 228,
NAN_ATTRIBUTE_NUM_CHANNELS = 229,
NAN_ATTRIBUTE_INSTANT_MODE_ENABLE = 230,
NAN_ATTRIBUTE_INSTANT_COMM_CHAN = 231,
NAN_ATTRIBUTE_MAX = 232
} NAN_ATTRIBUTE;
enum geofence_suspend_reason {

View File

@@ -2403,7 +2403,7 @@ wl_cfgp2p_register_ndev(struct bcm_cfg80211 *cfg)
#endif
/* Register with a dummy MAC addr */
memcpy(net->dev_addr, temp_addr, ETHER_ADDR_LEN);
dev_addr_set(net, temp_addr);
#ifndef WL_NEWCFG_PRIVCMD_SUPPORT
wdev->wiphy = cfg->wdev->wiphy;
@@ -2622,8 +2622,7 @@ wl_cfgp2p_add_p2p_disc_if(struct bcm_cfg80211 *cfg)
#if defined(WL_NEWCFG_PRIVCMD_SUPPORT)
if (cfg->p2p_net)
memcpy(cfg->p2p_net->dev_addr, wl_to_p2p_bss_macaddr(cfg, P2PAPI_BSSCFG_DEVICE),
ETHER_ADDR_LEN);
dev_addr_set(cfg->p2p_net, wl_to_p2p_bss_macaddr(cfg, P2PAPI_BSSCFG_DEVICE));
#endif /* WL_NEWCFG_PRIVCMD_SUPPORT */
/* store p2p wdev ptr for further reference. */

View File

@@ -140,21 +140,20 @@ enum wl_cfgp2p_status {
* but it can be regarded as real error case for Tester
*/
#ifdef CUSTOMER_HW4_DEBUG
#define CFGP2P_ERROR_TEXT DHD_LOG_PREFIXS "CFGP2P-INFO2) "
#define CFGP2P_ERROR_TEXT "CFGP2P-INFO2) "
#else
#define CFGP2P_ERROR_TEXT DHD_LOG_PREFIXS "CFGP2P-ERROR) "
#define CFGP2P_ERROR_TEXT "CFGP2P-ERROR) "
#endif /* CUSTOMER_HW4_DEBUG */
#define CFGP2P_INFO_TEXT DHD_LOG_PREFIXS "CFGP2P-INFO) "
#define CFGP2P_ACTION_TEXT DHD_LOG_PREFIXS "CFGP2P-ACTION) "
#define CFGP2P_DEBUG_TEXT DHD_LOG_PREFIXS "CFGP2P-DEBUG) "
#define CFGP2P_INFO_TEXT "CFGP2P-INFO) "
#define CFGP2P_ACTION_TEXT "CFGP2P-ACTION) "
#define CFGP2P_DEBUG_TEXT "CFGP2P-DEBUG) "
#endif /* defined(CUSTOMER_DBG_PREFIX_ENABLE) */
#ifdef DHD_LOG_DUMP
#define CFGP2P_ERR_MSG(x, args...) \
do { \
if (wl_dbg_level & WL_DBG_ERR) { \
WL_DBG_PRINT_SYSTEM_TIME; \
pr_cont(CFGP2P_ERROR_TEXT "%s : " x, __func__, ## args); \
printf(CFGP2P_ERROR_TEXT "%s : " x, __func__, ## args); \
DHD_LOG_DUMP_WRITE_TS_FN; \
DHD_LOG_DUMP_WRITE(x, ## args); \
} \
@@ -163,8 +162,7 @@ enum wl_cfgp2p_status {
#define CFGP2P_INFO_MSG(x, args...) \
do { \
if (wl_dbg_level & WL_DBG_INFO) { \
WL_DBG_PRINT_SYSTEM_TIME; \
pr_cont(CFGP2P_INFO_TEXT "%s : " x, __func__, ## args); \
printf(CFGP2P_INFO_TEXT "%s : " x, __func__, ## args); \
DHD_LOG_DUMP_WRITE_TS_FN; \
DHD_LOG_DUMP_WRITE(x, ## args); \
} \
@@ -173,8 +171,7 @@ enum wl_cfgp2p_status {
#define CFGP2P_ACTION_MSG(x, args...) \
do { \
if (wl_dbg_level & WL_DBG_P2P_ACTION) { \
WL_DBG_PRINT_SYSTEM_TIME; \
pr_cont(CFGP2P_ACTION_TEXT "%s : " x, __func__, ## args); \
printf(CFGP2P_ACTION_TEXT "%s : " x, __func__, ## args); \
DHD_LOG_DUMP_WRITE_TS_FN; \
DHD_LOG_DUMP_WRITE(x, ## args); \
} \
@@ -184,24 +181,21 @@ enum wl_cfgp2p_status {
#define CFGP2P_ERR_MSG(x, args...) \
do { \
if (wl_dbg_level & WL_DBG_ERR) { \
WL_DBG_PRINT_SYSTEM_TIME; \
pr_cont(CFGP2P_ERROR_TEXT "%s : " x, __func__, ## args); \
printf(CFGP2P_ERROR_TEXT "%s : " x, __func__, ## args); \
} \
} while (0)
#define CFGP2P_ERR(x) CFGP2P_ERR_MSG x
#define CFGP2P_INFO_MSG(x, args...) \
do { \
if (wl_dbg_level & WL_DBG_INFO) { \
WL_DBG_PRINT_SYSTEM_TIME; \
pr_cont(CFGP2P_INFO_TEXT "%s : " x, __func__, ## args); \
printf(CFGP2P_INFO_TEXT "%s : " x, __func__, ## args); \
} \
} while (0)
#define CFGP2P_INFO(x) CFGP2P_INFO_MSG x
#define CFGP2P_ACTION_MSG(x, args...) \
do { \
if (wl_dbg_level & WL_DBG_P2P_ACTION) { \
WL_DBG_PRINT_SYSTEM_TIME; \
pr_cont(CFGP2P_ACTION_TEXT "%s : " x, __func__, ## args); \
printf(CFGP2P_ACTION_TEXT "%s : " x, __func__, ## args); \
} \
} while (0)
#define CFGP2P_ACTION(x) CFGP2P_ACTION_MSG x
@@ -210,8 +204,7 @@ enum wl_cfgp2p_status {
#define CFGP2P_DBG_MSG(x, args...) \
do { \
if (wl_dbg_level & WL_DBG_DBG) { \
WL_DBG_PRINT_SYSTEM_TIME; \
pr_cont(CFGP2P_DEBUG_TEXT "%s : " x, __func__, ## args); \
printf(CFGP2P_DEBUG_TEXT "%s : " x, __func__, ## args); \
} \
} while (0)
#define CFGP2P_DBG(x) CFGP2P_DBG_MSG x

View File

@@ -641,10 +641,10 @@ wl_inform_bss(struct bcm_cfg80211 *cfg)
if (cfg->autochannel && ndev) {
#if defined(BSSCACHE)
wl_ext_get_best_channel(ndev, &cfg->g_bss_cache_ctrl, ioctl_version,
&cfg->best_2g_ch, &cfg->best_5g_ch);
&cfg->best_2g_ch, &cfg->best_5g_ch, &cfg->best_6g_ch);
#else
wl_ext_get_best_channel(ndev, bss_list, ioctl_version,
&cfg->best_2g_ch, &cfg->best_5g_ch);
&cfg->best_2g_ch, &cfg->best_5g_ch, &cfg->best_6g_ch);
#endif
}
@@ -1576,29 +1576,24 @@ chanspec_t wl_freq_to_chanspec(int freq)
static void
wl_cfgscan_populate_scan_channel(struct bcm_cfg80211 *cfg,
struct ieee80211_channel **channels, u32 n_channels,
u16 *channel_list, u32 target_channel)
u16 *channel_list, struct wl_chan_info *chan_info)
{
u32 i = 0;
u32 chanspec = 0;
u32 channel;
u32 i, chanspec = 0;
for (i=0; i<n_channels; i++) {
channel = ieee80211_frequency_to_channel(channels[i]->center_freq);
if (channel != target_channel)
continue;
if (!dhd_conf_match_channel(cfg->pub, channel))
return;
chanspec = wl_freq_to_chanspec(channels[i]->center_freq);
if (chanspec == INVCHANSPEC) {
WL_ERR(("Invalid chanspec! Skipping channel\n"));
continue;
}
channel_list[0] = chanspec;
break;
if (chan_info->band == CHSPEC2WLC_BAND(chanspec) &&
chan_info->chan == wf_chspec_ctlchan(chanspec)) {
channel_list[0] = chanspec;
break;
}
}
WL_SCAN(("chan: %d, chanspec: %x\n", target_channel, chanspec));
WL_SCAN(("chan: %s-%d, chanspec: %x\n",
WLCBAND2STR(chan_info->band), chan_info->chan, chanspec));
}
#endif
@@ -1768,6 +1763,7 @@ wl_scan_prep(struct bcm_cfg80211 *cfg, struct net_device *ndev, void *scan_param
struct cfg80211_scan_request *request)
{
#ifdef SCAN_SUPPRESS
struct wl_chan_info chan_info;
u32 channel;
#endif
wl_scan_params_t *params = NULL;
@@ -1847,14 +1843,14 @@ wl_scan_prep(struct bcm_cfg80211 *cfg, struct net_device *ndev, void *scan_param
cur_offset = channel_offset;
/* Copy channel array if applicable */
#ifdef SCAN_SUPPRESS
channel = wl_ext_scan_suppress(ndev, scan_params, cfg->scan_params_v2);
channel = wl_ext_scan_suppress(ndev, scan_params, cfg->scan_params_v2, &chan_info);
if (channel) {
n_channels = 1;
if ((n_channels > 0) && chan_list) {
if (len >= (scan_param_size + (n_channels * sizeof(u16)))) {
wl_cfgscan_populate_scan_channel(cfg,
request->channels, request->n_channels,
chan_list, channel);
chan_list, &chan_info);
cur_offset += (n_channels * (sizeof(u16)));
}
}
@@ -2643,12 +2639,13 @@ __wl_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev,
}
}
mutex_lock(&cfg->scan_sync);
#ifdef WL_EXT_IAPSTA
if (wl_ext_in4way_sync(ndev, STA_FAKE_SCAN_IN_CONNECT, WL_EXT_STATUS_SCANNING, NULL))
if (wl_ext_in4way_sync(ndev, STA_FAKE_SCAN_IN_CONNECT, WL_EXT_STATUS_SCANNING, NULL)) {
mutex_lock(&cfg->scan_sync);
goto scan_success;
else
}
#endif
mutex_lock(&cfg->scan_sync);
err = wl_do_escan(cfg, wiphy, ndev, request);
if (likely(!err)) {
goto scan_success;

View File

@@ -387,6 +387,9 @@ enum gscan_ch_attributes {
};
enum rtt_attributes {
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0)) || (ANDROID_VERSION >= 12)
RTT_ATTRIBUTE_INVALID,
#endif
RTT_ATTRIBUTE_TARGET_CNT,
RTT_ATTRIBUTE_TARGET_INFO,
RTT_ATTRIBUTE_TARGET_MAC,
@@ -403,17 +406,23 @@ enum rtt_attributes {
RTT_ATTRIBUTE_TARGET_BURST_DURATION,
RTT_ATTRIBUTE_TARGET_PREAMBLE,
RTT_ATTRIBUTE_TARGET_BW,
RTT_ATTRIBUTE_RESULTS_COMPLETE = 30,
RTT_ATTRIBUTE_RESULTS_COMPLETE,
RTT_ATTRIBUTE_RESULTS_PER_TARGET,
RTT_ATTRIBUTE_RESULT_CNT,
RTT_ATTRIBUTE_RESULT,
RTT_ATTRIBUTE_RESULT_DETAIL
RTT_ATTRIBUTE_RESULT_DETAIL,
/* Add any new RTT_ATTRIBUTE prior to RTT_ATTRIBUTE_MAX */
RTT_ATTRIBUTE_MAX
};
enum wifi_rssi_monitor_attr {
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0)) || (ANDROID_VERSION >= 12)
RSSI_MONITOR_ATTRIBUTE_INVALID,
#endif
RSSI_MONITOR_ATTRIBUTE_MAX_RSSI,
RSSI_MONITOR_ATTRIBUTE_MIN_RSSI,
RSSI_MONITOR_ATTRIBUTE_START
RSSI_MONITOR_ATTRIBUTE_START,
RSSI_MONITOR_ATTRIBUTE_MAX
};
enum wifi_sae_key_attr {
@@ -423,25 +432,30 @@ enum wifi_sae_key_attr {
};
enum debug_attributes {
DEBUG_ATTRIBUTE_GET_DRIVER = 0,
DEBUG_ATTRIBUTE_GET_FW = 1,
DEBUG_ATTRIBUTE_RING_ID = 2,
DEBUG_ATTRIBUTE_RING_NAME = 3,
DEBUG_ATTRIBUTE_RING_FLAGS = 4,
DEBUG_ATTRIBUTE_LOG_LEVEL = 5,
DEBUG_ATTRIBUTE_LOG_TIME_INTVAL = 6,
DEBUG_ATTRIBUTE_LOG_MIN_DATA_SIZE = 7,
DEBUG_ATTRIBUTE_FW_DUMP_LEN = 8,
DEBUG_ATTRIBUTE_FW_DUMP_DATA = 9,
DEBUG_ATTRIBUTE_FW_ERR_CODE = 10,
DEBUG_ATTRIBUTE_RING_DATA = 11,
DEBUG_ATTRIBUTE_RING_STATUS = 12,
DEBUG_ATTRIBUTE_RING_NUM = 13,
DEBUG_ATTRIBUTE_DRIVER_DUMP_LEN = 14,
DEBUG_ATTRIBUTE_DRIVER_DUMP_DATA = 15,
DEBUG_ATTRIBUTE_PKT_FATE_NUM = 16,
DEBUG_ATTRIBUTE_PKT_FATE_DATA = 17,
DEBUG_ATTRIBUTE_HANG_REASON = 18
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0)) || (ANDROID_VERSION >= 12)
DEBUG_ATTRIBUTE_INVALID,
#endif
DEBUG_ATTRIBUTE_GET_DRIVER,
DEBUG_ATTRIBUTE_GET_FW,
DEBUG_ATTRIBUTE_RING_ID,
DEBUG_ATTRIBUTE_RING_NAME,
DEBUG_ATTRIBUTE_RING_FLAGS,
DEBUG_ATTRIBUTE_LOG_LEVEL,
DEBUG_ATTRIBUTE_LOG_TIME_INTVAL,
DEBUG_ATTRIBUTE_LOG_MIN_DATA_SIZE,
DEBUG_ATTRIBUTE_FW_DUMP_LEN,
DEBUG_ATTRIBUTE_FW_DUMP_DATA,
DEBUG_ATTRIBUTE_FW_ERR_CODE,
DEBUG_ATTRIBUTE_RING_DATA,
DEBUG_ATTRIBUTE_RING_STATUS,
DEBUG_ATTRIBUTE_RING_NUM,
DEBUG_ATTRIBUTE_DRIVER_DUMP_LEN,
DEBUG_ATTRIBUTE_DRIVER_DUMP_DATA,
DEBUG_ATTRIBUTE_PKT_FATE_NUM,
DEBUG_ATTRIBUTE_PKT_FATE_DATA,
DEBUG_ATTRIBUTE_HANG_REASON,
/* Please add new attributes from here to sync up old HAL */
DEBUG_ATTRIBUTE_MAX
};
typedef enum {
@@ -512,18 +526,26 @@ typedef enum {
DUMP_BUF_ATTR_PKTLOG_DEBUG = 21,
DUMP_BUF_ATTR_STATUS_LOG = 22,
DUMP_BUF_ATTR_AXI_ERROR = 23,
DUMP_BUF_ATTR_RTT_LOG = 24
DUMP_BUF_ATTR_RTT_LOG = 24,
DUMP_BUF_ATTR_SDTC_ETB_DUMP = 25,
DUMP_BUF_ATTR_PKTID_MAP_LOG = 26,
DUMP_BUF_ATTR_PKTID_UNMAP_LOG = 27,
/* Please add new attributes from here to sync up old HAL */
DUMP_BUF_ATTR_MAX
} EWP_DUMP_CMD_ATTRIBUTE;
enum mkeep_alive_attributes {
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0)) || (ANDROID_VERSION >= 12)
MKEEP_ALIVE_ATTRIBUTE_INVALID,
#endif
MKEEP_ALIVE_ATTRIBUTE_ID,
MKEEP_ALIVE_ATTRIBUTE_IP_PKT,
MKEEP_ALIVE_ATTRIBUTE_IP_PKT_LEN,
MKEEP_ALIVE_ATTRIBUTE_SRC_MAC_ADDR,
MKEEP_ALIVE_ATTRIBUTE_DST_MAC_ADDR,
MKEEP_ALIVE_ATTRIBUTE_PERIOD_MSEC,
MKEEP_ALIVE_ATTRIBUTE_ETHER_TYPE
MKEEP_ALIVE_ATTRIBUTE_ETHER_TYPE,
MKEEP_ALIVE_ATTRIBUTE_MAX
};
typedef enum wl_vendor_event {
@@ -578,6 +600,9 @@ typedef enum wl_vendor_event {
} wl_vendor_event_t;
enum andr_wifi_attr {
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0)) || (ANDROID_VERSION >= 12)
ANDR_WIFI_ATTRIBUTE_INVALID,
#endif
ANDR_WIFI_ATTRIBUTE_NUM_FEATURE_SET,
ANDR_WIFI_ATTRIBUTE_FEATURE_SET,
ANDR_WIFI_ATTRIBUTE_RANDOM_MAC_OUI,
@@ -587,13 +612,20 @@ enum andr_wifi_attr {
ANDR_WIFI_ATTRIBUTE_TCPACK_SUP_VALUE,
ANDR_WIFI_ATTRIBUTE_LATENCY_MODE,
ANDR_WIFI_ATTRIBUTE_RANDOM_MAC,
ANDR_WIFI_ATTRIBUTE_TX_POWER_SCENARIO
ANDR_WIFI_ATTRIBUTE_TX_POWER_SCENARIO,
ANDR_WIFI_ATTRIBUTE_THERMAL_MITIGATION,
ANDR_WIFI_ATTRIBUTE_THERMAL_COMPLETION_WINDOW,
ANDR_WIFI_ATTRIBUTE_VOIP_MODE,
ANDR_WIFI_ATTRIBUTE_DTIM_MULTIPLIER,
/* Any new ANDR_WIFI attribute add prior to the ANDR_WIFI_ATTRIBUTE_MAX */
ANDR_WIFI_ATTRIBUTE_MAX
};
enum apf_attributes {
APF_ATTRIBUTE_VERSION,
APF_ATTRIBUTE_MAX_LEN,
APF_ATTRIBUTE_PROGRAM,
APF_ATTRIBUTE_PROGRAM_LEN
APF_ATTRIBUTE_PROGRAM_LEN,
APF_ATTRIBUTE_MAX
};
typedef enum wl_vendor_gscan_attribute {
@@ -627,6 +659,9 @@ typedef enum gscan_complete_event {
#ifdef DHD_WAKE_STATUS
enum wake_stat_attributes {
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0)) || (ANDROID_VERSION >= 12)
WAKE_STAT_ATTRIBUTE_INVALID,
#endif
WAKE_STAT_ATTRIBUTE_TOTAL_CMD_EVENT,
WAKE_STAT_ATTRIBUTE_CMD_EVENT_WAKE,
WAKE_STAT_ATTRIBUTE_CMD_EVENT_COUNT,
@@ -646,7 +681,10 @@ enum wake_stat_attributes {
WAKE_STAT_ATTRIBUTE_RX_ICMP6_NS,
WAKE_STAT_ATTRIBUTE_IPV4_RX_MULTICAST_ADD_CNT,
WAKE_STAT_ATTRIBUTE_IPV6_RX_MULTICAST_ADD_CNT,
WAKE_STAT_ATTRIBUTE_OTHER_RX_MULTICAST_ADD_CNT
WAKE_STAT_ATTRIBUTE_OTHER_RX_MULTICAST_ADD_CNT,
WAKE_STAT_ATTRIBUTE_RX_MULTICAST_PKT_INFO,
/* Please add new attributes from here to sync up old HAL */
WAKE_STAT_ATTRIBUTE_MAX
};
typedef struct rx_data_cnt_details_t {
@@ -713,7 +751,9 @@ typedef struct wifi_roaming_capabilities {
typedef enum {
SET_HAL_START_ATTRIBUTE_DEINIT = 0x0001,
SET_HAL_START_ATTRIBUTE_PRE_INIT = 0x0002,
SET_HAL_START_ATTRIBUTE_EVENT_SOCK_PID = 0x0003
SET_HAL_START_ATTRIBUTE_EVENT_SOCK_PID = 0x0003,
/* Add any new HAL_START attribute prior to SET_HAL_START_ATTRIBUTE_MAX */
SET_HAL_START_ATTRIBUTE_MAX
} SET_HAL_START_ATTRIBUTE;
/* Capture the BRCM_VENDOR_SUBCMD_PRIV_STRINGS* here */

View File

@@ -1342,7 +1342,7 @@ wl_cfg80211_change_virtual_iface(struct wiphy *wiphy, struct net_device *ndev,
WL_INFORM_MEM(("[%s] cfg_iftype changed to %d\n", ndev->name, type));
#ifdef WL_EXT_IAPSTA
wl_ext_iapsta_update_iftype(ndev, netinfo->ifidx, wl_iftype);
wl_ext_iapsta_update_iftype(ndev, wl_iftype);
#endif
fail:
@@ -1545,38 +1545,34 @@ wl_cfg80211_set_channel(struct wiphy *wiphy, struct net_device *dev,
u32 bw = WL_CHANSPEC_BW_20;
s32 err = BCME_OK;
struct bcm_cfg80211 *cfg = wiphy_priv(wiphy);
#if defined(CUSTOM_SET_CPUCORE) || defined(APSTA_RESTRICTED_CHANNEL) || defined(WL_EXT_IAPSTA)
#if defined(CUSTOM_SET_CPUCORE) || defined(APSTA_RESTRICTED_CHANNEL)
dhd_pub_t *dhd = (dhd_pub_t *)(cfg->pub);
enum nl80211_band band;
s32 _chan;
#endif /* CUSTOM_SET_CPUCORE || APSTA_RESTRICTED_CHANNEL */
u16 center_freq = chan->center_freq;
dev = ndev_to_wlc_ndev(dev, cfg);
#ifdef WL_EXT_IAPSTA
_chan = ieee80211_frequency_to_channel(chan->center_freq);
if (dev->ieee80211_ptr->iftype == NL80211_IFTYPE_AP ||
dev->ieee80211_ptr->iftype == NL80211_IFTYPE_P2P_GO) {
u16 wl_iftype = 0;
u16 wl_mode = 0;
chspec = wl_freq_to_chanspec(chan->center_freq);
if (cfg80211_to_wl_iftype(dev->ieee80211_ptr->iftype,
&wl_iftype, &wl_mode) < 0) {
WL_ERR(("Unknown interface type:0x%x\n", dev->ieee80211_ptr->iftype));
return -EINVAL;
}
wl_ext_iapsta_update_iftype(dev, dhd_net2idx(dhd->info, dev), wl_iftype);
_chan = wl_ext_iapsta_update_channel(dev, _chan);
}
if (CHANNEL_IS_5G(_chan))
band = NL80211_BAND_5GHZ;
else
band = NL80211_BAND_2GHZ;
center_freq = ieee80211_channel_to_frequency(_chan, band);
wl_ext_iapsta_update_iftype(dev, wl_iftype);
chspec = wl_ext_iapsta_update_channel(dev, chspec);
center_freq = wl_channel_to_frequency(wf_chspec_primary20_chan(chspec),
CHSPEC_BAND(chspec));
} else
#endif
chspec = wl_freq_to_chanspec(center_freq);
WL_MSG(dev->name, "netdev_ifidx(%d), chan_type(%d) target channel(%d) \n",
dev->ifindex, channel_type, CHSPEC_CHANNEL(chspec));
WL_MSG(dev->name, "netdev_ifidx(%d), chan_type(%d) target channel(%s-%d) \n",
dev->ifindex, channel_type, CHSPEC2BANDSTR(chspec), CHSPEC_CHANNEL(chspec));
#ifdef WL_P2P_6G
if (!(cfg->p2p_6g_enabled)) {
@@ -2804,7 +2800,7 @@ wl_cfg80211_set_ap_role(
}
#ifdef WLEASYMESH
else if (dhd->conf->fw_type == FW_TYPE_EZMESH) {
WL_MSG(dev->name, "Getting AP mode ok, set map and dwds");
WL_MSG(dev->name, "Getting AP mode ok, set map and dwds\n");
err = wldev_ioctl_set(dev, WLC_DOWN, &ap, sizeof(s32));
if (err < 0) {
WL_ERR(("WLC_DOWN error %d\n", err));
@@ -2821,7 +2817,7 @@ wl_cfg80211_set_ap_role(
WL_ERR(("wl dwds 1 error %d\n", err));
return err;
}
WL_MSG(dev->name, "Get AP %d", (int)ap);
WL_MSG(dev->name, "Get AP %d\n", (int)ap);
}
#endif /* WLEASYMESH*/
@@ -2839,10 +2835,10 @@ wl_cfg80211_set_ap_role(
if (wl_get_drv_status_all(cfg, CONNECTED) > 0) {
#ifdef WLEASYMESH
if (dhd->conf->fw_type == FW_TYPE_EZMESH) {
WL_MSG(dev->name, "do wl down");
WL_MSG(dev->name, "do wl down\n");
} else {
#endif /* WLEASYMESH */
WL_ERR(("Concurrent i/f operational. can't do wl down"));
WL_ERR(("Concurrent i/f operational. can't do wl down\n"));
return BCME_ERROR;
#ifdef WLEASYMESH
}
@@ -2872,7 +2868,7 @@ wl_cfg80211_set_ap_role(
#ifdef WLEASYMESH
//For FrontHaulAP
if (dhd->conf->fw_type == FW_TYPE_EZMESH) {
WL_MSG(dev->name, "wl map 2");
WL_MSG(dev->name, "wl map 2\n");
err = wldev_iovar_setint(dev, "map", 2);
if (err < 0) {
WL_ERR(("wl map 2 error %d\n", err));
@@ -2985,7 +2981,7 @@ wl_cfg80211_bcn_bringup_ap(
s32 err = BCME_OK;
dhd_pub_t *dhd = (dhd_pub_t *)(cfg->pub);
s32 is_rsdb_supported = BCME_ERROR;
char sec[32];
char sec[64];
#if defined (BCMDONGLEHOST)
is_rsdb_supported = DHD_OPMODE_SUPPORTED(cfg->pub, DHD_FLAG_RSDB_MODE);
@@ -3090,6 +3086,14 @@ wl_cfg80211_bcn_bringup_ap(
}
#endif /* SOFTAP_UAPSD_OFF */
#ifdef WLDWDS
err = wldev_iovar_setint(dev, "dwds", 1);
if (err < 0) {
WL_ERR(("set dwds error %d\n", err));
goto exit;
}
#endif /* WLDWDS */
err = wldev_ioctl_set(dev, WLC_UP, &ap, sizeof(s32));
if (unlikely(err)) {
WL_ERR(("WLC_UP error (%d)\n", err));
@@ -3131,12 +3135,23 @@ wl_cfg80211_bcn_bringup_ap(
}
if (dhd->conf->chip == BCM43430_CHIP_ID && bssidx > 0 &&
(wsec & (TKIP_ENABLED|AES_ENABLED))) {
struct net_device *primary_ndev = bcmcfg_to_prmry_ndev(cfg);
struct ether_addr bssid;
int ret = 0;
wsec |= WSEC_SWFLAG; // terence 20180628: fix me, this is a workaround
err = wldev_iovar_setint_bsscfg(dev, "wsec", wsec, bssidx);
if (err < 0) {
WL_ERR(("wsec error %d\n", err));
goto exit;
}
bzero(&bssid, sizeof(bssid));
ret = wldev_ioctl_get(primary_ndev, WLC_GET_BSSID, &bssid, ETHER_ADDR_LEN);
if (ret != BCME_NOTASSOCIATED && memcmp(&ether_null, &bssid, ETHER_ADDR_LEN)) {
scb_val_t scbval;
bzero(&scbval, sizeof(scb_val_t));
scbval.val = WLAN_REASON_DEAUTH_LEAVING;
wldev_ioctl_set(primary_ndev, WLC_DISASSOC, &scbval, sizeof(scb_val_t));
}
}
if ((wsec == WEP_ENABLED) && cfg->wep_key.len) {
WL_DBG(("Applying buffered WEP KEY \n"));
@@ -3622,7 +3637,7 @@ wl_cfg80211_start_ap(
}
wl_wlfc_enable(cfg, TRUE);
#ifdef WL_EXT_IAPSTA
wl_ext_iapsta_update_iftype(dev, dhd_net2idx(dhd->info, dev), WL_IF_TYPE_AP);
wl_ext_iapsta_update_iftype(dev, WL_IF_TYPE_AP);
#endif /* WL_EXT_IAPSTA */
#ifdef PKT_FILTER_SUPPORT
/* Disable packet filter */
@@ -3720,7 +3735,7 @@ wl_cfg80211_start_ap(
/* Set IEs to FW */
if ((err = wl_cfg80211_set_ies(dev, &info->beacon, bssidx)) < 0)
WL_ERR(("Set IEs failed \n"));
#ifdef WLDWDS
if (dev->ieee80211_ptr->use_4addr) {
if ((err = wl_cfg80211_set_mgmt_vndr_ies(cfg, ndev_to_cfgdev(dev), bssidx,
@@ -3757,6 +3772,9 @@ wl_cfg80211_start_ap(
}
}
#endif /* SUPPORT_AP_RADIO_PWRSAVE */
#ifdef WL_EXT_IAPSTA
wl_ext_in4way_sync(dev, 0, WL_EXT_STATUS_AP_ENABLING, NULL);
#endif
fail:
if (err) {
WL_ERR(("ADD/SET beacon failed\n"));
@@ -3852,6 +3870,9 @@ wl_cfg80211_stop_ap(
err = -EINVAL;
goto exit;
}
#ifdef WL_EXT_IAPSTA
wl_ext_in4way_sync(dev, 0, WL_EXT_STATUS_AP_DISABLING, NULL);
#endif
/* Free up resources */
wl_cfg80211_cleanup_if(dev);
@@ -4542,6 +4563,11 @@ wl_notify_connect_status_ap(struct bcm_cfg80211 *cfg, struct net_device *ndev,
wl_ext_in4way_sync(ndev, AP_WAIT_STA_RECONNECT,
WL_EXT_STATUS_STA_CONNECTED, (void *)&e->addr);
#endif
#ifdef STA_MGMT
if (!wl_ext_add_sta_info(ndev, (u8 *)&e->addr)) {
return -EINVAL;
}
#endif /* STA_MGMT */
cfg80211_new_sta(ndev, e->addr.octet, &sinfo, GFP_ATOMIC);
#ifdef WL_WPS_SYNC
wl_wps_session_update(ndev, WPS_STATE_LINKUP, e->addr.octet);
@@ -4564,6 +4590,11 @@ wl_notify_connect_status_ap(struct bcm_cfg80211 *cfg, struct net_device *ndev,
wl_ext_in4way_sync(ndev, AP_WAIT_STA_RECONNECT,
WL_EXT_STATUS_STA_DISCONNECTED, (void *)&e->addr);
#endif
#ifdef STA_MGMT
if (!wl_ext_del_sta_info(ndev, (u8 *)&e->addr)) {
return -EINVAL;
}
#endif /* STA_MGMT */
cfg80211_del_sta(ndev, e->addr.octet, GFP_ATOMIC);
#ifdef WL_WPS_SYNC
wl_wps_session_update(ndev, WPS_STATE_LINKDOWN, e->addr.octet);

View File

@@ -10,25 +10,25 @@
#define ESCAN_ERROR(name, arg1, args...) \
do { \
if (android_msg_level & ANDROID_ERROR_LEVEL) { \
printk(KERN_ERR DHD_LOG_PREFIX "[%s] ESCAN-ERROR) %s : " arg1, name, __func__, ## args); \
printf("[%s] ESCAN-ERROR) %s : " arg1, name, __func__, ## args); \
} \
} while (0)
#define ESCAN_TRACE(name, arg1, args...) \
do { \
if (android_msg_level & ANDROID_TRACE_LEVEL) { \
printk(KERN_INFO DHD_LOG_PREFIX "[%s] ESCAN-TRACE) %s : " arg1, name, __func__, ## args); \
printf("[%s] ESCAN-TRACE) %s : " arg1, name, __func__, ## args); \
} \
} while (0)
#define ESCAN_SCAN(name, arg1, args...) \
do { \
if (android_msg_level & ANDROID_SCAN_LEVEL) { \
printk(KERN_INFO DHD_LOG_PREFIX "[%s] ESCAN-SCAN) %s : " arg1, name, __func__, ## args); \
printf("[%s] ESCAN-SCAN) %s : " arg1, name, __func__, ## args); \
} \
} while (0)
#define ESCAN_DBG(name, arg1, args...) \
do { \
if (android_msg_level & ANDROID_DBG_LEVEL) { \
printk(KERN_INFO DHD_LOG_PREFIX "[%s] ESCAN-DBG) %s : " arg1, name, __func__, ## args); \
printf("[%s] ESCAN-DBG) %s : " arg1, name, __func__, ## args); \
} \
} while (0)
@@ -43,8 +43,14 @@
#define wl_escan_get_buf(a) ((wl_scan_results_t *) (a)->escan_buf)
#define for_each_bss(list, bss, __i) \
#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_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
#define for_each_bss(list, bss, __i) \
for (__i = 0; __i < list->count; __i++, bss = next_bss(list, bss))
#define wl_escan_set_sync_id(a) ((a) = htod16(0x1234))
@@ -277,7 +283,7 @@ wl_escan_inform_bss(struct net_device *dev, struct wl_escan_info *escan)
wl_reset_bss_cache(&escan->g_bss_cache_ctrl);
if (escan->autochannel)
wl_ext_get_best_channel(dev, &escan->g_bss_cache_ctrl,
escan->ioctl_ver, &escan->best_2g_ch, &escan->best_5g_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) {
@@ -285,7 +291,7 @@ wl_escan_inform_bss(struct net_device *dev, struct wl_escan_info *escan)
}
if (escan->autochannel)
wl_ext_get_best_channel(dev, bss_list, escan->ioctl_ver,
&escan->best_2g_ch, &escan->best_5g_ch);
&escan->best_2g_ch, &escan->best_5g_ch, &escan->best_6g_ch);
#endif
return err;
@@ -689,7 +695,6 @@ wl_escan_prep(struct net_device *dev, struct wl_escan_info *escan,
int i = 0, j = 0;
wlc_ssid_t ssid_tmp;
u32 n_channels = 0;
uint channel;
chanspec_t chanspec;
u32 n_ssids = 0;
wl_scan_params_t *params = NULL;
@@ -742,7 +747,7 @@ wl_escan_prep(struct net_device *dev, struct wl_escan_info *escan,
params->scan_type = DOT11_SCANTYPE_ACTIVE;
params->nprobes = htod32(-1);
if (scan_info->scan_time)
params_v2->active_time = htod32(scan_info->scan_time);
params->active_time = htod32(scan_info->scan_time);
else
params->active_time = htod32(-1);
params->passive_time = htod32(-1);
@@ -754,29 +759,19 @@ wl_escan_prep(struct net_device *dev, struct wl_escan_info *escan,
cur_offset = channel_offset;
n_channels = dtoh32(list->count);
n_channels = list->count;
/* Copy channel array if applicable */
ESCAN_SCAN(dev->name, "### List of channelspecs to scan ###\n");
if (n_channels > 0) {
for (i = 0; i < n_channels; i++) {
channel = dtoh32(list->element[i]);
if (!dhd_conf_match_channel(escan->pub, channel))
continue;
chanspec = WL_CHANSPEC_BW_20;
chanspec = list->element[i];
if (chanspec == INVCHANSPEC) {
ESCAN_ERROR(dev->name, "Invalid chanspec! Skipping channel\n");
continue;
}
if (channel <= CH_MAX_2G_CHANNEL) {
chanspec |= WL_CHANSPEC_BAND_2G;
} else {
chanspec |= WL_CHANSPEC_BAND_5G;
}
chan_list[j] = channel;
chan_list[j] &= WL_CHANSPEC_CHAN_MASK;
chan_list[j] |= chanspec;
chan_list[j] = chanspec;
ESCAN_SCAN(dev->name, "Chan : %d, Channel spec: %x\n",
channel, chan_list[j]);
CHSPEC_CHANNEL(chanspec), chanspec);
chan_list[j] = wl_chspec_host_to_driver(escan->ioctl_ver,
chan_list[j]);
j++;
@@ -895,7 +890,7 @@ wl_escan_set_scan(struct net_device *dev, wl_scan_info_t *scan_info)
wl_escan_params_t *params = NULL;
u32 n_channels = 0;
wl_uint32_list_t *list;
u8 valid_chan_list[sizeof(u32)*(WL_NUMCHANNELS + 1)];
u8 valid_chan_list[sizeof(u32)*(MAX_CTRL_CHANSPECS + 1)];
mutex_lock(&escan->usr_sync);
if (escan->escan_state == ESCAN_STATE_DOWN) {
@@ -917,7 +912,7 @@ wl_escan_set_scan(struct net_device *dev, wl_scan_info_t *scan_info)
goto exit2;
}
ESCAN_TRACE(dev->name, "Enter \n");
ESCAN_TRACE(dev->name, "Enter\n");
if (escan->scan_params_v2) {
params_size = (WL_SCAN_PARAMS_V2_FIXED_SIZE +
@@ -934,18 +929,16 @@ wl_escan_set_scan(struct net_device *dev, wl_scan_info_t *scan_info)
if (scan_info->channels.count) {
memcpy(list, &scan_info->channels, sizeof(wl_channel_list_t));
} else {
list->count = htod32(WL_NUMCHANNELS);
err = wldev_ioctl(dev, WLC_GET_VALID_CHANNELS, valid_chan_list,
sizeof(valid_chan_list), false);
err = wl_construct_ctl_chanspec_list(dev, list);
if (err != 0) {
ESCAN_ERROR(dev->name, "get channels failed with %d\n", err);
goto exit;
}
}
n_channels = dtoh32(list->count);
n_channels = list->count;
/* Allocate space for populating ssids in wl_escan_params_t struct */
if (dtoh32(list->count) % 2)
if (list->count % 2)
/* If n_channels is odd, add a padd of u16 */
params_size += sizeof(u16) * (n_channels + 1);
else
@@ -1150,7 +1143,7 @@ wl_escan_merge_scan_list(struct net_device *dev, u8 *cur_bssid,
bss_list = escan->bss_list;
bi = next_bss(bss_list, bi);
for_each_bss(bss_list, bi, i)
for_each_bss_wext(bss_list, bi, i)
{
if (!memcmp(&bi->BSSID, cur_bssid, ETHER_ADDR_LEN)) {
ESCAN_SCAN(dev->name, "skip connected AP %pM\n", cur_bssid);
@@ -1379,7 +1372,7 @@ wl_escan_mesh_info_ie(struct net_device *dev, u8 *parse, u32 len,
}
bool
wl_escan_mesh_info(struct net_device *dev, struct wl_escan_info *escan,
wl_escan_mesh_info(struct net_device *dev, struct wl_escan_info *escan,
struct ether_addr *peer_bssid, struct wl_mesh_params *mesh_info)
{
int i = 0;
@@ -1450,7 +1443,7 @@ exit:
}
bool
wl_escan_mesh_peer(struct net_device *dev, struct wl_escan_info *escan,
wl_escan_mesh_peer(struct net_device *dev, struct wl_escan_info *escan,
wlc_ssid_t *cur_ssid, uint16 cur_chan, bool sae,
struct wl_mesh_params *mesh_info)
{
@@ -1759,4 +1752,3 @@ exit:
}
#endif /* WL_ESCAN */

View File

@@ -2,9 +2,11 @@
#ifndef _wl_escan_
#define _wl_escan_
#include <linuxver.h>
#if defined(WL_WIRELESS_EXT)
#include <wl_iw.h>
#include <wl_iapsta.h>
#endif /* WL_WIRELESS_EXT */
#include <wl_android_ext.h>
#include <wl_iapsta.h>
#include <dhd_config.h>
#define ESCAN_BUF_SIZE (64 * 1024)
@@ -39,6 +41,7 @@ typedef struct wl_escan_info {
int autochannel;
int best_2g_ch;
int best_5g_ch;
int best_6g_ch;
#if defined(RSSIAVG)
wl_rssi_cache_ctrl_t g_rssi_cache_ctrl;
wl_rssi_cache_ctrl_t g_connected_rssi_cache_ctrl;
@@ -62,7 +65,7 @@ typedef struct wl_mesh_params {
uint16 master_channel;
uint hop_cnt;
struct ether_addr peer_bssid[MAX_HOP_LIST];
uint16 scan_channel;
uint32 scan_channel;
} wl_mesh_params_t;
bool wl_escan_mesh_info(struct net_device *dev,
struct wl_escan_info *escan, struct ether_addr *peer_bssid,
@@ -73,8 +76,10 @@ bool wl_escan_mesh_peer(struct net_device *dev,
#endif /* WLMESH */
int wl_escan_set_scan(struct net_device *dev, wl_scan_info_t *scan_info);
#if defined(WL_WIRELESS_EXT)
int wl_escan_get_scan(struct net_device *dev,
struct iw_request_info *info, struct iw_point *dwrq, char *extra);
#endif
int wl_escan_attach(struct net_device *dev);
void wl_escan_detach(struct net_device *dev);
int wl_escan_event_attach(struct net_device *dev, int ifidx);
@@ -83,4 +88,3 @@ int wl_escan_up(struct net_device *dev);
void wl_escan_down(struct net_device *dev);
#endif /* _wl_escan_ */

View File

@@ -2,24 +2,23 @@
#include <wl_android.h>
#ifdef WL_EVENT
#include <bcmendian.h>
#include <dhd_config.h>
#define EVENT_ERROR(name, arg1, args...) \
do { \
if (android_msg_level & ANDROID_ERROR_LEVEL) { \
printk(KERN_ERR DHD_LOG_PREFIX "[%s] EVENT-ERROR) %s : " arg1, name, __func__, ## args); \
printf("[%s] EVENT-ERROR) %s : " arg1, name, __func__, ## args); \
} \
} while (0)
#define EVENT_TRACE(name, arg1, args...) \
do { \
if (android_msg_level & ANDROID_TRACE_LEVEL) { \
printk(KERN_INFO DHD_LOG_PREFIX "[%s] EVENT-TRACE) %s : " arg1, name, __func__, ## args); \
printf("[%s] EVENT-TRACE) %s : " arg1, name, __func__, ## args); \
} \
} while (0)
#define EVENT_DBG(name, arg1, args...) \
do { \
if (android_msg_level & ANDROID_DBG_LEVEL) { \
printk(KERN_INFO DHD_LOG_PREFIX "[%s] EVENT-DBG) %s : " arg1, name, __func__, ## args); \
printf("[%s] EVENT-DBG) %s : " arg1, name, __func__, ## args); \
} \
} while (0)

View File

@@ -16,4 +16,3 @@ void wl_ext_event_deregister(struct net_device *dev, dhd_pub_t *dhd,
uint32 event, void *cb_func);
void wl_ext_event_send(void *params, const wl_event_msg_t * e, void *data);
#endif

View File

@@ -7,19 +7,19 @@
#define AGENL_ERROR(name, arg1, args...) \
do { \
if (android_msg_level & ANDROID_ERROR_LEVEL) { \
printk(KERN_ERR DHD_LOG_PREFIX "[%s] AGENL-ERROR) %s : " arg1, name, __func__, ## args); \
printf("[%s] AGENL-ERROR) %s : " arg1, name, __func__, ## args); \
} \
} while (0)
#define AGENL_TRACE(name, arg1, args...) \
do { \
if (android_msg_level & ANDROID_TRACE_LEVEL) { \
printk(KERN_INFO DHD_LOG_PREFIX "[%s] AGENL-TRACE) %s : " arg1, name, __func__, ## args); \
printf("[%s] AGENL-TRACE) %s : " arg1, name, __func__, ## args); \
} \
} while (0)
#define AGENL_INFO(name, arg1, args...) \
do { \
if (android_msg_level & ANDROID_INFO_LEVEL) { \
printk(KERN_INFO DHD_LOG_PREFIX "[%s] AGENL-INFO) %s : " arg1, name, __func__, ## args); \
printf("[%s] AGENL-INFO) %s : " arg1, name, __func__, ## args); \
} \
} while (0)
@@ -419,7 +419,7 @@ wl_ext_genl_send(struct genl_params *zconf, struct net_device *dev,
zconf->send_retry_cnt = 0;
return 0;
return 0;
}
static int

File diff suppressed because it is too large Load Diff

View File

@@ -19,10 +19,12 @@ enum wl_ext_status {
WL_EXT_STATUS_RECONNECT,
WL_EXT_STATUS_CONNECTED,
WL_EXT_STATUS_ADD_KEY,
WL_EXT_STATUS_AP_ENABLING,
WL_EXT_STATUS_AP_ENABLED,
WL_EXT_STATUS_DELETE_STA,
WL_EXT_STATUS_STA_DISCONNECTED,
WL_EXT_STATUS_STA_CONNECTED,
WL_EXT_STATUS_AP_DISABLING,
WL_EXT_STATUS_AP_DISABLED
};
@@ -33,6 +35,10 @@ void wl_ext_backup_eapol_txpkt(dhd_pub_t *dhd, int ifidx, void *pkt);
void wl_ext_release_eapol_txpkt(dhd_pub_t *dhd, int ifidx, bool rx);
#endif /* EAPOL_RESEND */
void wl_ext_iapsta_get_vif_macaddr(struct dhd_pub *dhd, int ifidx, u8 *mac_addr);
#ifdef WLDWDS
int wl_ext_iapsta_attach_dwds_netdev(struct net_device *net, int ifidx, uint8 bssidx);
int wl_ext_iapsta_dettach_dwds_netdev(struct net_device *net, int ifidx, uint8 bssidx);
#endif /* WLDWDS */
int wl_ext_iapsta_attach_netdev(struct net_device *net, int ifidx, uint8 bssidx);
int wl_ext_iapsta_attach_name(struct net_device *net, int ifidx);
int wl_ext_iapsta_dettach_netdev(struct net_device *net, int ifidx);
@@ -67,15 +73,20 @@ int wl_ext_in4way_sync(struct net_device *dev, uint action,
void wl_ext_update_extsae_4way(struct net_device *dev,
const struct ieee80211_mgmt *mgmt, bool tx);
u32 wl_ext_iapsta_update_channel(struct net_device *dev, u32 channel);
void wl_ext_iapsta_update_iftype(struct net_device *net, int ifidx, int wl_iftype);
void wl_ext_iapsta_update_iftype(struct net_device *net, int wl_iftype);
bool wl_ext_iapsta_iftype_enabled(struct net_device *net, int wl_iftype);
void wl_ext_iapsta_enable_master_if(struct net_device *dev, bool post);
void wl_ext_iapsta_restart_master(struct net_device *dev);
void wl_ext_iapsta_ifadding(struct net_device *net, int ifidx);
bool wl_ext_iapsta_mesh_creating(struct net_device *net);
void wl_ext_fw_reinit_incsa(struct net_device *dev);
#ifdef STA_MGMT
bool wl_ext_del_sta_info(struct net_device *net, u8 *bssid);
bool wl_ext_add_sta_info(struct net_device *net, u8 *bssid);
#endif /* STA_MGMT */
#ifdef SCAN_SUPPRESS
uint16 wl_ext_scan_suppress(struct net_device *dev, void *scan_params, bool scan_v2);
uint16 wl_ext_scan_suppress(struct net_device *dev, void *scan_params, bool scan_v2,
struct wl_chan_info *chan_info);
void wl_ext_reset_scan_busy(dhd_pub_t *dhd);
#endif /* SCAN_SUPPRESS */
#endif
@@ -83,4 +94,3 @@ void wl_ext_reset_scan_busy(dhd_pub_t *dhd);
int wl_ext_get_wlfc_maxcount(struct dhd_pub *dhd, int ifidx);
#endif /* PROPTX_MAXCOUNT */
#endif

View File

@@ -2,13 +2,13 @@
* Linux Wireless Extensions support
*
* Copyright (C) 1999-2017, Broadcom Corporation
*
*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
*
*
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
@@ -16,7 +16,7 @@
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
*
*
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
@@ -56,32 +56,32 @@ uint iw_msg_level = WL_ERROR_LEVEL;
#define WL_ERROR_MSG(x, args...) \
do { \
if (iw_msg_level & WL_ERROR_LEVEL) { \
printk(KERN_ERR DHD_LOG_PREFIXS "WEXT-ERROR) %s : " x, __func__, ## args); \
printf("WEXT-ERROR) %s : " x, __func__, ## args); \
} \
} while (0)
#define WL_TRACE_MSG(x, args...) \
do { \
if (iw_msg_level & WL_TRACE_LEVEL) { \
printk(KERN_INFO DHD_LOG_PREFIXS "WEXT-TRACE) %s : " x, __func__, ## args); \
printf("WEXT-TRACE) %s : " x, __func__, ## args); \
} \
} while (0)
#define WL_SCAN_MSG(x, args...) \
do { \
if (iw_msg_level & WL_SCAN_LEVEL) { \
printk(KERN_INFO DHD_LOG_PREFIXS "WEXT-SCAN) %s : " x, __func__, ## args); \
printf("WEXT-SCAN) %s : " x, __func__, ## args); \
} \
} while (0)
#define WL_WSEC_MSG(x, args...) \
do { \
if (iw_msg_level & WL_WSEC_LEVEL) { \
printk(KERN_INFO DHD_LOG_PREFIXS "WEXT-WSEC) %s : " x, __func__, ## args); \
printf("WEXT-WSEC) %s : " x, __func__, ## args); \
} \
} while (0)
#define WL_ERROR(x) WL_ERROR_MSG x
#define WL_TRACE(x) WL_TRACE_MSG x
#define WL_SCAN(x) WL_SCAN_MSG x
#define WL_WSEC(x) WL_WSEC_MSG x
#ifdef BCMWAPI_WPI
/* these items should evetually go into wireless.h of the linux system headfile dir */
#ifndef IW_ENCODE_ALG_SM4
@@ -607,7 +607,7 @@ done:
}
#define DHD_CHECK(dhd, dev) \
if (!dhd) { \
if (!dhd) { \
WL_ERROR (("[%s] dhd is NULL\n", dev->name)); \
return -ENODEV; \
} \
@@ -1056,7 +1056,7 @@ wl_iw_set_wap(
WL_TRACE(("%s: SIOCSIWAP\n", dev->name));
DHD_CHECK(dhd, dev);
wext_info = dhd->wext_info;
wext_info = dhd->wext_info;
if (awrq->sa_family != ARPHRD_ETHER) {
WL_ERROR(("Invalid Header...sa_family\n"));
return -EINVAL;
@@ -1265,7 +1265,7 @@ wl_iw_iscan_get_aplist(
WL_TRACE(("%s: SIOCGIWAPLIST\n", dev->name));
DHD_CHECK(dhd, dev);
wext_info = dhd->wext_info;
wext_info = dhd->wext_info;
iscan = &wext_info->iscan;
if (!extra)
@@ -1594,7 +1594,7 @@ wl_iw_handle_scanresults_ies(char **event_p, char *end,
break;
}
}
#ifdef BCMWAPI_WPI
ptr = ((uint8 *)bi) + sizeof(wl_bss_info_t);
ptr_len = bi->ie_length;
@@ -2808,7 +2808,7 @@ wl_iw_set_pmksa(
WL_TRACE(("%s: SIOCSIWPMKSA\n", dev->name));
DHD_CHECK(dhd, dev);
wext_info = dhd->wext_info;
pmk_list = &wext_info->pmk_list;
pmk_list = &wext_info->pmk_list;
if (pmk_list)
pmkid_array = pmk_list->pmkids.pmkid;
iwpmksa = (struct iw_pmksa *)extra;
@@ -2935,7 +2935,7 @@ wl_iw_set_wpaauth(
case IW_AUTH_CIPHER_PAIRWISE:
case IW_AUTH_CIPHER_GROUP: {
int fbt_cap = 0;
// int fbt_cap = 0;
if (paramid == IW_AUTH_CIPHER_PAIRWISE) {
iw->pwsec = paramval;
@@ -2984,6 +2984,7 @@ wl_iw_set_wpaauth(
return error;
}
#if 0
/* Ensure in-dongle supplicant is turned on when FBT wants to do the 4-way
* handshake.
*/
@@ -3004,6 +3005,7 @@ wl_iw_set_wpaauth(
}
}
}
#endif
break;
}

View File

@@ -2,13 +2,13 @@
* Linux Wireless Extensions support
*
* Copyright (C) 1999-2017, Broadcom Corporation
*
*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
*
*
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
@@ -16,7 +16,7 @@
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
*
*
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
@@ -129,10 +129,6 @@ extern const struct iw_handler_def wl_iw_handler_def;
extern int wl_iw_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
extern int wl_iw_get_wireless_stats(struct net_device *dev, struct iw_statistics *wstats);
int wl_iw_send_priv_event(struct net_device *dev, char *flag);
#ifdef WL_ESCAN
int wl_iw_handle_scanresults_ies(char **event_p, char *end,
struct iw_request_info *info, wl_bss_info_t *bi);
#endif
int wl_iw_attach(struct net_device *dev);
void wl_iw_detach(struct net_device *dev);
s32 wl_iw_autochannel(struct net_device *dev, char* command, int total_len);

View File

@@ -64,7 +64,7 @@ int dhd_monitor_uninit(void);
#ifndef DHD_MAX_IFS
#define DHD_MAX_IFS 16
#endif
#define MON_PRINT(format, ...) printk("DHD-MON: %s " format, __func__, ##__VA_ARGS__)
#define MON_PRINT(format, ...) printf("DHD-MON: %s " format, __func__, ##__VA_ARGS__)
#define MON_TRACE MON_PRINT
typedef struct monitor_interface {

View File

@@ -56,21 +56,19 @@
#define WLDEV_ERROR_TEXT USER_PREFIX_WLDEV
#define WLDEV_INFO_TEXT USER_PREFIX_WLDEV
#else
#define WLDEV_ERROR_TEXT DHD_LOG_PREFIXS "WLDEV-ERROR) "
#define WLDEV_INFO_TEXT DHD_LOG_PREFIXS "WLDEV-INFO) "
#define WLDEV_ERROR_TEXT "WLDEV-ERROR) "
#define WLDEV_INFO_TEXT "WLDEV-INFO) "
#endif /* defined(CUSTOMER_DBG_PREFIX_ENABLE) */
#define WLDEV_ERROR_MSG(x, args...) \
do { \
WL_DBG_PRINT_SYSTEM_TIME; \
pr_cont(WLDEV_ERROR_TEXT x, ## args); \
printf(WLDEV_ERROR_TEXT x, ## args); \
} while (0)
#define WLDEV_ERROR(x) WLDEV_ERROR_MSG x
#define WLDEV_INFO_MSG(x, args...) \
do { \
WL_DBG_PRINT_SYSTEM_TIME; \
pr_cont(WLDEV_INFO_TEXT x, ## args); \
printf(WLDEV_INFO_TEXT x, ## args); \
} while (0)
#define WLDEV_INFO(x) WLDEV_INFO_MSG x