net: wireless: update bcmdhd driver to 1.579.77.41.22

Change-Id: Ib5df542df130214999a3c2d4361c265fa8bcc39f
Signed-off-by: Alex Zhao <zzc@rock-chips.com>
This commit is contained in:
Alex Zhao
2019-12-11 14:34:37 +08:00
committed by Tao Huang
parent a18ff36155
commit 2b8a795846
53 changed files with 8629 additions and 3738 deletions

View File

@@ -1,13 +1,13 @@
# SPDX-License-Identifier: GPL-2.0
# bcmdhd
# 1. WL_IFACE_COMB_NUM_CHANNELS must be added if Android version is 4.4 with Kernel version 3.0~3.4,
# otherwise please remove it.
MODULE_NAME = bcmdhd
CONFIG_BCMDHD_SDIO := y
#CONFIG_BCMDHD_PCIE := y
#CONFIG_BCMDHD_USB := y
CONFIG_BCMDHD_OOB := y
#CONFIG_BCMDHD_CUSB := y
CONFIG_BCMDHD_PROPTXSTATUS := y
CONFIG_BCMDHD_AG := y
#CONFIG_DHD_USE_STATIC_BUF := y
@@ -20,10 +20,10 @@ DHDCFLAGS = -Wall -Wstrict-prototypes -Dlinux -DBCMDRIVER \
-DBCMDONGLEHOST -DUNRELEASEDCHIP -DBCMDMA32 -DBCMFILEIMAGE \
-DDHDTHREAD -DDHD_DEBUG -DSHOW_EVENTS -DBCMDBG -DGET_OTP_MAC_ENABLE \
-DWIFI_ACT_FRAME -DARP_OFFLOAD_SUPPORT -DSUPPORT_PM2_ONLY \
-DKEEP_ALIVE -DPKT_FILTER_SUPPORT -DPNO_SUPPORT -DDHDTCPACK_SUPPRESS \
-DKEEP_ALIVE -DPKT_FILTER_SUPPORT -DDHDTCPACK_SUPPRESS \
-DDHD_DONOT_FORWARD_BCMEVENT_AS_NETWORK_PKT \
-DMULTIPLE_SUPPLICANT -DTSQ_MULTIPLIER -DMFP \
-DWL_EXT_IAPSTA -DSUPPORT_P2P_GO_PS \
-DMULTIPLE_SUPPLICANT -DTSQ_MULTIPLIER -DMFP -DDHD_8021X_DUMP \
-DWL_EXT_IAPSTA -DWL_ESCAN \
-DENABLE_INSMOD_NO_FW_LOAD -DDHD_UNSUPPORT_IF_CNTS \
-Idrivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd \
-Idrivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/include
@@ -31,15 +31,16 @@ DHDCFLAGS = -Wall -Wstrict-prototypes -Dlinux -DBCMDRIVER \
DHDOFILES = aiutils.o siutils.o sbutils.o bcmutils.o bcmwifi_channels.o \
dhd_linux.o dhd_linux_platdev.o dhd_linux_sched.o dhd_pno.o \
dhd_common.o dhd_ip.o dhd_linux_wq.o dhd_custom_gpio.o \
bcmevent.o hndpmu.o linux_osl.o wldev_common.o wl_android.o \
dhd_debug_linux.o dhd_debug.o dhd_mschdbg.o \
hnd_pktq.o hnd_pktpool.o dhd_config.o wl_android_ext.o
bcmevent.o hndpmu.o linux_osl.o wldev_common.o wl_android.o bcmxtlv.o \
dhd_debug_linux.o dhd_debug.o dhd_mschdbg.o hnd_pktq.o hnd_pktpool.o \
dhd_config.o wl_event.o wl_android_ext.o wl_escan.o
#BCMDHD_SDIO
ifneq ($(CONFIG_BCMDHD_SDIO),)
DHDCFLAGS += -DBCMSDIO -DMMC_SDIO_ABORT -DBCMLXSDMMC -DUSE_SDIOFIFO_IOVAR \
-DSDTEST -DBDC -DDHD_USE_IDLECOUNT -DCUSTOM_SDIO_F2_BLKSIZE=256 \
-DBCMSDIOH_TXGLOM -DBCMSDIOH_TXGLOM_EXT -DRXFRAME_THREAD
-DBCMSDIOH_TXGLOM -DBCMSDIOH_TXGLOM_EXT -DRXFRAME_THREAD \
-DDHDENABLE_TAILPAD -DSUPPORT_P2P_GO_PS -DBCMSDIO_RXLIM_POST
ifeq ($(CONFIG_BCMDHD_OOB),y)
DHDCFLAGS += -DOOB_INTR_ONLY -DCUSTOMER_OOB -DHW_OOB
ifeq ($(CONFIG_BCMDHD_DISABLE_WOWLAN),y)
@@ -48,7 +49,6 @@ endif
else
DHDCFLAGS += -DSDIO_ISR_THREAD
endif
DHDOFILES += bcmsdh.o bcmsdh_linux.o bcmsdh_sdmmc.o bcmsdh_sdmmc_linux.o \
dhd_sdio.o dhd_cdc.o dhd_wlfc.o
endif
@@ -57,10 +57,10 @@ endif
ifneq ($(CONFIG_BCMDHD_PCIE),)
DHDCFLAGS += -DPCIE_FULL_DONGLE -DBCMPCIE -DCUSTOM_DPC_PRIO_SETTING=-1 \
-DDONGLE_ENABLE_ISOLATION
DHDCFLAGS += -DDHD_LB -DDHD_LB_RXP -DDHD_LB_STATS #-DDHD_LB_TXP
ifneq ($(CONFIG_PCI_MSI),)
DHDCFLAGS += -DDHD_USE_MSI
endif
DHDOFILES += dhd_pcie.o dhd_pcie_linux.o pcie_core.o dhd_flowring.o \
dhd_msgbuf.o
endif
@@ -75,7 +75,6 @@ ifneq ($(CONFIG_BCMDHD_CUSB),)
DHDCFLAGS += -DBCMUSBDEV_COMPOSITE
DHDCFLAGS :=$(filter-out -DENABLE_INSMOD_NO_FW_LOAD,$(DHDCFLAGS))
endif
DHDOFILES += dbus.o dbus_usb.o dbus_usb_linux.o dhd_cdc.o dhd_wlfc.o
endif
@@ -95,18 +94,20 @@ endif
#VTS_SUPPORT
ifeq ($(CONFIG_VTS_SUPPORT),y)
ifneq ($(CONFIG_CFG80211),)
DHDCFLAGS += -DGSCAN_SUPPORT -DRTT_SUPPORT -DCUSTOM_FORCE_NODFS_FLAG \
-DLINKSTAT_SUPPORT -DDEBUGABILITY -DDBG_PKT_MON -DPKT_FILTER_SUPPORT \
-DAPF -DNDO_CONFIG_SUPPORT -DRSSI_MONITOR_SUPPORT -DDHD_WAKE_STATUS \
-DCUSTOM_COUNTRY_CODE -DDHD_FW_COREDUMP -DEXPLICIT_DISCIF_CLEANUP
DHDOFILES += bcmxtlv.o dhd_rtt.o bcm_app_utils.o
DHDCFLAGS += -DGSCAN_SUPPORT -DRTT_SUPPORT -DLINKSTAT_SUPPORT \
-DCUSTOM_COUNTRY_CODE \
-DDEBUGABILITY -DDBG_PKT_MON -DDHD_FW_COREDUMP \
-DAPF -DNDO_CONFIG_SUPPORT -DRSSI_MONITOR_SUPPORT -DDHD_WAKE_STATUS
DHDOFILES += dhd_rtt.o bcm_app_utils.o
endif
endif
# MESH support for kernel 3.10 later
ifeq ($(CONFIG_WL_MESH),y)
DHDCFLAGS += -DWLMESH
ifneq ($(CONFIG_CFG80211),)
DHDCFLAGS += -DWLMESH_CFG80211
endif
ifneq ($(CONFIG_BCMDHD_PCIE),)
DHDCFLAGS += -DBCM_HOST_BUF -DDMA_HOST_BUFFER_LEN=0x80000
endif
@@ -115,9 +116,9 @@ endif
DHDCFLAGS :=$(filter-out -DSET_RANDOM_MAC_SOFTAP,$(DHDCFLAGS))
endif
#obj-$(CONFIG_RKWIFI) += bcmdhd.o
obj-$(CONFIG_AP6XXX) += bcmdhd.o
bcmdhd-objs += $(DHDOFILES)
#obj-$(CONFIG_RKWIFI) += $(MODULE_NAME).o
obj-$(CONFIG_AP6XXX) += $(MODULE_NAME).o
$(MODULE_NAME)-objs += $(DHDOFILES)
ifeq ($(CONFIG_MACH_PLATFORM),y)
DHDOFILES += dhd_gpio.o
@@ -140,17 +141,14 @@ ifeq ($(CONFIG_DHD_USE_STATIC_BUF),y)
endif
ifneq ($(CONFIG_WIRELESS_EXT),)
DHDOFILES += wl_iw.o wl_escan.o
DHDCFLAGS += -DSOFTAP -DWL_WIRELESS_EXT -DUSE_IW -DWL_ESCAN
DHDOFILES += wl_iw.o
DHDCFLAGS += -DSOFTAP -DWL_WIRELESS_EXT -DUSE_IW
endif
ifneq ($(CONFIG_CFG80211),)
DHDOFILES += wl_cfg80211.o wl_cfgp2p.o wl_linux_mon.o wl_cfg_btcoex.o wl_cfgvendor.o
DHDOFILES += dhd_cfg80211.o
DHDCFLAGS += -DWL_CFG80211 -DWLP2P -DWL_CFG80211_STA_EVENT -DWL_ENABLE_P2P_IF
# DHDCFLAGS += -DWL_IFACE_COMB_NUM_CHANNELS
DHDCFLAGS += -DCUSTOM_ROAM_TRIGGER_SETTING=-65
DHDCFLAGS += -DCUSTOM_ROAM_DELTA_SETTING=15
DHDCFLAGS += -DCUSTOM_KEEP_ALIVE_SETTING=28000
DHDCFLAGS += -DCUSTOM_PNO_EVENT_LOCK_xTIME=7
DHDCFLAGS += -DWL_SUPPORT_AUTO_CHANNEL
DHDCFLAGS += -DWL_SUPPORT_BACKPORTED_KPATCHES
@@ -158,6 +156,8 @@ ifneq ($(CONFIG_CFG80211),)
DHDCFLAGS += -DVSDB -DWL_CFG80211_VSDB_PRIORITIZE_SCAN_REQUEST
DHDCFLAGS += -DWLTDLS -DMIRACAST_AMPDU_SIZE=8
DHDCFLAGS += -DWL_VIRTUAL_APSTA
DHDCFLAGS += -DPNO_SUPPORT -DEXPLICIT_DISCIF_CLEANUP
DHDCFLAGS += -DWL_SAE
endif
EXTRA_CFLAGS = $(DHDCFLAGS)
ifeq ($(CONFIG_BCMDHD),m)

View File

@@ -108,6 +108,10 @@ static const bcmevent_name_str_t bcmevent_names[] = {
BCMEVENT_NAME(WLC_E_ACTION_FRAME),
BCMEVENT_NAME(WLC_E_ACTION_FRAME_RX),
BCMEVENT_NAME(WLC_E_ACTION_FRAME_COMPLETE),
#ifdef BCMWAPI_WAI
BCMEVENT_NAME(WLC_E_WAI_STA_EVENT),
BCMEVENT_NAME(WLC_E_WAI_MSG),
#endif /* BCMWAPI_WAI */
BCMEVENT_NAME(WLC_E_ESCAN_RESULT),
BCMEVENT_NAME(WLC_E_ACTION_FRAME_OFF_CHAN_COMPLETE),
#ifdef WLP2P
@@ -169,6 +173,9 @@ static const bcmevent_name_str_t bcmevent_names[] = {
#if defined(BT_WIFI_HANDOVER) || defined(WL_TBOW)
BCMEVENT_NAME(WLC_E_BT_WIFI_HANDOVER_REQ),
#endif
#ifdef WLFBT
BCMEVENT_NAME(WLC_E_FBT_AUTH_REQ_IND),
#endif /* WLFBT */
BCMEVENT_NAME(WLC_E_AUTHORIZED),
BCMEVENT_NAME(WLC_E_PROBREQ_MSG_RX),
BCMEVENT_NAME(WLC_E_CSA_START_IND),

View File

@@ -222,10 +222,13 @@ int bcmsdh_get_total_wake(bcmsdh_info_t *bcmsdh)
int bcmsdh_set_get_wake(bcmsdh_info_t *bcmsdh, int flag)
{
#if defined(OOB_INTR_ONLY)
bcmsdh_os_info_t *bcmsdh_osinfo = bcmsdh->os_cxt;
unsigned long flags;
int ret;
#endif
int ret = 0;
#if defined(OOB_INTR_ONLY)
spin_lock_irqsave(&bcmsdh_osinfo->oob_irq_spinlock, flags);
ret = bcmsdh->pkt_wake;
@@ -233,6 +236,7 @@ int bcmsdh_set_get_wake(bcmsdh_info_t *bcmsdh, int flag)
bcmsdh->pkt_wake = flag;
spin_unlock_irqrestore(&bcmsdh_osinfo->oob_irq_spinlock, flags);
#endif
return ret;
}
#endif /* DHD_WAKE_STATUS */

View File

@@ -84,11 +84,6 @@ static void IRQHandlerF2(struct sdio_func *func);
static int sdioh_sdmmc_get_cisaddr(sdioh_info_t *sd, uint32 regaddr);
#if defined(ENABLE_INSMOD_NO_FW_LOAD) && !defined(BUS_POWER_RESTORE)
extern int sdio_reset_comm(struct mmc_card *card);
#else
int sdio_reset_comm(struct mmc_card *card)
{
return 0;
}
#endif
#ifdef GLOBAL_SDMMC_INSTANCE
extern PBCMSDH_SDMMC_INSTANCE gInstance;
@@ -599,6 +594,7 @@ sdioh_iovar_op(sdioh_info_t *si, const char *name,
/* Now set it */
si->client_block_size[func] = blksize;
#ifdef USE_DYNAMIC_F2_BLKSIZE
if (si->func[func] == NULL) {
sd_err(("%s: SDIO Device not present\n", __FUNCTION__));
bcmerror = BCME_NORESOURCE;
@@ -610,6 +606,7 @@ sdioh_iovar_op(sdioh_info_t *si, const char *name,
sd_err(("%s: Failed to set F%d blocksize to %d(%d)\n",
__FUNCTION__, func, blksize, bcmerror));
sdio_release_host(si->func[func]);
#endif /* USE_DYNAMIC_F2_BLKSIZE */
break;
}
@@ -835,10 +832,10 @@ sdioh_request_byte(sdioh_info_t *sd, uint rw, uint func, uint regaddr, uint8 *by
#if defined(MMC_SDIO_ABORT)
int sdio_abort_retry = MMC_SDIO_ABORT_RETRY_LIMIT;
#endif
struct timespec now, before = {};
struct osl_timespec now, before;
if (sd_msglevel & SDH_COST_VAL)
getnstimeofday(&before);
osl_do_gettimeofday(&before);
sd_info(("%s: rw=%d, func=%d, addr=0x%05x\n", __FUNCTION__, rw, func, regaddr));
@@ -939,6 +936,26 @@ sdioh_request_byte(sdioh_info_t *sd, uint rw, uint func, uint regaddr, uint8 *by
}
}
#endif /* MMC_SDIO_ABORT */
/* to allow abort command through F1 */
#if defined(SDIO_ISR_THREAD)
else if (regaddr == SDIOD_CCCR_INTR_EXTN) {
while (sdio_abort_retry--) {
if (sd->func[func]) {
sdio_claim_host(sd->func[func]);
/*
* this sdio_f0_writeb() can be replaced with
* another api depending upon MMC driver change.
* As of this time, this is temporaray one
*/
sdio_writeb(sd->func[func],
*byte, regaddr, &err_ret);
sdio_release_host(sd->func[func]);
}
if (!err_ret)
break;
}
}
#endif
else if (regaddr < 0xF0) {
sd_err(("bcmsdh_sdmmc: F0 Wr:0x%02x: write disallowed\n", regaddr));
} else {
@@ -980,7 +997,7 @@ sdioh_request_byte(sdioh_info_t *sd, uint rw, uint func, uint regaddr, uint8 *by
}
if (sd_msglevel & SDH_COST_VAL) {
getnstimeofday(&now);
osl_do_gettimeofday(&now);
sd_cost(("%s: rw=%d len=1 cost=%lds %luus\n", __FUNCTION__,
rw, now.tv_sec-before.tv_sec, now.tv_nsec/1000-before.tv_nsec/1000));
}
@@ -1008,10 +1025,10 @@ sdioh_request_word(sdioh_info_t *sd, uint cmd_type, uint rw, uint func, uint add
#if defined(MMC_SDIO_ABORT)
int sdio_abort_retry = MMC_SDIO_ABORT_RETRY_LIMIT;
#endif
struct timespec now, before = {};
struct osl_timespec now, before;
if (sd_msglevel & SDH_COST_VAL)
getnstimeofday(&before);
osl_do_gettimeofday(&before);
if (func == 0) {
sd_err(("%s: Only CMD52 allowed to F0.\n", __FUNCTION__));
@@ -1074,7 +1091,7 @@ sdioh_request_word(sdioh_info_t *sd, uint cmd_type, uint rw, uint func, uint add
}
if (sd_msglevel & SDH_COST_VAL) {
getnstimeofday(&now);
osl_do_gettimeofday(&now);
sd_cost(("%s: rw=%d, len=%d cost=%lds %luus\n", __FUNCTION__,
rw, nbytes, now.tv_sec-before.tv_sec, now.tv_nsec/1000 - before.tv_nsec/1000));
}
@@ -1104,7 +1121,7 @@ sdioh_request_packet_chain(sdioh_info_t *sd, uint fix_inc, uint write, uint func
uint8 *localbuf = NULL;
uint local_plen = 0;
uint pkt_len = 0;
struct timespec now, before = {};
struct osl_timespec now, before;
sd_trace(("%s: Enter\n", __FUNCTION__));
ASSERT(pkt);
@@ -1112,7 +1129,7 @@ sdioh_request_packet_chain(sdioh_info_t *sd, uint fix_inc, uint write, uint func
DHD_PM_RESUME_RETURN_ERROR(SDIOH_API_RC_FAIL);
if (sd_msglevel & SDH_COST_VAL)
getnstimeofday(&before);
osl_do_gettimeofday(&before);
blk_size = sd->client_block_size[func];
max_blk_count = min(host->max_blk_count, (uint)MAX_IO_RW_EXTENDED_BLK);
@@ -1229,10 +1246,10 @@ sdioh_request_packet_chain(sdioh_info_t *sd, uint fix_inc, uint write, uint func
goto txglomfail;
}
}
bcopy(buf, (localbuf + local_plen), pkt_len);
local_plen += pkt_len;
if (PKTNEXT(sd->osh, pnext))
if (PKTNEXT(sd->osh, pnext))
continue;
buf = localbuf;
@@ -1286,7 +1303,7 @@ txglomfail:
MFREE(sd->osh, localbuf, ttl_len);
if (sd_msglevel & SDH_COST_VAL) {
getnstimeofday(&now);
osl_do_gettimeofday(&now);
sd_cost(("%s: rw=%d, ttl_len=%d, cost=%lds %luus\n", __FUNCTION__,
write, ttl_len, now.tv_sec-before.tv_sec, now.tv_nsec/1000-before.tv_nsec/1000));
}
@@ -1302,13 +1319,13 @@ sdioh_buffer_tofrom_bus(sdioh_info_t *sd, uint fix_inc, uint write, uint func,
{
bool fifo = (fix_inc == SDIOH_DATA_FIX);
int err_ret = 0;
struct timespec now, before = {};
struct osl_timespec now, before;
sd_trace(("%s: Enter\n", __FUNCTION__));
ASSERT(buf);
if (sd_msglevel & SDH_COST_VAL)
getnstimeofday(&before);
osl_do_gettimeofday(&before);
/* NOTE:
* For all writes, each packet length is aligned to 32 (or 4)
@@ -1342,7 +1359,7 @@ sdioh_buffer_tofrom_bus(sdioh_info_t *sd, uint fix_inc, uint write, uint func,
sd_trace(("%s: Exit\n", __FUNCTION__));
if (sd_msglevel & SDH_COST_VAL) {
getnstimeofday(&now);
osl_do_gettimeofday(&now);
sd_cost(("%s: rw=%d, len=%d cost=%lds %luus\n", __FUNCTION__,
write, len, now.tv_sec-before.tv_sec, now.tv_nsec/1000 - before.tv_nsec/1000));
}
@@ -1368,14 +1385,14 @@ sdioh_request_buffer(sdioh_info_t *sd, uint pio_dma, uint fix_inc, uint write, u
{
SDIOH_API_RC status;
void *tmppkt;
struct timespec now, before = {};
struct osl_timespec now, before;
sd_trace(("%s: Enter\n", __FUNCTION__));
DHD_PM_RESUME_WAIT(sdioh_request_buffer_wait);
DHD_PM_RESUME_RETURN_ERROR(SDIOH_API_RC_FAIL);
if (sd_msglevel & SDH_COST_VAL)
getnstimeofday(&before);
osl_do_gettimeofday(&before);
if (pkt) {
#ifdef BCMSDIOH_TXGLOM
@@ -1420,7 +1437,7 @@ sdioh_request_buffer(sdioh_info_t *sd, uint pio_dma, uint fix_inc, uint write, u
PKTFREE_STATIC(sd->osh, tmppkt, write ? TRUE : FALSE);
if (sd_msglevel & SDH_COST_VAL) {
getnstimeofday(&now);
osl_do_gettimeofday(&now);
sd_cost(("%s: len=%d cost=%lds %luus\n", __FUNCTION__,
buf_len, now.tv_sec-before.tv_sec, now.tv_nsec/1000 - before.tv_nsec/1000));
}
@@ -1583,11 +1600,13 @@ sdioh_start(sdioh_info_t *sd, int stage)
2.6.27. The implementation prior to that is buggy, and needs broadcom's
patch for it
*/
#if defined(ENABLE_INSMOD_NO_FW_LOAD) && !defined(BUS_POWER_RESTORE)
if ((ret = sdio_reset_comm(sd->func[0]->card))) {
sd_err(("%s Failed, error = %d\n", __FUNCTION__, ret));
return ret;
}
else {
} else
#endif
{
sd->num_funcs = 2;
sd->sd_blockmode = TRUE;
sd->use_client_ints = TRUE;

View File

@@ -2634,7 +2634,7 @@ process_nvram_vars(char *varbuf, unsigned int len)
break;
nv_ver[n-1] = varbuf[n];
}
printk("NVRAM version: %s\n", nv_ver);
printf("NVRAM version: %s\n", nv_ver);
}
for (n = 0; n < len; n++) {

View File

@@ -645,8 +645,10 @@ dbus_get_fw_nvram(dhd_bus_t *dhd_bus, char *pfw_path, char *pnv_path)
bcmerror = DBUS_ERR_NVRAM;
goto err;
}
if (nv_image)
if (nv_image) {
dhd_os_close_image(nv_image);
nv_image = NULL;
}
/* For Get first block of fw to calculate total_len */
file_exists = ((pfw_path != NULL) && (pfw_path[0] != '\0'));
@@ -2686,35 +2688,6 @@ dhd_bus_devreset(dhd_pub_t *dhdp, uint8 flag)
return bcmerror;
}
void
dhd_set_path_params(struct dhd_bus *bus)
{
/* External conf takes precedence if specified */
dhd_conf_preinit(bus->dhd);
if (bus->dhd->conf_path[0] == '\0') {
dhd_conf_set_path(bus->dhd, "config.txt", bus->dhd->conf_path, bus->nv_path);
}
if (bus->dhd->clm_path[0] == '\0') {
dhd_conf_set_path(bus->dhd, "clm.blob", bus->dhd->clm_path, bus->fw_path);
}
#ifdef CONFIG_PATH_AUTO_SELECT
dhd_conf_set_conf_name_by_chip(bus->dhd, bus->dhd->conf_path);
#endif
dhd_conf_read_config(bus->dhd, bus->dhd->conf_path);
dhd_conf_set_fw_name_by_chip(bus->dhd, bus->fw_path);
dhd_conf_set_nv_name_by_chip(bus->dhd, bus->nv_path);
dhd_conf_set_clm_name_by_chip(bus->dhd, bus->dhd->clm_path);
printf("Final fw_path=%s\n", bus->fw_path);
printf("Final nv_path=%s\n", bus->nv_path);
printf("Final clm_path=%s\n", bus->dhd->clm_path);
printf("Final conf_path=%s\n", bus->dhd->conf_path);
}
void
dhd_bus_update_fw_nv_path(struct dhd_bus *bus, char *pfw_path,
char *pnv_path, char *pclm_path, char *pconf_path)
@@ -2731,7 +2704,7 @@ dhd_bus_update_fw_nv_path(struct dhd_bus *bus, char *pfw_path,
bus->dhd->clm_path = pclm_path;
bus->dhd->conf_path = pconf_path;
dhd_set_path_params(bus);
dhd_conf_set_path_params(bus->dhd, NULL, bus->fw_path, bus->nv_path);
}
@@ -2799,6 +2772,8 @@ dhd_dbus_probe_cb(void *arg, const char *desc, uint32 bustype,
if (dbus_download_firmware(bus, bus->fw_path, bus->nv_path) != DBUS_OK)
goto fail;
#endif
} else {
goto fail;
}
}
} else {

View File

@@ -352,9 +352,10 @@ enum dhd_bus_ds_state {
enum dhd_prealloc_index {
DHD_PREALLOC_PROT = 0,
DHD_PREALLOC_RXBUF,
DHD_PREALLOC_DATABUF,
DHD_PREALLOC_OSL_BUF,
DHD_PREALLOC_RXBUF = 1,
DHD_PREALLOC_DATABUF = 2,
DHD_PREALLOC_OSL_BUF = 3,
DHD_PREALLOC_SKB_BUF = 4,
#if defined(STATIC_WL_PRIV_STRUCT)
DHD_PREALLOC_WIPHY_ESCAN0 = 5,
#endif /* STATIC_WL_PRIV_STRUCT */
@@ -370,7 +371,7 @@ enum dhd_prealloc_index {
DHD_PREALLOC_DHD_LOG_DUMP_BUF_EX = 16,
DHD_PREALLOC_DHD_PKTLOG_DUMP_BUF = 17,
DHD_PREALLOC_STAT_REPORT_BUF = 18,
DHD_PREALLOC_WL_ESCAN_INFO = 19,
DHD_PREALLOC_WL_ESCAN = 19,
DHD_PREALLOC_FW_VERBOSE_RING = 20,
DHD_PREALLOC_FW_EVENT_RING = 21,
DHD_PREALLOC_DHD_EVENT_RING = 22,
@@ -1040,18 +1041,22 @@ typedef struct dhd_pub {
char *conf_path; /* module_param: path to config vars file */
struct dhd_conf *conf; /* Bus module handle */
void *adapter; /* adapter information, interrupt, fw path etc. */
void *event_params;
#ifdef BCMDBUS
bool dhd_remove;
#endif /* BCMDBUS */
#if defined(WL_WIRELESS_EXT)
#if defined(WL_ESCAN)
void *escan;
#else
void *iscan;
#ifdef WL_ESCAN
struct wl_escan_info *escan;
#endif
#if defined(WL_WIRELESS_EXT)
void *wext_info;
#endif
#ifdef WL_EXT_IAPSTA
void *iapsta_params;
#endif
int hostsleep;
#ifdef SENDPROB
bool recv_probereq;
#endif
} dhd_pub_t;
@@ -1535,7 +1540,7 @@ extern void dhd_os_dhdiovar_lock(dhd_pub_t *pub);
extern void dhd_os_dhdiovar_unlock(dhd_pub_t *pub);
extern int dhd_os_proto_block(dhd_pub_t * pub);
extern int dhd_os_proto_unblock(dhd_pub_t * pub);
extern int dhd_os_ioctl_resp_wait(dhd_pub_t * pub, uint * condition, bool resched);
extern int dhd_os_ioctl_resp_wait(dhd_pub_t * pub, uint * condition);
extern int dhd_os_ioctl_resp_wake(dhd_pub_t * pub);
extern unsigned int dhd_os_get_ioctl_resp_timeout(void);
extern void dhd_os_set_ioctl_resp_timeout(unsigned int timeout_msec);
@@ -1877,6 +1882,7 @@ extern uint dhd_console_ms;
extern uint android_msg_level;
extern uint config_msg_level;
extern uint sd_msglevel;
extern uint dump_msg_level;
#ifdef BCMDBUS
extern uint dbus_msglevel;
#endif /* BCMDBUS */

View File

@@ -116,7 +116,7 @@ dhdcdc_msg(dhd_pub_t *dhd)
#endif /* BCMDBUS */
#ifdef BCMDBUS
timeout = dhd_os_ioctl_resp_wait(dhd, &prot->ctl_completed, false);
timeout = dhd_os_ioctl_resp_wait(dhd, &prot->ctl_completed);
if ((!timeout) || (!prot->ctl_completed)) {
DHD_ERROR(("Txctl timeout %d ctl_completed %d\n",
timeout, prot->ctl_completed));
@@ -138,7 +138,7 @@ dhdcdc_msg(dhd_pub_t *dhd)
/* interrupt polling is sucessfully submitted. Wait for dongle to send
* interrupt
*/
timeout = dhd_os_ioctl_resp_wait(dhd, &prot->ctl_completed, false);
timeout = dhd_os_ioctl_resp_wait(dhd, &prot->ctl_completed);
if (!timeout) {
DHD_ERROR(("intr poll wait timed out\n"));
}
@@ -172,7 +172,7 @@ dhdcdc_cmplt(dhd_pub_t *dhd, uint32 id, uint32 len)
DHD_OS_IOCTL_RESP_UNLOCK(dhd);
goto done;
}
timeout = dhd_os_ioctl_resp_wait(dhd, &prot->ctl_completed, false);
timeout = dhd_os_ioctl_resp_wait(dhd, &prot->ctl_completed);
if ((!timeout) || (!prot->ctl_completed)) {
DHD_ERROR(("Rxctl timeout %d ctl_completed %d\n",
timeout, prot->ctl_completed));

View File

@@ -161,10 +161,8 @@ void dhd_netdev_free(struct net_device *ndev)
#ifdef WL_CFG80211
ndev = dhd_cfg80211_netdev_free(ndev);
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 11, 0)
if (ndev)
free_netdev(ndev);
#endif
}
static s32

View File

@@ -53,12 +53,13 @@
#include <dhd_bus.h>
#include <dhd_proto.h>
#include <dhd_config.h>
#include <bcmsdbus.h>
#include <dhd_dbg.h>
#include <dhd_debug.h>
#include <dhd_mschdbg.h>
#include <msgtrace.h>
#include <dhd_config.h>
#include <wl_android.h>
#ifdef WL_CFG80211
#include <wl_cfg80211.h>
@@ -828,6 +829,9 @@ dhd_wl_ioctl(dhd_pub_t *dhd_pub, int ifidx, wl_ioctl_t *ioc, void *buf, int len)
#ifdef DUMP_IOCTL_IOV_LIST
dhd_iov_li_t *iov_li;
#endif /* DUMP_IOCTL_IOV_LIST */
int hostsleep_set = 0;
int hostsleep_val = 0;
#ifdef KEEPIF_ON_DEVICE_RESET
if (ioc->cmd == WLC_GET_VAR) {
dbus_config_t config;
@@ -919,7 +923,11 @@ dhd_wl_ioctl(dhd_pub_t *dhd_pub, int ifidx, wl_ioctl_t *ioc, void *buf, int len)
}
}
#endif /* DUMP_IOCTL_IOV_LIST */
if (dhd_conf_check_hostsleep(dhd_pub, ioc->cmd, ioc->buf, len,
&hostsleep_set, &hostsleep_val, &ret))
goto exit;
ret = dhd_prot_ioctl(dhd_pub, ifidx, ioc, buf, len);
dhd_conf_get_hostsleep(dhd_pub, hostsleep_set, hostsleep_val, ret);
#ifdef DUMP_IOCTL_IOV_LIST
if (ret == -ETIMEDOUT) {
DHD_ERROR(("Last %d issued commands: Latest one is at bottom.\n",
@@ -983,6 +991,7 @@ dhd_wl_ioctl(dhd_pub_t *dhd_pub, int ifidx, wl_ioctl_t *ioc, void *buf, int len)
dhd_pub->busstate = DHD_BUS_DOWN;
}
exit:
DHD_LINUX_GENERAL_LOCK(dhd_pub, flags);
DHD_BUS_BUSY_CLEAR_IN_IOVAR(dhd_pub);
dhd_os_busbusy_wake(dhd_pub);
@@ -3272,7 +3281,6 @@ dhd_print_buf(void *pbuf, int len, int bytes_per_line)
#define strtoul(nptr, endptr, base) bcm_strtoul((nptr), (endptr), (base))
#endif
#if defined(PKT_FILTER_SUPPORT) || defined(DHD_PKT_LOGGING)
/* Convert user's input in hex pattern to byte-size mask */
int
wl_pattern_atoh(char *src, char *dst)
@@ -3297,7 +3305,6 @@ wl_pattern_atoh(char *src, char *dst)
}
return i;
}
#endif /* PKT_FILTER_SUPPORT || DHD_PKT_LOGGING */
#ifdef PKT_FILTER_SUPPORT
void
@@ -3655,7 +3662,7 @@ dhd_pktfilter_offload_set(dhd_pub_t * dhd, char *arg)
rc = rc >= 0 ? 0 : rc;
if (rc)
DHD_TRACE(("%s: failed to add pktfilter %s, retcode = %d\n",
DHD_ERROR(("%s: failed to add pktfilter %s, retcode = %d\n",
__FUNCTION__, arg, rc));
else
DHD_TRACE(("%s: successfully added pktfilter %s\n",
@@ -4263,7 +4270,6 @@ dhd_get_suspend_bcn_li_dtim(dhd_pub_t *dhd)
if (bcn_li_dtim == 0) {
bcn_li_dtim = 1;
}
bcn_li_dtim = MAX(dhd->suspend_bcn_li_dtim, bcn_li_dtim);
} else {
/* attemp to use platform defined dtim skip interval */
bcn_li_dtim = dhd->suspend_bcn_li_dtim;
@@ -4291,8 +4297,6 @@ dhd_get_suspend_bcn_li_dtim(dhd_pub_t *dhd)
}
}
if (dhd->conf->suspend_bcn_li_dtim >= 0)
bcn_li_dtim = dhd->conf->suspend_bcn_li_dtim;
DHD_ERROR(("%s beacon=%d bcn_li_dtim=%d DTIM=%d Listen=%d\n",
__FUNCTION__, ap_beacon, bcn_li_dtim, dtim_period, CUSTOM_LISTEN_INTERVAL));
@@ -4994,69 +4998,78 @@ void dhd_free_download_buffer(dhd_pub_t *dhd, void *buffer, int length)
}
#if defined(DHD_8021X_DUMP)
#define EAP_PRINT(str) \
DHD_ERROR(("ETHER_TYPE_802_1X[%s] [%s]: " str "\n", \
ifname, direction ? "TX" : "RX"));
#define EAP_PRINT(x, args...) \
do { \
if (dump_msg_level & DUMP_EAPOL_VAL) { \
printk("[dhd-%s] 802_1X " x " [%s] : (%s) %s (%s)\n", ifname, ## args, \
tx?"TX":"RX", tx?seabuf:deabuf, tx?"->":"<-", tx?deabuf:seabuf); \
} \
} while (0)
#else
#define EAP_PRINT(str)
#define EAP_PRINT(x, args...)
#endif /* DHD_8021X_DUMP */
/* Parse EAPOL 4 way handshake messages */
void
dhd_dump_eapol_4way_message(dhd_pub_t *dhd, char *ifname,
char *dump_data, bool direction)
char *dump_data, bool tx)
{
unsigned char type;
int pair, ack, mic, kerr, req, sec, install;
unsigned short us_tmp;
unsigned short us_tmp, key_len;
char seabuf[ETHER_ADDR_STR_LEN]="";
char deabuf[ETHER_ADDR_STR_LEN]="";
bcm_ether_ntoa((struct ether_addr *)dump_data, deabuf);
bcm_ether_ntoa((struct ether_addr *)(dump_data+6), seabuf);
type = dump_data[15];
if (type == 0) {
if ((dump_data[22] == 1) && (dump_data[18] == 1)) {
dhd->conf->eapol_status = EAPOL_STATUS_WPS_REQID;
EAP_PRINT("EAP Packet, Request, Identity");
dhd->conf->eapol_status = EAPOL_STATUS_REQID;
EAP_PRINT("Request, Identity");
} else if ((dump_data[22] == 1) && (dump_data[18] == 2)) {
dhd->conf->eapol_status = EAPOL_STATUS_WPS_RSPID;
EAP_PRINT("EAP Packet, Response, Identity");
dhd->conf->eapol_status = EAPOL_STATUS_RSPID;
EAP_PRINT("Response, Identity");
} else if (dump_data[22] == 254) {
if (dump_data[30] == 1) {
dhd->conf->eapol_status = EAPOL_STATUS_WPS_WSC_START;
EAP_PRINT("EAP Packet, WSC Start");
dhd->conf->eapol_status = EAPOL_STATUS_WSC_START;
EAP_PRINT("WSC Start");
} else if (dump_data[30] == 4) {
if (dump_data[41] == 4) {
dhd->conf->eapol_status = EAPOL_STATUS_WPS_M1;
EAP_PRINT("EAP Packet, WPS M1");
EAP_PRINT("WPS M1");
} else if (dump_data[41] == 5) {
dhd->conf->eapol_status = EAPOL_STATUS_WPS_M2;
EAP_PRINT("EAP Packet, WPS M2");
EAP_PRINT("WPS M2");
} else if (dump_data[41] == 7) {
dhd->conf->eapol_status = EAPOL_STATUS_WPS_M3;
EAP_PRINT("EAP Packet, WPS M3");
EAP_PRINT("WPS M3");
} else if (dump_data[41] == 8) {
dhd->conf->eapol_status = EAPOL_STATUS_WPS_M4;
EAP_PRINT("EAP Packet, WPS M4");
EAP_PRINT("WPS M4");
} else if (dump_data[41] == 9) {
dhd->conf->eapol_status = EAPOL_STATUS_WPS_M5;
EAP_PRINT("EAP Packet, WPS M5");
EAP_PRINT("WPS M5");
} else if (dump_data[41] == 10) {
dhd->conf->eapol_status = EAPOL_STATUS_WPS_M6;
EAP_PRINT("EAP Packet, WPS M6");
EAP_PRINT("WPS M6");
} else if (dump_data[41] == 11) {
dhd->conf->eapol_status = EAPOL_STATUS_WPS_M7;
EAP_PRINT("EAP Packet, WPS M7");
EAP_PRINT("WPS M7");
} else if (dump_data[41] == 12) {
dhd->conf->eapol_status = EAPOL_STATUS_WPS_M8;
EAP_PRINT("EAP Packet, WPS M8");
EAP_PRINT("WPS M8");
}
} else if (dump_data[30] == 5) {
dhd->conf->eapol_status = EAPOL_STATUS_WPS_DONE;
EAP_PRINT("EAP Packet, WSC Done");
dhd->conf->eapol_status = EAPOL_STATUS_WSC_DONE;
EAP_PRINT("WSC Done");
}
} else {
DHD_ERROR(("ETHER_TYPE_802_1X[%s] [%s]: ver %d, type %d, replay %d\n",
ifname, direction ? "TX" : "RX",
dump_data[14], dump_data[15], dump_data[30]));
EAP_PRINT("ver %d, type %d, replay %d",
dump_data[14], dump_data[15], dump_data[30]);
}
} else if (type == 3 && dump_data[18] == 2) {
}
else if (type == 3 && dump_data[18] == 2) {
us_tmp = (dump_data[19] << 8) | dump_data[20];
pair = 0 != (us_tmp & 0x08);
ack = 0 != (us_tmp & 0x80);
@@ -5066,27 +5079,59 @@ dhd_dump_eapol_4way_message(dhd_pub_t *dhd, char *ifname,
sec = 0 != (us_tmp & 0x200);
install = 0 != (us_tmp & 0x40);
if (!sec && !mic && ack && !install && pair && !kerr && !req) {
dhd->conf->eapol_status = EAPOL_STATUS_WPA_M1;
EAP_PRINT("EAPOL Packet, 4-way handshake, M1");
} else if (pair && !install && !ack && mic && !sec && !kerr && !req) {
dhd->conf->eapol_status = EAPOL_STATUS_WPA_M2;
EAP_PRINT("EAPOL Packet, 4-way handshake, M2");
} else if (pair && ack && mic && sec && !kerr && !req) {
dhd->conf->eapol_status = EAPOL_STATUS_WPA_M3;
EAP_PRINT("EAPOL Packet, 4-way handshake, M3");
} else if (pair && !install && !ack && mic && sec && !req && !kerr) {
dhd->conf->eapol_status = EAPOL_STATUS_WPA_M4;
EAP_PRINT("EAPOL Packet, 4-way handshake, M4");
if (!req && !kerr && !sec && !mic && ack && !install && pair) {
dhd->conf->eapol_status = EAPOL_STATUS_4WAY_M1;
EAP_PRINT("WPA2 4-way M1(0x%04x)", us_tmp);
} else if (!req && !kerr && !sec && mic && !ack && !install && pair) {
dhd->conf->eapol_status = EAPOL_STATUS_4WAY_M2;
EAP_PRINT("WPA2 4-way M2(0x%04x)", us_tmp);
} else if (!req && !kerr && sec && mic && ack && pair) {
dhd->conf->eapol_status = EAPOL_STATUS_4WAY_M3;
EAP_PRINT("WPA2 4-way M3(0x%04x)", us_tmp);
} else if (!req && !kerr && sec && mic && !ack && !install && pair) {
dhd->conf->eapol_status = EAPOL_STATUS_4WAY_M4;
EAP_PRINT("WPA2 4-way M4(0x%04x)", us_tmp);
} else {
DHD_ERROR(("ETHER_TYPE_802_1X[%s] [%s]: ver %d, type %d, replay %d\n",
ifname, direction ? "TX" : "RX",
dump_data[14], dump_data[15], dump_data[30]));
EAP_PRINT("ver %d, type %d, key_info 0x%x, replay %d",
dump_data[14], dump_data[15], us_tmp, dump_data[30]);
}
}
else if (type == 3 && dump_data[18] == 254) {
us_tmp = (dump_data[19] << 8) | dump_data[20];
req = 0 != (us_tmp & 0x800);
kerr = 0 != (us_tmp & 0x400);
sec = 0 != (us_tmp & 0x200);
mic = 0 != (us_tmp & 0x100);
ack = 0 != (us_tmp & 0x80);
install = 0 != (us_tmp & 0x40);
pair = 0 != (us_tmp & 0x08);
key_len = (dump_data[111] << 8) | dump_data[112];
if (!req && !kerr && !sec && !mic && ack && !install && pair) {
dhd->conf->eapol_status = EAPOL_STATUS_4WAY_M1;
EAP_PRINT("WPA 4-way M1(0x%04x)", us_tmp);
} else if (!req && !kerr && !sec && mic && !ack && !install && pair && key_len) {
dhd->conf->eapol_status = EAPOL_STATUS_4WAY_M2;
EAP_PRINT("WPA 4-way M2(0x%04x)", us_tmp);
} else if (!req && !kerr && !sec && mic && ack && install && pair) {
dhd->conf->eapol_status = EAPOL_STATUS_4WAY_M3;
EAP_PRINT("WPA 4-way M3(0x%04x)", us_tmp);
} else if (!req && !kerr && !sec && mic && !ack && !install && pair) {
dhd->conf->eapol_status = EAPOL_STATUS_4WAY_M4;
EAP_PRINT("WPA 4-way M4(0x%04x)", us_tmp);
} else if (!req && !kerr && sec && mic && ack && !install && !pair) {
dhd->conf->eapol_status = EAPOL_STATUS_GROUPKEY_M1;
EAP_PRINT("GROUP Key M1(0x%04x)", us_tmp);
} else if (!req && !kerr && sec && mic && !ack && !install && !pair) {
dhd->conf->eapol_status = EAPOL_STATUS_GROUPKEY_M2;
EAP_PRINT("GROUP Key M2(0x%04x)", us_tmp);
} else {
EAP_PRINT("ver %d, type %d, key_type %d, key_info 0x%x, replay %d",
dump_data[14], dump_data[15], dump_data[18], us_tmp, dump_data[30]);
}
} else {
DHD_ERROR(("ETHER_TYPE_802_1X[%s] [%s]: ver %d, type %d, replay %d\n",
ifname, direction ? "TX" : "RX",
dump_data[14], dump_data[15], dump_data[30]));
EAP_PRINT("ver %d, type %d, replay %d",
dump_data[14], dump_data[15], dump_data[30]);
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +1,5 @@
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _dhd_config_
#define _dhd_config_
@@ -85,17 +86,18 @@ typedef struct conf_pkt_filter_del {
} conf_pkt_filter_del_t;
#endif
#define CONFIG_COUNTRY_LIST_SIZE 100
typedef struct conf_country_list {
uint32 count;
wl_country_t *cspec[CONFIG_COUNTRY_LIST_SIZE];
} conf_country_list_t;
#define CONFIG_COUNTRY_LIST_SIZE 500
typedef struct country_list {
struct country_list *next;
wl_country_t cspec;
} country_list_t;
/* mchan_params */
#define MCHAN_MAX_NUM 4
#define MIRACAST_SOURCE 1
#define MIRACAST_SINK 2
typedef struct mchan_params {
struct mchan_params *next;
int bw;
int p2p_mode;
int miracast_mode;
@@ -108,36 +110,57 @@ enum in4way_flags {
WAIT_DISCONNECTED = (1 << (3)),
};
enum in_suspend_flags {
NO_EVENT_IN_SUSPEND = (1 << (0)),
NO_TXDATA_IN_SUSPEND = (1 << (1)),
NO_TXCTL_IN_SUSPEND = (1 << (2)),
AP_DOWN_IN_SUSPEND = (1 << (3)),
ROAM_OFFLOAD_IN_SUSPEND = (1 << (4)),
AP_FILTER_IN_SUSPEND = (1 << (5)),
WOWL_IN_SUSPEND = (1 << (6)),
ALL_IN_SUSPEND = 0xFFFFFFFF,
};
enum in_suspend_mode {
AUTO_SUSPEND = -1,
EARLY_SUSPEND = 0,
PM_NOTIFIER = 1
};
enum eapol_status {
EAPOL_STATUS_NONE = 0,
EAPOL_STATUS_WPS_REQID,
EAPOL_STATUS_WPS_RSPID,
EAPOL_STATUS_WPS_WSC_START,
EAPOL_STATUS_WPS_M1,
EAPOL_STATUS_WPS_M2,
EAPOL_STATUS_WPS_M3,
EAPOL_STATUS_WPS_M4,
EAPOL_STATUS_WPS_M5,
EAPOL_STATUS_WPS_M6,
EAPOL_STATUS_WPS_M7,
EAPOL_STATUS_WPS_M8,
EAPOL_STATUS_WPS_DONE,
EAPOL_STATUS_WPA_START,
EAPOL_STATUS_WPA_M1,
EAPOL_STATUS_WPA_M2,
EAPOL_STATUS_WPA_M3,
EAPOL_STATUS_WPA_M4,
EAPOL_STATUS_WPA_END
EAPOL_STATUS_REQID = 1,
EAPOL_STATUS_RSPID = 2,
EAPOL_STATUS_WSC_START = 3,
EAPOL_STATUS_WPS_M1 = 4,
EAPOL_STATUS_WPS_M2 = 5,
EAPOL_STATUS_WPS_M3 = 6,
EAPOL_STATUS_WPS_M4 = 7,
EAPOL_STATUS_WPS_M5 = 8,
EAPOL_STATUS_WPS_M6 = 9,
EAPOL_STATUS_WPS_M7 = 10,
EAPOL_STATUS_WPS_M8 = 11,
EAPOL_STATUS_WSC_DONE = 12,
EAPOL_STATUS_4WAY_START = 13,
EAPOL_STATUS_4WAY_M1 = 14,
EAPOL_STATUS_4WAY_M2 = 15,
EAPOL_STATUS_4WAY_M3 = 16,
EAPOL_STATUS_4WAY_M4 = 17,
EAPOL_STATUS_GROUPKEY_M1 = 18,
EAPOL_STATUS_GROUPKEY_M2 = 19,
EAPOL_STATUS_4WAY_DONE = 20
};
typedef struct dhd_conf {
uint chip;
uint chiprev;
int fw_type;
#ifdef BCMSDIO
wl_mac_list_ctrl_t fw_by_mac;
wl_mac_list_ctrl_t nv_by_mac;
#endif
wl_chip_nv_path_list_ctrl_t nv_by_chip;
conf_country_list_t country_list;
country_list_t *country_head;
int band;
int bw_cap[2];
wl_country_t cspec;
@@ -149,10 +172,12 @@ typedef struct dhd_conf {
int roam_delta[2];
int fullroamperiod;
uint keep_alive_period;
#ifdef ARP_OFFLOAD_SUPPORT
bool garp;
#endif
int force_wme_ac;
wme_param_t wme_sta;
wme_param_t wme_ap;
int phy_oclscdenable;
#ifdef PKT_FILTER_SUPPORT
conf_pkt_filter_add_t pkt_filter_add;
conf_pkt_filter_del_t pkt_filter_del;
@@ -161,7 +186,6 @@ typedef struct dhd_conf {
int srl;
int lrl;
uint bcn_timeout;
int txbf;
int disable_proptx;
int dhd_poll;
#ifdef BCMSDIO
@@ -185,9 +209,13 @@ typedef struct dhd_conf {
int txglom_bucket_size;
int txinrx_thres;
int dhd_txminmax; // -1=DATABUFCNT(bus)
uint sd_f2_blocksize;
bool oob_enabled_later;
int orphan_move;
#if defined(SDIO_ISR_THREAD)
bool intr_extn;
#endif
#ifdef BCMSDIO_RXLIM_POST
bool rxlim_en;
#endif
#endif
#ifdef BCMPCIE
int bus_deepsleep_disable;
@@ -198,17 +226,18 @@ typedef struct dhd_conf {
bool deepsleep;
int pm;
int pm_in_suspend;
int suspend_mode;
int suspend_bcn_li_dtim;
#ifdef DHDTCPACK_SUPPRESS
uint8 tcpack_sup_mode;
#endif
int pktprio8021x;
int xmit_in_suspend;
int ap_in_suspend;
uint insuspend;
bool suspended;
#ifdef SUSPEND_EVENT
bool suspend_eventmask_enable;
char suspend_eventmask[WL_EVENTING_MASK_LEN];
char resume_eventmask[WL_EVENTING_MASK_LEN];
struct ether_addr bssid_insuspend;
bool wlfc;
#endif
#ifdef IDHCP
int dhcpc_enable;
@@ -224,42 +253,40 @@ typedef struct dhd_conf {
char isam_enable[50];
#endif
int ctrl_resched;
int dhd_ioctl_timeout_msec;
struct mchan_params mchan[MCHAN_MAX_NUM];
mchan_params_t *mchan;
char *wl_preinit;
int tsq;
int orphan_move;
uint eapol_status;
uint in4way;
uint max_wait_gc_time;
#ifdef WL_EXT_WOWL
uint wowl;
#endif
#ifdef GET_CUSTOM_MAC_FROM_CONFIG
char hw_ether[62];
#endif
wait_queue_head_t event_complete;
} dhd_conf_t;
#ifdef BCMSDIO
int dhd_conf_get_mac(dhd_pub_t *dhd, bcmsdh_info_t *sdh, uint8 *mac);
void dhd_conf_set_fw_name_by_mac(dhd_pub_t *dhd, bcmsdh_info_t *sdh, char *fw_path);
void dhd_conf_set_nv_name_by_mac(dhd_pub_t *dhd, bcmsdh_info_t *sdh, char *nv_path);
#if defined(HW_OOB) || defined(FORCE_WOWLAN)
void dhd_conf_set_hw_oob_intr(bcmsdh_info_t *sdh, uint chip);
#endif
void dhd_conf_set_txglom_params(dhd_pub_t *dhd, bool enable);
int dhd_conf_set_blksize(bcmsdh_info_t *sdh);
#endif
void dhd_conf_set_fw_name_by_chip(dhd_pub_t *dhd, char *fw_path);
void dhd_conf_set_clm_name_by_chip(dhd_pub_t *dhd, char *clm_path);
void dhd_conf_set_nv_name_by_chip(dhd_pub_t *dhd, char *nv_path);
void dhd_conf_set_path(dhd_pub_t *dhd, char *dst_name, char *dst_path, char *src_path);
#ifdef CONFIG_PATH_AUTO_SELECT
void dhd_conf_set_conf_name_by_chip(dhd_pub_t *dhd, char *conf_path);
#endif
int dhd_conf_set_intiovar(dhd_pub_t *dhd, uint cmd, char *name, int val, int def, bool down);
int dhd_conf_get_iovar(dhd_pub_t *dhd, int cmd, char *name, char *buf, int len, int ifidx);
int dhd_conf_set_bufiovar(dhd_pub_t *dhd, uint cmd, char *name, char *buf, int len, bool down);
uint dhd_conf_get_band(dhd_pub_t *dhd);
void dhd_conf_set_path_params(dhd_pub_t *dhd, void *sdh,
char *fw_path, char *nv_path);
int dhd_conf_set_intiovar(dhd_pub_t *dhd, uint cmd, char *name, int val,
int def, bool down);
int dhd_conf_get_band(dhd_pub_t *dhd);
int dhd_conf_set_country(dhd_pub_t *dhd, wl_country_t *cspec);
int dhd_conf_get_country(dhd_pub_t *dhd, wl_country_t *cspec);
int dhd_conf_map_country_list(dhd_pub_t *dhd, wl_country_t *cspec);
int dhd_conf_fix_country(dhd_pub_t *dhd);
bool dhd_conf_match_channel(dhd_pub_t *dhd, uint32 channel);
void dhd_conf_set_wme(dhd_pub_t *dhd, int mode);
void dhd_conf_set_wme(dhd_pub_t *dhd, int ifidx, int mode);
void dhd_conf_set_mchan_bw(dhd_pub_t *dhd, int go, int source);
void dhd_conf_add_pkt_filter(dhd_pub_t *dhd);
bool dhd_conf_del_pkt_filter(dhd_pub_t *dhd, uint32 id);
@@ -269,17 +296,28 @@ int dhd_conf_set_chiprev(dhd_pub_t *dhd, uint chip, uint chiprev);
uint dhd_conf_get_chip(void *context);
uint dhd_conf_get_chiprev(void *context);
int dhd_conf_get_pm(dhd_pub_t *dhd);
int dhd_conf_check_hostsleep(dhd_pub_t *dhd, int cmd, void *buf, int len,
int *hostsleep_set, int *hostsleep_val, int *ret);
void dhd_conf_get_hostsleep(dhd_pub_t *dhd,
int hostsleep_set, int hostsleep_val, int ret);
int dhd_conf_mkeep_alive(dhd_pub_t *dhd, int ifidx, int id, int period,
char *packet, bool bcast);
#ifdef ARP_OFFLOAD_SUPPORT
void dhd_conf_set_garp(dhd_pub_t *dhd, int ifidx, uint32 ipa, bool enable);
#endif
#ifdef PROP_TXSTATUS
int dhd_conf_get_disable_proptx(dhd_pub_t *dhd);
#endif
int dhd_conf_get_ap_mode_in_suspend(dhd_pub_t *dhd);
int dhd_conf_set_ap_in_suspend(dhd_pub_t *dhd, int suspend);
uint dhd_conf_get_insuspend(dhd_pub_t *dhd, uint mask);
int dhd_conf_set_suspend_resume(dhd_pub_t *dhd, int suspend, int suspend_mode);
void dhd_conf_postinit_ioctls(dhd_pub_t *dhd);
int dhd_conf_preinit(dhd_pub_t *dhd);
int dhd_conf_reset(dhd_pub_t *dhd);
int dhd_conf_attach(dhd_pub_t *dhd);
void dhd_conf_detach(dhd_pub_t *dhd);
void *dhd_get_pub(struct net_device *dev);
void *dhd_get_conf(struct net_device *dev);
int wl_pattern_atoh(char *src, char *dst);
#ifdef BCMSDIO
extern int dhd_bus_sleep(dhd_pub_t *dhdp, bool sleep, uint32 *intstatus);
#endif
#endif /* _dhd_config_ */

View File

@@ -1272,7 +1272,7 @@ dhd_dbg_set_event_log_tag(dhd_pub_t *dhdp, uint16 tag, uint8 set)
ret = dhd_wl_ioctl_cmd(dhdp, WLC_SET_VAR, iovbuf, sizeof(iovbuf), TRUE, 0);
if (ret) {
DHD_ERROR(("%s set log tag iovar failed %d\n", __FUNCTION__, ret));
/* DHD_ERROR(("%s set log tag iovar failed %d\n", __FUNCTION__, ret)); */
}
}
@@ -1473,9 +1473,9 @@ __dhd_dbg_pkt_hash(uintptr_t pkt, uint32 pktid)
uint32
__dhd_dbg_driver_ts_usec(void)
{
struct timespec ts;
struct osl_timespec ts;
get_monotonic_boottime(&ts);
osl_get_monotonic_boottime(&ts);
return ((uint32)(__TIMESPEC_TO_US(ts)));
}

View File

@@ -45,14 +45,15 @@ dhd_wlan_set_power(int on
}
rockchip_wifi_power(1);
#if defined(BUS_POWER_RESTORE)
#if defined(BCMSDIO)
#if defined(BCMSDIO) && (LINUX_VERSION_CODE < KERNEL_VERSION(4, 19, 0))
if (adapter->sdio_func && adapter->sdio_func->card && adapter->sdio_func->card->host) {
mdelay(100);
printf("======== mmc_power_restore_host! ========\n");
mmc_power_restore_host(adapter->sdio_func->card->host);
}
#elif defined(BCMPCIE)
OSL_SLEEP(50); /* delay needed to be able to restore PCIe configuration registers */
if (adapter->pci_dev) {
mdelay(100);
printf("======== pci_set_power_state PCI_D0! ========\n");
pci_set_power_state(adapter->pci_dev, PCI_D0);
if (adapter->pci_saved_state)
@@ -69,7 +70,7 @@ dhd_wlan_set_power(int on
mdelay(100);
} else {
#if defined(BUS_POWER_RESTORE)
#if defined(BCMSDIO)
#if defined(BCMSDIO) && (LINUX_VERSION_CODE < KERNEL_VERSION(4, 19, 0))
if (adapter->sdio_func && adapter->sdio_func->card && adapter->sdio_func->card->host) {
printf("======== mmc_power_save_host! ========\n");
mmc_power_save_host(adapter->sdio_func->card->host);

View File

@@ -127,7 +127,7 @@ typedef struct {
int ifidx;
uint8 supp_cnt;
dhd_pub_t *dhdp;
struct timer_list timer;
timer_list_compat_t timer;
} tcpack_info_t;
typedef struct _tdata_psh_info_t {
@@ -287,20 +287,10 @@ static void _tdata_psh_info_pool_deinit(dhd_pub_t *dhdp,
return;
}
static void dhd_tcpack_send(
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
struct timer_list *t
#else
ulong data
#endif
)
static void dhd_tcpack_send(ulong data)
{
tcpack_sup_module_t *tcpack_sup_mod;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
tcpack_info_t *cur_tbl = from_timer(cur_tbl, t, timer);
#else
tcpack_info_t *cur_tbl = (tcpack_info_t *)data;
#endif
dhd_pub_t *dhdp;
int ifidx;
void* pkt;
@@ -474,13 +464,7 @@ int dhd_tcpack_suppress_set(dhd_pub_t *dhdp, uint8 mode)
tcpack_info_t *tcpack_info_tbl =
&tcpack_sup_module->tcpack_info_tbl[i];
tcpack_info_tbl->dhdp = dhdp;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
timer_setup(&tcpack_info_tbl->timer, dhd_tcpack_send, 0);
#else
init_timer(&tcpack_info_tbl->timer);
tcpack_info_tbl->timer.data = (ulong)tcpack_info_tbl;
tcpack_info_tbl->timer.function = dhd_tcpack_send;
#endif
init_timer_compat(&tcpack_info_tbl->timer, dhd_tcpack_send, tcpack_info_tbl);
}
break;
}

File diff suppressed because it is too large Load Diff

View File

@@ -107,9 +107,9 @@ struct wifi_platform_data {
int (*set_carddetect)(int val);
void *(*mem_prealloc)(int section, unsigned long size);
int (*get_mac_addr)(unsigned char *buf);
#if defined(CUSTOM_COUNTRY_CODE)
#ifdef CUSTOM_FORCE_NODFS_FLAG
void *(*get_country_code)(char *ccode, u32 flags);
#else /* defined (CUSTOM_COUNTRY_CODE) */
#else /* defined (CUSTOM_FORCE_NODFS_FLAG) */
void *(*get_country_code)(char *ccode);
#endif
};

View File

@@ -307,7 +307,7 @@ wifi_platform_get_country_code(wifi_adapter_info_t *adapter, char *ccode)
DHD_TRACE(("%s\n", __FUNCTION__));
if (plat_data->get_country_code) {
#ifdef CUSTOM_COUNTRY_CODE
#ifdef CUSTOM_FORCE_NODFS_FLAG
return plat_data->get_country_code(ccode, flags);
#else
return plat_data->get_country_code(ccode);
@@ -892,6 +892,9 @@ fail:
wifi_platform_set_power(adapter, FALSE, WIFI_TURNOFF_DELAY);
wifi_platform_bus_enumerate(adapter, FALSE);
}
#else
/* x86 bring-up PC needs no power-up operations */
err = dhd_bus_register();
#endif
return err;
@@ -906,11 +909,13 @@ static int dhd_wifi_platform_load_sdio(void)
#ifdef BCMDBUS
static int dhd_wifi_platform_load_usb(void)
{
int err = 0;
#if !defined(DHD_PRELOAD)
wifi_adapter_info_t *adapter;
s32 timeout = -1;
int i;
int err = 0;
enum wifi_adapter_status wait_status;
#endif
err = dhd_bus_register();
if (err) {
@@ -918,6 +923,7 @@ static int dhd_wifi_platform_load_usb(void)
goto exit;
}
#if !defined(DHD_PRELOAD)
/* power up all adapters */
for (i = 0; i < dhd_wifi_platdata->num_adapters; i++) {
adapter = &dhd_wifi_platdata->adapters[i];
@@ -944,10 +950,12 @@ static int dhd_wifi_platform_load_usb(void)
goto fail;
}
}
#endif
exit:
return err;
#if !defined(DHD_PRELOAD)
fail:
dhd_bus_unregister();
/* power down all adapters */
@@ -957,6 +965,7 @@ fail:
}
return err;
#endif
}
#else /* BCMDBUS */
static int dhd_wifi_platform_load_usb(void)

View File

@@ -6023,7 +6023,7 @@ dhd_msgbuf_wait_ioctl_cmplt(dhd_pub_t *dhd, uint32 len, void *buf)
goto out;
}
timeleft = dhd_os_ioctl_resp_wait(dhd, (uint *)&prot->ioctl_received, false);
timeleft = dhd_os_ioctl_resp_wait(dhd, (uint *)&prot->ioctl_received);
#ifdef DHD_RECOVER_TIMEOUT
if (prot->ioctl_received == 0) {
@@ -6064,10 +6064,11 @@ dhd_msgbuf_wait_ioctl_cmplt(dhd_pub_t *dhd, uint32 len, void *buf)
if (intstatus) {
DHD_ERROR(("%s: reschedule dhd_dpc, cnt=%d, intstatus=0x%x, intmask=0x%x\n",
__FUNCTION__, cnt, intstatus, intmask));
dhd->bus->intstatus = intstatus;
dhd->bus->ipend = TRUE;
dhd->bus->dpc_sched = TRUE;
dhd_sched_dpc(dhd);
timeleft = dhd_os_ioctl_resp_wait(dhd, &prot->ioctl_received, true);
timeleft = dhd_os_ioctl_resp_wait(dhd, &prot->ioctl_received);
}
}
} else {

View File

@@ -1628,36 +1628,6 @@ dhd_bus_download_firmware(struct dhd_bus *bus, osl_t *osh,
return ret;
}
void
dhd_set_path_params(struct dhd_bus *bus)
{
/* External conf takes precedence if specified */
dhd_conf_preinit(bus->dhd);
if (bus->dhd->clm_path[0] == '\0') {
dhd_conf_set_path(bus->dhd, "clm.blob", bus->dhd->clm_path, bus->fw_path);
}
dhd_conf_set_clm_name_by_chip(bus->dhd, bus->dhd->clm_path);
if (bus->dhd->conf_path[0] == '\0') {
dhd_conf_set_path(bus->dhd, "config.txt", bus->dhd->conf_path, bus->nv_path);
}
#ifdef CONFIG_PATH_AUTO_SELECT
dhd_conf_set_conf_name_by_chip(bus->dhd, bus->dhd->conf_path);
#endif
dhd_conf_read_config(bus->dhd, bus->dhd->conf_path);
dhd_conf_set_fw_name_by_chip(bus->dhd, bus->fw_path);
dhd_conf_set_nv_name_by_chip(bus->dhd, bus->nv_path);
dhd_conf_set_clm_name_by_chip(bus->dhd, bus->dhd->clm_path);
printf("Final fw_path=%s\n", bus->fw_path);
printf("Final nv_path=%s\n", bus->nv_path);
printf("Final clm_path=%s\n", bus->dhd->clm_path);
printf("Final conf_path=%s\n", bus->dhd->conf_path);
}
void
dhd_set_bus_params(struct dhd_bus *bus)
{
@@ -1709,7 +1679,7 @@ dhdpcie_download_firmware(struct dhd_bus *bus, osl_t *osh)
DHD_OS_WAKE_LOCK(bus->dhd);
dhd_set_path_params(bus);
dhd_conf_set_path_params(bus->dhd, NULL, bus->fw_path, bus->nv_path);
dhd_set_bus_params(bus);
ret = _dhdpcie_download_firmware(bus);
@@ -2920,7 +2890,8 @@ dhd_bus_schedule_queue(struct dhd_bus *bus, uint16 flow_id, bool txs)
}
while ((txp = dhd_flow_queue_dequeue(bus->dhd, queue)) != NULL) {
PKTORPHAN(txp, bus->dhd->conf->tsq);
if (bus->dhd->conf->orphan_move <= 1)
PKTORPHAN(txp, bus->dhd->conf->tsq);
/*
* Modifying the packet length caused P2P cert failures.

View File

@@ -139,7 +139,7 @@ struct pcos_info {
dhdpcie_info_t *pc;
spinlock_t lock;
wait_queue_head_t intr_wait_queue;
struct timer_list tuning_timer;
timer_list_compat_t tuning_timer;
int tuning_timer_exp;
atomic_t timer_enab;
struct tasklet_struct tuning_tasklet;
@@ -570,7 +570,7 @@ static int dhdpcie_suspend_dev(struct pci_dev *dev)
DHD_ERROR(("%s: pci_set_power_state error %d\n",
__FUNCTION__, ret));
}
dev->state_saved = FALSE;
// dev->state_saved = FALSE;
return ret;
}
@@ -607,7 +607,7 @@ static int dhdpcie_resume_dev(struct pci_dev *dev)
pci_load_and_free_saved_state(dev, &pch->state);
#endif /* OEM_ANDROID && LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0) */
DHD_TRACE_HW4(("%s: Enter\n", __FUNCTION__));
dev->state_saved = TRUE;
// dev->state_saved = TRUE;
pci_restore_state(dev);
err = pci_enable_device(dev);
if (err) {
@@ -884,11 +884,13 @@ dhdpcie_bus_unregister(void)
int __devinit
dhdpcie_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
{
int err = 0;
DHD_MUTEX_LOCK();
if (dhdpcie_chipmatch (pdev->vendor, pdev->device)) {
DHD_ERROR(("%s: chipmatch failed!!\n", __FUNCTION__));
return -ENODEV;
err = -ENODEV;
goto exit;
}
printf("PCI_PROBE: bus %X, slot %X,vendor %X, device %X"
"(good PCI location)\n", pdev->bus->number,
@@ -896,7 +898,8 @@ dhdpcie_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
if (dhdpcie_init (pdev)) {
DHD_ERROR(("%s: PCIe Enumeration failed\n", __FUNCTION__));
return -ENODEV;
err = -ENODEV;
goto exit;
}
#ifdef BCMPCIE_DISABLE_ASYNC_SUSPEND
@@ -905,8 +908,10 @@ dhdpcie_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
#endif /* BCMPCIE_DISABLE_ASYNC_SUSPEND */
DHD_TRACE(("%s: PCIe Enumeration done!!\n", __FUNCTION__));
exit:
DHD_MUTEX_UNLOCK();
return 0;
return err;
}
int
@@ -1203,7 +1208,8 @@ void dhdpcie_linkdown_cb(struct_pcie_notify *noti)
}
}
#endif /* CONFIG_ARCH_MSM || (EXYNOS_PCIE_LINKDOWN_RECOVERY &&
#endif
/* CONFIG_ARCH_MSM || (EXYNOS_PCIE_LINKDOWN_RECOVERY &&
* (CONFIG_SOC_EXYNOS8890 || CONFIG_SOC_EXYNOS8895))
*/
#endif /* SUPPORT_LINKDOWN_RECOVERY */
@@ -1541,7 +1547,7 @@ dhdpcie_enable_irq(dhd_bus_t *bus)
bool
dhdpcie_irq_enabled(dhd_bus_t *bus)
{
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0))
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 4, 0))
struct irq_desc *desc = irq_to_desc(bus->dev->irq);
/* depth will be zero, if enabled */
if (!desc->depth) {

View File

@@ -186,7 +186,7 @@ dhd_is_legacy_pno_enabled(dhd_pub_t *dhd)
#ifdef GSCAN_SUPPORT
static uint64
convert_fw_rel_time_to_systime(struct timespec *ts, uint32 fw_ts_ms)
convert_fw_rel_time_to_systime(struct osl_timespec *ts, uint32 fw_ts_ms)
{
return ((uint64)(TIMESPEC_TO_US(*ts)) - (uint64)(fw_ts_ms * 1000));
}
@@ -2566,7 +2566,7 @@ _dhd_pno_get_gscan_batch_from_fw(dhd_pub_t *dhd)
uint8 *nAPs_per_scan = NULL;
uint8 num_scans_in_cur_iter;
uint16 count;
struct timespec tm_spec;
struct osl_timespec tm_spec;
NULL_CHECK(dhd, "dhd is NULL\n", err);
NULL_CHECK(dhd->pno_state, "pno_state is NULL", err);
@@ -2626,7 +2626,7 @@ _dhd_pno_get_gscan_batch_from_fw(dhd_pub_t *dhd)
__FUNCTION__, err));
goto exit_mutex_unlock;
}
get_monotonic_boottime(&tm_spec);
osl_get_monotonic_boottime(&tm_spec);
DHD_PNO(("ver %d, status : %d, count %d\n", plbestnet->version,
plbestnet->status, plbestnet->count));
if (plbestnet->version != PFN_SCANRESULT_VERSION) {
@@ -3672,7 +3672,7 @@ dhd_process_full_gscan_result(dhd_pub_t *dhd, const void *data, uint32 len, int
u32 bi_length = 0;
uint8 channel;
uint32 mem_needed;
struct timespec ts;
struct osl_timespec ts;
u32 bi_ie_length = 0;
u32 bi_ie_offset = 0;
@@ -3734,7 +3734,7 @@ dhd_process_full_gscan_result(dhd_pub_t *dhd, const void *data, uint32 len, int
result->fixed.rssi = (int32) bi->RSSI;
result->fixed.rtt = 0;
result->fixed.rtt_sd = 0;
get_monotonic_boottime(&ts);
osl_get_monotonic_boottime(&ts);
result->fixed.ts = (uint64) TIMESPEC_TO_US(ts);
result->fixed.beacon_period = dtoh16(bi->beacon_period);
result->fixed.capability = dtoh16(bi->capability);
@@ -3843,7 +3843,7 @@ dhd_handle_hotlist_scan_evt(dhd_pub_t *dhd, const void *event_data,
wl_pfn_net_info_v2_t *plnetinfo;
gscan_results_cache_t *gscan_hotlist_cache;
int malloc_size = 0, i, total = 0;
struct timespec tm_spec;
struct osl_timespec tm_spec;
gscan_params = &(_pno_state->pno_params_arr[INDEX_OF_GSCAN_PARAMS].params_gscan);
@@ -3853,7 +3853,7 @@ dhd_handle_hotlist_scan_evt(dhd_pub_t *dhd, const void *event_data,
return ptr;
}
get_monotonic_boottime(&tm_spec);
osl_get_monotonic_boottime(&tm_spec);
malloc_size = sizeof(gscan_results_cache_t) +
((results->count - 1) * sizeof(wifi_gscan_result_t));
gscan_hotlist_cache = (gscan_results_cache_t *) kmalloc(malloc_size, GFP_KERNEL);

View File

@@ -1611,7 +1611,7 @@ dhd_rtt_convert_results_to_host(rtt_report_t *rtt_report, uint8 *p_data, uint16
wl_proxd_session_state_t session_state;
wl_proxd_status_t proxd_status;
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39))
struct timespec ts;
struct osl_timespec ts;
#endif /* LINUX_VER >= 2.6.39 */
uint32 ratespec;
uint32 avg_dist;
@@ -1708,7 +1708,7 @@ dhd_rtt_convert_results_to_host(rtt_report_t *rtt_report, uint8 *p_data, uint16
/* time stamp */
/* get the time elapsed from boot time */
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 39))
get_monotonic_boottime(&ts);
osl_get_monotonic_boottime(&ts);
rtt_report->ts = (uint64)TIMESPEC_TO_US(ts);
#endif /* LINUX_VER >= 2.6.39 */

View File

@@ -193,7 +193,7 @@ extern unsigned int system_hw_rev;
/* Device console log buffer state */
#define CONSOLE_LINE_MAX 192
#define CONSOLE_BUFFER_MAX 2024
#define CONSOLE_BUFFER_MAX 8192
typedef struct dhd_console {
uint count; /* Poll interval msec counter */
uint log_addr; /* Log struct address (fixed) */
@@ -350,6 +350,10 @@ typedef struct dhd_bus {
bool usebufpool;
int32 txinrx_thres; /* num of in-queued pkts */
int32 dotxinrx; /* tx first in dhdsdio_readframes */
#ifdef BCMSDIO_RXLIM_POST
bool rxlim_en;
uint32 rxlim_addr;
#endif /* BCMSDIO_RXLIM_POST */
#ifdef SDTEST
/* external loopback */
bool ext_loop;
@@ -1904,6 +1908,7 @@ void dhdsdio_reset_bt_use_count(struct dhd_bus *bus)
}
#endif /* BT_OVER_SDIO */
#ifdef USE_DYNAMIC_F2_BLKSIZE
int dhdsdio_func_blocksize(dhd_pub_t *dhd, int function_num, int block_size)
{
int func_blk_size = function_num;
@@ -1919,7 +1924,7 @@ int dhdsdio_func_blocksize(dhd_pub_t *dhd, int function_num, int block_size)
}
if (result != block_size) {
DHD_ERROR(("%s: F%d Block size set from %d to %d\n",
DHD_TRACE_HW4(("%s: F%d Block size set from %d to %d\n",
__FUNCTION__, function_num, result, block_size));
func_blk_size = function_num << 16 | block_size;
bcmerr = dhd_bus_iovar_op(dhd, "sd_blocksize", NULL,
@@ -1932,6 +1937,7 @@ int dhdsdio_func_blocksize(dhd_pub_t *dhd, int function_num, int block_size)
return BCME_OK;
}
#endif /* USE_DYNAMIC_F2_BLKSIZE */
#if defined(OOB_INTR_ONLY) || defined(FORCE_WOWLAN)
void
@@ -1995,7 +2001,7 @@ dhd_bus_txdata(struct dhd_bus *bus, void *pkt)
prec = PRIO2PREC((PKTPRIO(pkt) & PRIOMASK));
/* move from dhdsdio_sendfromq(), try to orphan skb early */
if (bus->dhd->conf->orphan_move)
if (bus->dhd->conf->orphan_move == 1)
PKTORPHAN(pkt, bus->dhd->conf->tsq);
/* Check for existing queue, current flow-control, pending event, or pending clock */
@@ -2858,6 +2864,11 @@ dhd_bus_txctl(struct dhd_bus *bus, uchar *msg, uint msglen)
#endif /* CUSTOMER_HW4_DEBUG */
DHD_ERROR(("%s: ctrl_frame_stat == TRUE txcnt_timeout=%d\n",
__FUNCTION__, bus->dhd->txcnt_timeout));
#ifdef BCMSDIO_RXLIM_POST
DHD_ERROR(("%s: rxlim_en=%d, rxlim enable=%d, rxlim_addr=%d\n",
__FUNCTION__,
bus->dhd->conf->rxlim_en, bus->rxlim_en, bus->rxlim_addr));
#endif /* BCMSDIO_RXLIM_POST */
}
#ifdef DHD_FW_COREDUMP
/* Collect socram dump */
@@ -2937,7 +2948,7 @@ dhd_bus_rxctl(struct dhd_bus *bus, uchar *msg, uint msglen)
return -EIO;
/* Wait until control frame is available */
timeleft = dhd_os_ioctl_resp_wait(bus->dhd, &bus->rxlen, false);
timeleft = dhd_os_ioctl_resp_wait(bus->dhd, &bus->rxlen);
dhd_os_sdlock(bus->dhd);
rxlen = bus->rxlen;
@@ -2958,7 +2969,7 @@ dhd_bus_rxctl(struct dhd_bus *bus, uchar *msg, uint msglen)
dhd_sched_dpc(bus->dhd);
/* Wait until control frame is available */
timeleft = dhd_os_ioctl_resp_wait(bus->dhd, &bus->rxlen, true);
timeleft = dhd_os_ioctl_resp_wait(bus->dhd, &bus->rxlen);
dhd_os_sdlock(bus->dhd);
rxlen = bus->rxlen;
@@ -3505,6 +3516,21 @@ 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 */
if ((sh->flags & SDPCM_SHARED_VERSION_MASK) == 3 && SDPCM_SHARED_VERSION == 1)
return BCME_OK;
@@ -5039,6 +5065,9 @@ dhd_bus_init(dhd_pub_t *dhdp, bool enforce_mutex)
uint8 ready, enable;
int err, ret = 0;
uint8 saveclk;
#if defined(SDIO_ISR_THREAD)
int intr_extn;
#endif
DHD_TRACE(("%s: Enter\n", __FUNCTION__));
@@ -5098,6 +5127,15 @@ dhd_bus_init(dhd_pub_t *dhdp, bool enforce_mutex)
DHD_ERROR(("%s: enable 0x%02x, ready 0x%02x (waited %uus)\n",
__FUNCTION__, enable, ready, tmo.elapsed));
#if defined(SDIO_ISR_THREAD)
if (dhdp->conf->intr_extn) {
intr_extn = bcmsdh_cfg_read(bus->sdh, SDIO_FUNC_0, SDIOD_CCCR_INTR_EXTN, NULL);
if (intr_extn & 0x1) {
intr_extn |= 0x2;
bcmsdh_cfg_write(bus->sdh, SDIO_FUNC_0, SDIOD_CCCR_INTR_EXTN, intr_extn, NULL);
}
}
#endif
/* If F2 successfully enabled, set core and enable interrupts */
if (ready == enable) {
@@ -5589,7 +5627,7 @@ dhdsdio_rxglom(dhd_bus_t *bus, uint8 rxseq)
/* Check window for sanity */
if ((uint8)(txmax - bus->tx_seq) > 0x70) {
DHD_ERROR(("%s: got unlikely tx max %d with tx_seq %d\n",
DHD_INFO(("%s: got unlikely tx max %d with tx_seq %d\n",
__FUNCTION__, txmax, bus->tx_seq));
txmax = bus->tx_max;
}
@@ -6092,7 +6130,7 @@ dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished)
/* Check window for sanity */
if ((uint8)(txmax - bus->tx_seq) > 0x70) {
DHD_ERROR(("%s: got unlikely tx max %d with tx_seq %d\n",
DHD_INFO(("%s: got unlikely tx max %d with tx_seq %d\n",
__FUNCTION__, txmax, bus->tx_seq));
txmax = bus->tx_max;
}
@@ -6249,7 +6287,7 @@ dhdsdio_readframes(dhd_bus_t *bus, uint maxframes, bool *finished)
/* Check window for sanity */
if ((uint8)(txmax - bus->tx_seq) > 0x70) {
DHD_ERROR(("%s: got unlikely tx max %d with tx_seq %d\n",
DHD_INFO(("%s: got unlikely tx max %d with tx_seq %d\n",
__FUNCTION__, txmax, bus->tx_seq));
txmax = bus->tx_max;
}
@@ -6776,6 +6814,19 @@ clkwait:
}
#endif /* defined(OOB_INTR_ONLY) && !defined(HW_OOB) */
#ifdef BCMSDIO_RXLIM_POST
if (!DATAOK(bus) && bus->rxlim_en) {
uint8 rxlim = 0;
if (0 == dhdsdio_membytes(bus, FALSE, bus->rxlim_addr, (uint8 *)&rxlim, 1)) {
if (bus->tx_max != rxlim) {
DHD_INFO(("%s: bus->tx_max/rxlim=%d/%d\n", __FUNCTION__,
bus->tx_max, rxlim));
bus->tx_max = rxlim;
}
}
}
#endif /* BCMSDIO_RXLIM_POST */
#ifdef PROP_TXSTATUS
dhd_wlfc_commit_packets(bus->dhd, (f_commitpkt_t)dhd_bus_txdata, (void *)bus, NULL, FALSE);
#endif
@@ -6917,7 +6968,7 @@ dhdsdio_isr(void *arg)
dhd_bus_t *bus = (dhd_bus_t*)arg;
bcmsdh_info_t *sdh;
DHD_TRACE(("%s: Enter\n", __FUNCTION__));
DHD_INTR(("%s: Enter\n", __FUNCTION__));
if (!bus) {
DHD_ERROR(("%s : bus is null pointer , exit \n", __FUNCTION__));
@@ -6930,8 +6981,6 @@ dhdsdio_isr(void *arg)
return;
}
DHD_TRACE(("%s: Enter\n", __FUNCTION__));
/* Count the interrupt call */
bus->intrcount++;
bus->ipend = TRUE;
@@ -7568,6 +7617,13 @@ dhd_bus_console_in(dhd_pub_t *dhdp, uchar *msg, uint msglen)
if ((rv = dhdsdio_membytes(bus, TRUE, addr, (uint8 *)&val, sizeof(val))) < 0)
goto done;
if (!DATAOK(bus)) {
DHD_CTL(("%s: No bus credit bus->tx_max %d, bus->tx_seq %d, pktq_len %d\n",
__FUNCTION__, bus->tx_max, bus->tx_seq, pktq_len(&bus->txq)));
rv = BCME_NOTREADY;
goto done;
}
/* Bump dongle by sending an empty packet on the event channel.
* sdpcm_sendup (RX) checks for virtual console input.
*/
@@ -8313,38 +8369,6 @@ dhd_bus_download_firmware(struct dhd_bus *bus, osl_t *osh,
return ret;
}
void
dhd_set_path_params(struct dhd_bus *bus)
{
/* External conf takes precedence if specified */
dhd_conf_preinit(bus->dhd);
if (bus->dhd->conf_path[0] == '\0') {
dhd_conf_set_path(bus->dhd, "config.txt", bus->dhd->conf_path, bus->nv_path);
}
if (bus->dhd->clm_path[0] == '\0') {
dhd_conf_set_path(bus->dhd, "clm.blob", bus->dhd->clm_path, bus->fw_path);
}
#ifdef CONFIG_PATH_AUTO_SELECT
dhd_conf_set_conf_name_by_chip(bus->dhd, bus->dhd->conf_path);
#endif
dhd_conf_read_config(bus->dhd, bus->dhd->conf_path);
dhd_conf_set_fw_name_by_chip(bus->dhd, bus->fw_path);
dhd_conf_set_nv_name_by_chip(bus->dhd, bus->nv_path);
dhd_conf_set_clm_name_by_chip(bus->dhd, bus->dhd->clm_path);
dhd_conf_set_fw_name_by_mac(bus->dhd, bus->sdh, bus->fw_path);
dhd_conf_set_nv_name_by_mac(bus->dhd, bus->sdh, bus->nv_path);
printf("Final fw_path=%s\n", bus->fw_path);
printf("Final nv_path=%s\n", bus->nv_path);
printf("Final clm_path=%s\n", bus->dhd->clm_path);
printf("Final conf_path=%s\n", bus->dhd->conf_path);
}
void
dhd_set_bus_params(struct dhd_bus *bus)
{
@@ -8382,7 +8406,7 @@ dhdsdio_download_firmware(struct dhd_bus *bus, osl_t *osh, void *sdh)
/* Download the firmware */
dhdsdio_clkctl(bus, CLK_AVAIL, FALSE);
dhd_set_path_params(bus);
dhd_conf_set_path_params(bus->dhd, bus->sdh, bus->fw_path, bus->nv_path);
dhd_set_bus_params(bus);
ret = _dhdsdio_download_firmware(bus);
@@ -10075,3 +10099,31 @@ dhd_bus_get_bus_wake(dhd_pub_t *dhd)
return bcmsdh_set_get_wake(dhd->bus->sdh, 0);
}
#endif /* DHD_WAKE_STATUS */
int
dhd_bus_sleep(dhd_pub_t *dhdp, bool sleep, uint32 *intstatus)
{
dhd_bus_t *bus = dhdp->bus;
uint32 retry = 0;
int ret = 0;
if (bus) {
dhd_os_sdlock(dhdp);
BUS_WAKE(bus);
R_SDREG(*intstatus, &bus->regs->intstatus, retry);
if (sleep) {
if (SLPAUTO_ENAB(bus)) {
ret = dhdsdio_bussleep(bus, sleep);
if (ret != BCME_BUSY)
dhd_os_wd_timer(bus->dhd, 0);
} else
dhdsdio_clkctl(bus, CLK_NONE, FALSE);
}
dhd_os_sdunlock(dhdp);
} else {
DHD_ERROR(("bus is NULL\n"));
ret = -1;
}
return ret;
}

View File

@@ -36,7 +36,7 @@ enum dhd_prealloc_index {
DHD_PREALLOC_DHD_LOG_DUMP_BUF_EX = 16,
DHD_PREALLOC_DHD_PKTLOG_DUMP_BUF = 17,
DHD_PREALLOC_STAT_REPORT_BUF = 18,
DHD_PREALLOC_WL_ESCAN_INFO = 19,
DHD_PREALLOC_WL_ESCAN = 19,
DHD_PREALLOC_FW_VERBOSE_RING = 20,
DHD_PREALLOC_FW_EVENT_RING = 21,
DHD_PREALLOC_DHD_EVENT_RING = 22,
@@ -55,7 +55,7 @@ enum dhd_prealloc_index {
#define DHD_PREALLOC_DHD_INFO_SIZE (32 * 1024)
#define DHD_PREALLOC_MEMDUMP_RAM_SIZE (810 * 1024)
#define DHD_PREALLOC_DHD_WLFC_HANGER_SIZE (73 * 1024)
#define DHD_PREALLOC_WL_ESCAN_INFO_SIZE (66 * 1024)
#define DHD_PREALLOC_WL_ESCAN_SIZE (70 * 1024)
#ifdef CONFIG_64BIT
#define DHD_PREALLOC_IF_FLOW_LKUP_SIZE (20 * 1024 * 2)
#else
@@ -192,10 +192,10 @@ void *dhd_wlan_mem_prealloc(int section, unsigned long size)
}
return wlan_static_dhd_wlfc_hanger_buf;
}
if (section == DHD_PREALLOC_WL_ESCAN_INFO) {
if (size > DHD_PREALLOC_WL_ESCAN_INFO_SIZE) {
pr_err("request DHD_PREALLOC_WL_ESCAN_INFO_SIZE(%lu) > %d\n",
size, DHD_PREALLOC_WL_ESCAN_INFO_SIZE);
if (section == DHD_PREALLOC_WL_ESCAN) {
if (size > DHD_PREALLOC_WL_ESCAN_SIZE) {
pr_err("request DHD_PREALLOC_WL_ESCAN_SIZE(%lu) > %d\n",
size, DHD_PREALLOC_WL_ESCAN_SIZE);
return NULL;
}
@@ -344,11 +344,11 @@ static int dhd_init_wlan_mem(void)
pr_err("%s: sectoin %d, size=%d\n", __func__,
DHD_PREALLOC_DHD_WLFC_HANGER, DHD_PREALLOC_DHD_WLFC_HANGER_SIZE);
wlan_static_wl_escan_info_buf = kmalloc(DHD_PREALLOC_WL_ESCAN_INFO_SIZE, GFP_KERNEL);
wlan_static_wl_escan_info_buf = kmalloc(DHD_PREALLOC_WL_ESCAN_SIZE, GFP_KERNEL);
if (!wlan_static_wl_escan_info_buf)
goto err_mem_alloc;
pr_err("%s: sectoin %d, size=%d\n", __func__,
DHD_PREALLOC_WL_ESCAN_INFO, DHD_PREALLOC_WL_ESCAN_INFO_SIZE);
DHD_PREALLOC_WL_ESCAN, DHD_PREALLOC_WL_ESCAN_SIZE);
wlan_static_fw_verbose_ring_buf = kmalloc(FW_VERBOSE_RING_SIZE, GFP_KERNEL);
if (!wlan_static_fw_verbose_ring_buf)
@@ -417,7 +417,7 @@ err_mem_alloc:
if (wlan_static_wl_escan_info_buf)
kfree(wlan_static_wl_escan_info_buf);
#ifdef BCMDHD_PCIE
if (wlan_static_fw_verbose_ring_buf)
kfree(wlan_static_fw_verbose_ring_buf);
@@ -513,7 +513,7 @@ dhd_static_buf_exit(void)
if (wlan_static_wl_escan_info_buf)
kfree(wlan_static_wl_escan_info_buf);
#ifdef BCMDHD_PCIE
if (wlan_static_fw_verbose_ring_buf)
kfree(wlan_static_fw_verbose_ring_buf);

View File

@@ -4353,6 +4353,8 @@ typedef struct vht_features_ie_hdr vht_features_ie_hdr_t;
#define RSN_AKM_SHA256_1X 5 /* SHA256 key derivation, using 802.1X */
#define RSN_AKM_SHA256_PSK 6 /* SHA256 key derivation, using Pre-shared Key */
#define RSN_AKM_TPK 7 /* TPK(TDLS Peer Key) handshake */
#define RSN_AKM_SAE_PSK 8 /* AKM for SAE with 4-way handshake */
#define RSN_AKM_SAE_FBT 9 /* AKM for SAE with FBT */
#define RSN_AKM_FILS_SHA256 14 /* SHA256 key derivation, using FILS */
#define RSN_AKM_FILS_SHA384 15 /* SHA384 key derivation, using FILS */
@@ -4395,6 +4397,10 @@ typedef struct vht_features_ie_hdr vht_features_ie_hdr_t;
#define WCN_OUI "\x00\x50\xf2" /* WCN OUI */
#define WCN_TYPE 4 /* WCN type */
#ifdef BCMWAPI_WPI
#define SMS4_KEY_LEN 16
#define SMS4_WPI_CBC_MAC_LEN 16
#endif
/* 802.11r protocol definitions */
@@ -4473,6 +4479,13 @@ typedef struct dot11_ft_rrb_frame dot11_ft_rrb_frame_t;
#define BSSID_INVALID "\x00\x00\x00\x00\x00\x00"
#define BSSID_BROADCAST "\xFF\xFF\xFF\xFF\xFF\xFF"
#ifdef BCMWAPI_WAI
#define WAPI_IE_MIN_LEN 20 /* WAPI IE min length */
#define WAPI_VERSION 1 /* WAPI version */
#define WAPI_VERSION_LEN 2 /* WAPI version length */
#define WAPI_OUI "\x00\x14\x72" /* WAPI OUI */
#define WAPI_OUI_LEN DOT11_OUI_LEN /* WAPI OUI length */
#endif /* BCMWAPI_WAI */
/* ************* WMM Parameter definitions. ************* */
#define WMM_OUI "\x00\x50\xF2" /* WNN OUI */

View File

@@ -130,6 +130,21 @@ BWL_PRE_PACKED_STRUCT struct ipv4_hdr {
uint8 dst_ip[IPV4_ADDR_LEN]; /* Destination IP Address */
} BWL_POST_PACKED_STRUCT;
#define HTYPE_ETHERNET 1 /* htype for ethernet */
#define ARP_OPC_REQUEST 1 /* ARP request */
#define ARP_OPC_REPLY 2 /* ARP reply */
BWL_PRE_PACKED_STRUCT struct bcmarp {
uint16 htype; /* Header type (1 = ethernet) */
uint16 ptype; /* Protocol type (0x800 = IP) */
uint8 hlen; /* Hardware address length (Eth = 6) */
uint8 plen; /* Protocol address length (IP = 4) */
uint16 oper; /* ARP_OPC_... */
uint8 src_eth[ETHER_ADDR_LEN]; /* Source hardware address */
uint8 src_ip[IPV4_ADDR_LEN]; /* Source protocol address (not aligned) */
uint8 dst_eth[ETHER_ADDR_LEN]; /* Destination hardware address */
uint8 dst_ip[IPV4_ADDR_LEN]; /* Destination protocol address */
} BWL_POST_PACKED_STRUCT;
/* IPV6 field offsets */
#define IPV6_PAYLOAD_LEN_OFFSET 4 /* payload length offset */
#define IPV6_NEXT_HDR_OFFSET 6 /* next header/protocol offset */

View File

@@ -283,6 +283,7 @@ typedef volatile struct {
#define SDPCM_SHARED_SET_BRPT 0x1000
#define SDPCM_SHARED_PENDING_BRPT 0x2000
#define SDPCM_SHARED_FATAL_LOGBUF_VALID 0x100000
#define SDPCM_SHARED_RXLIM_POST 0x4000
typedef struct {
uint32 flags;

View File

@@ -35,9 +35,13 @@
#define OUI_GOOGLE 0x001A11
enum wl_vendor_subcmd {
BRCM_VENDOR_SCMD_UNSPEC,
BRCM_VENDOR_SCMD_PRIV_STR,
BRCM_VENDOR_SCMD_BCM_STR
BRCM_VENDOR_SCMD_UNSPEC = 0,
BRCM_VENDOR_SCMD_PRIV_STR = 1,
BRCM_VENDOR_SCMD_BCM_STR = 2,
BRCM_VENDOR_SCMD_BCM_PSK = 3,
BRCM_VENDOR_SCMD_SET_PMK = 4,
BRCM_VENDOR_SCMD_GET_FEATURES = 5,
BRCM_VENDOR_SCMD_MAX = 6
};

View File

@@ -113,6 +113,12 @@ enum {
#define DHD_IW_VAL 0x20000
#define DHD_CFG_VAL 0x40000
#define DHD_CONFIG_VAL 0x80000
#define DUMP_EAPOL_VAL 0x0001
#define DUMP_ARP_VAL 0x0002
#define DUMP_DHCP_VAL 0x0004
#define DUMP_ICMP_VAL 0x0008
#define DUMP_DNS_VAL 0x0010
#define DUMP_TRX_VAL 0x0080
#ifdef SDTEST
/* For pktgen iovar */

View File

@@ -46,6 +46,6 @@
#define EPI_VERSION_DEV 1.579.77.41
/* Driver Version String, ASCII, 32 chars max */
#define EPI_VERSION_STR "1.579.77.41.10 (r)"
#define EPI_VERSION_STR "1.579.77.41.22 (r-20191105-2)(20191120-1)"
#endif /* _epivers_h_ */

View File

@@ -1159,4 +1159,12 @@ extern void osl_timer_update(osl_t *osh, osl_timer_t *t, uint32 ms, bool periodi
extern bool osl_timer_del(osl_t *osh, osl_timer_t *t);
#endif
typedef struct osl_timespec {
__kernel_time_t tv_sec; /* seconds */
__kernel_suseconds_t tv_usec; /* microseconds */
long tv_nsec; /* nanoseconds */
} osl_timespec_t;
extern void osl_do_gettimeofday(struct osl_timespec *ts);
extern void osl_get_monotonic_boottime(struct osl_timespec *ts);
#endif /* _linux_osl_h_ */

View File

@@ -347,6 +347,42 @@ static inline void pci_free_consistent(struct pci_dev *hwdev, size_t size,
#endif /* DMA mapping */
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0)
typedef struct timer_list timer_list_compat_t;
#define init_timer_compat(timer_compat, cb, priv) \
init_timer(timer_compat); \
(timer_compat)->data = (ulong)priv; \
(timer_compat)->function = cb
#define timer_set_private(timer_compat, priv) (timer_compat)->data = (ulong)priv
#define timer_expires(timer_compat) (timer_compat)->expires
#else /* LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0) */
typedef struct timer_list_compat {
struct timer_list timer;
void *arg;
void (*callback)(ulong arg);
} timer_list_compat_t;
extern void timer_cb_compat(struct timer_list *tl);
#define init_timer_compat(timer_compat, cb, priv) \
(timer_compat)->arg = priv; \
(timer_compat)->callback = cb; \
timer_setup(&(timer_compat)->timer, timer_cb_compat, 0);
#define timer_set_private(timer_compat, priv) (timer_compat)->arg = priv
#define timer_expires(timer_compat) (timer_compat)->timer.expires
#define del_timer(t) del_timer(&((t)->timer))
#define del_timer_sync(t) del_timer_sync(&((t)->timer))
#define timer_pending(t) timer_pending(&((t)->timer))
#define add_timer(t) add_timer(&((t)->timer))
#define mod_timer(t, j) mod_timer(&((t)->timer), j)
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0) */
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 3, 43))
#define dev_kfree_skb_any(a) dev_kfree_skb(a)
@@ -765,6 +801,7 @@ not match our unaligned address for < 2.6.24
#endif
#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 9, 0))
#include <linux/fs.h>
static inline struct inode *file_inode(const struct file *f)
{
return f->f_dentry->d_inode;

View File

@@ -1081,6 +1081,8 @@ typedef struct wl_wsec_key {
#define WSEC_MIN_PSK_LEN 8
#define WSEC_MAX_PSK_LEN 64
/* Max length of supported passphrases for SAE */
#define WSEC_MAX_PASSPHRASE_LEN 256u
/** Flag for key material needing passhash'ing */
#define WSEC_PASSPHRASE (1<<0)
@@ -1092,6 +1094,23 @@ typedef struct wsec_pmk {
uint8 key[WSEC_MAX_PSK_LEN]; /**< PMK material */
} wsec_pmk_t;
#define WL_AUTH_EVENT_DATA_V1 0x1
/* tlv ids for auth event */
#define WL_AUTH_PMK_TLV_ID 1
#define WL_AUTH_PMKID_TLV_ID 2
/* AUTH event data
* pmk and pmkid in case of SAE auth
* xtlvs will be 32 bit alligned
*/
typedef struct wl_auth_event {
uint16 version;
uint16 length;
uint8 xtlvs[];
} wl_auth_event_t;
#define WL_AUTH_EVENT_FIXED_LEN_V1 OFFSETOF(wl_auth_event_t, xtlvs)
typedef struct _pmkid {
struct ether_addr BSSID;
uint8 PMKID[WPA2_PMKID_LEN];
@@ -6521,6 +6540,7 @@ typedef struct wlc_btc_stats {
#define LOGRRC_FIX_LEN 8
#define IOBUF_ALLOWED_NUM_OF_LOGREC(type, len) ((len - LOGRRC_FIX_LEN)/sizeof(type))
#ifdef BCMWAPI_WAI
/* BCMWAPI_WAI */
#define IV_LEN 16
struct wapi_sta_msg_t
@@ -6534,7 +6554,7 @@ typedef struct wlc_btc_stats {
uint8 gsn[IV_LEN];
uint8 wie[256];
};
/* #endif BCMWAPI_WAI */
#endif /* BCMWAPI_WAI */
/* chanim acs record */
typedef struct {
uint8 valid;

View File

@@ -441,15 +441,40 @@
#define AES_ENABLED 0x0004
#define WSEC_SWFLAG 0x0008
#define SES_OW_ENABLED 0x0040 /* to go into transition mode without setting wep */
#ifdef BCMWAPI_WPI
#define SMS4_ENABLED 0x0100
#endif /* BCMWAPI_WPI */
#define WSEC_WEP_ENABLED(wsec) ((wsec) & WEP_ENABLED)
#define WSEC_TKIP_ENABLED(wsec) ((wsec) & TKIP_ENABLED)
#define WSEC_AES_ENABLED(wsec) ((wsec) & AES_ENABLED)
#ifdef BCMCCX
#define WSEC_CKIP_KP_ENABLED(wsec) ((wsec) & CKIP_KP_ENABLED)
#define WSEC_CKIP_MIC_ENABLED(wsec) ((wsec) & CKIP_MIC_ENABLED)
#define WSEC_CKIP_ENABLED(wsec) ((wsec) & (CKIP_KP_ENABLED|CKIP_MIC_ENABLED))
#ifdef BCMWAPI_WPI
#define WSEC_ENABLED(wsec) \
((wsec) & (WEP_ENABLED | TKIP_ENABLED | AES_ENABLED | CKIP_KP_ENABLED | \
CKIP_MIC_ENABLED | SMS4_ENABLED))
#else /* BCMWAPI_WPI */
#define WSEC_ENABLED(wsec) \
((wsec) & \
(WEP_ENABLED | TKIP_ENABLED | AES_ENABLED | CKIP_KP_ENABLED | CKIP_MIC_ENABLED))
#endif /* BCMWAPI_WPI */
#else /* defined BCMCCX */
#ifdef BCMWAPI_WPI
#define WSEC_ENABLED(wsec) ((wsec) & (WEP_ENABLED | TKIP_ENABLED | AES_ENABLED | SMS4_ENABLED))
#else /* BCMWAPI_WPI */
#define WSEC_ENABLED(wsec) ((wsec) & (WEP_ENABLED | TKIP_ENABLED | AES_ENABLED))
#endif /* BCMWAPI_WPI */
#endif /* BCMCCX */
#define WSEC_SES_OW_ENABLED(wsec) ((wsec) & SES_OW_ENABLED)
#ifdef BCMWAPI_WAI
#define WSEC_SMS4_ENABLED(wsec) ((wsec) & SMS4_ENABLED)
#endif /* BCMWAPI_WAI */
/* Following macros are not used any more. Just kept here to
* avoid build issue in BISON/CARIBOU branch
@@ -472,10 +497,17 @@
#define WPA2_AUTH_PSK 0x0080 /* Pre-shared key */
#define BRCM_AUTH_PSK 0x0100 /* BRCM specific PSK */
#define BRCM_AUTH_DPT 0x0200 /* DPT PSK without group keys */
#if defined(BCMWAPI_WAI) || defined(BCMWAPI_WPI)
#define WPA_AUTH_WAPI 0x0400
#define WAPI_AUTH_NONE WPA_AUTH_NONE /* none (IBSS) */
#define WAPI_AUTH_UNSPECIFIED 0x0400 /* over AS */
#define WAPI_AUTH_PSK 0x0800 /* Pre-shared key */
#endif /* BCMWAPI_WAI || BCMWAPI_WPI */
#define WPA2_AUTH_1X_SHA256 0x1000 /* 1X with SHA256 key derivation */
#define WPA2_AUTH_TPK 0x2000 /* TDLS Peer Key */
#define WPA2_AUTH_FT 0x4000 /* Fast Transition. */
#define WPA2_AUTH_PSK_SHA256 0x8000 /* PSK with SHA256 key derivation */
#define WPA3_AUTH_SAE_PSK 0x40000 /* SAE with 4-way handshake */
/* WPA2_AUTH_SHA256 not used anymore. Just kept here to avoid build issue in DINGO */
#define WPA2_AUTH_SHA256 0x8000
#define WPA_AUTH_PFN_ANY 0xffffffff /* for PFN, match only ssid */

View File

@@ -128,6 +128,12 @@ typedef BWL_PRE_PACKED_STRUCT struct
#define WPA_CIPHER_AES_GCM 8 /* AES (GCM) */
#define WPA_CIPHER_AES_GCM256 9 /* AES (GCM256) */
#ifdef BCMWAPI_WAI
#define WAPI_CIPHER_NONE WPA_CIPHER_NONE
#define WAPI_CIPHER_SMS4 11
#define WAPI_CSE_WPI_SMS4 1
#endif /* BCMWAPI_WAI */
#define IS_WPA_CIPHER(cipher) ((cipher) == WPA_CIPHER_NONE || \
(cipher) == WPA_CIPHER_WEP_40 || \
@@ -139,6 +145,17 @@ typedef BWL_PRE_PACKED_STRUCT struct
(cipher) == WPA_CIPHER_AES_GCM256 || \
(cipher) == WPA_CIPHER_TPK)
#ifdef BCMWAPI_WAI
#define IS_WAPI_CIPHER(cipher) ((cipher) == WAPI_CIPHER_NONE || \
(cipher) == WAPI_CSE_WPI_SMS4)
/* convert WAPI_CSE_WPI_XXX to WAPI_CIPHER_XXX */
#define WAPI_CSE_WPI_2_CIPHER(cse) ((cse) == WAPI_CSE_WPI_SMS4 ? \
WAPI_CIPHER_SMS4 : WAPI_CIPHER_NONE)
#define WAPI_CIPHER_2_CSE_WPI(cipher) ((cipher) == WAPI_CIPHER_SMS4 ? \
WAPI_CSE_WPI_SMS4 : WAPI_CIPHER_NONE)
#endif /* BCMWAPI_WAI */
/* WPA TKIP countermeasures parameters */
#define WPA_TKIP_CM_DETECT 60 /* multiple MIC failure window (seconds) */
@@ -180,6 +197,19 @@ typedef BWL_PRE_PACKED_STRUCT struct
#define WPA2_PMKID_COUNT_LEN 2
#ifdef BCMWAPI_WAI
#define WAPI_CAP_PREAUTH RSN_CAP_PREAUTH
/* Other WAI definition */
#define WAPI_WAI_REQUEST 0x00F1
#define WAPI_UNICAST_REKEY 0x00F2
#define WAPI_STA_AGING 0x00F3
#define WAPI_MUTIL_REKEY 0x00F4
#define WAPI_STA_STATS 0x00F5
#define WAPI_USK_REKEY_COUNT 0x4000000 /* 0xA00000 */
#define WAPI_MSK_REKEY_COUNT 0x4000000 /* 0xA00000 */
#endif /* BCMWAPI_WAI */
/* This marks the end of a packed structure section. */
#include <packed_section_end.h>

View File

@@ -48,6 +48,11 @@
#include <linux/delay.h>
#include <linux/vmalloc.h>
#include <pcicfg.h>
#include <dngl_stats.h>
#include <dhd.h>
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(4, 8, 0))
#include <asm-generic/pci-dma-compat.h>
#endif
#ifdef BCM_SECURE_DMA
@@ -538,7 +543,7 @@ int osl_static_mem_init(osl_t *osh, void *adapter)
#ifdef CONFIG_DHD_USE_STATIC_BUF
if (!bcm_static_buf && adapter) {
if (!(bcm_static_buf = (bcm_static_buf_t *)wifi_platform_prealloc(adapter,
3, STATIC_BUF_SIZE + STATIC_BUF_TOTAL_LEN))) {
DHD_PREALLOC_OSL_BUF, STATIC_BUF_SIZE + STATIC_BUF_TOTAL_LEN))) {
printk("can not alloc static buf!\n");
bcm_static_skb = NULL;
ASSERT(osh->magic == OS_HANDLE_MAGIC);
@@ -557,7 +562,7 @@ int osl_static_mem_init(osl_t *osh, void *adapter)
int i;
void *skb_buff_ptr = 0;
bcm_static_skb = (bcm_static_pkt_t *)((char *)bcm_static_buf + 2048);
skb_buff_ptr = wifi_platform_prealloc(adapter, 4, 0);
skb_buff_ptr = wifi_platform_prealloc(adapter, DHD_PREALLOC_SKB_BUF, 0);
if (!skb_buff_ptr) {
printk("cannot alloc static buf!\n");
bcm_static_buf = NULL;
@@ -1953,10 +1958,10 @@ osl_sleep(uint ms)
uint64
osl_sysuptime_us(void)
{
struct timeval tv;
struct osl_timespec tv;
uint64 usec;
do_gettimeofday(&tv);
osl_do_gettimeofday(&tv);
/* tv_usec content is fraction of a second */
usec = (uint64)tv.tv_sec * 1000000ul + tv.tv_usec;
return usec;
@@ -2693,6 +2698,15 @@ osl_pkt_orphan_partial(struct sk_buff *skb, int tsq)
/* timer apis */
/* Note: All timer api's are thread unsafe and should be protected with locks by caller */
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
void
timer_cb_compat(struct timer_list *tl)
{
timer_list_compat_t *t = container_of(tl, timer_list_compat_t, timer);
t->callback((ulong)t->arg);
}
#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) */
#ifdef REPORT_FATAL_TIMEOUTS
osl_timer_t *
osl_timer_init(osl_t *osh, const char *name, void (*fn)(void *arg), void *arg)
@@ -2779,3 +2793,39 @@ osl_timer_del(osl_t *osh, osl_timer_t *t)
return (TRUE);
}
#endif
void
osl_do_gettimeofday(struct osl_timespec *ts)
{
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 0, 0)
struct timespec curtime;
#else
struct timeval curtime;
#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 0, 0)
getnstimeofday(&curtime);
ts->tv_nsec = curtime.tv_nsec;
ts->tv_usec = curtime.tv_nsec / 1000;
#else
do_gettimeofday(&curtime);
ts->tv_usec = curtime.tv_usec;
ts->tv_nsec = curtime.tv_usec * 1000;
#endif
ts->tv_sec = curtime.tv_sec;
}
void
osl_get_monotonic_boottime(struct osl_timespec *ts)
{
struct timespec curtime;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 20, 0)
curtime = ktime_to_timespec(ktime_get_boottime());
#else
get_monotonic_boottime(&curtime);
#endif
ts->tv_sec = curtime.tv_sec;
ts->tv_nsec = curtime.tv_nsec;
ts->tv_usec = curtime.tv_nsec / 1000;
}

View File

@@ -66,6 +66,9 @@
#if defined(STAT_REPORT)
#include <wl_statreport.h>
#endif /* STAT_REPORT */
#ifdef WL_ESCAN
#include <wl_escan.h>
#endif
#ifndef WL_CFG80211
#define htod32(i) i
@@ -76,7 +79,29 @@
#define dtohchanspec(i) i
#endif
uint android_msg_level = ANDROID_ERROR_LEVEL;
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] ANDROID-ERROR) " x, ## args); \
} \
} while (0)
#define ANDROID_TRACE_MSG(x, args...) \
do { \
if (android_msg_level & ANDROID_TRACE_LEVEL) { \
printk(KERN_INFO "[dhd] ANDROID-TRACE) " x, ## args); \
} \
} while (0)
#define ANDROID_INFO_MSG(x, args...) \
do { \
if (android_msg_level & ANDROID_INFO_LEVEL) { \
printk(KERN_INFO "[dhd] ANDROID-INFO) " x, ## args); \
} \
} while (0)
#define ANDROID_ERROR(x) ANDROID_ERROR_MSG x
#define ANDROID_TRACE(x) ANDROID_TRACE_MSG x
#define ANDROID_INFO(x) ANDROID_INFO_MSG x
/*
* Android private command strings, PLEASE define new private commands here
@@ -104,7 +129,7 @@ uint android_msg_level = ANDROID_ERROR_LEVEL;
#define CMD_SETBAND "SETBAND"
#define CMD_GETBAND "GETBAND"
#define CMD_COUNTRY "COUNTRY"
#ifdef WLMESH
#ifdef WLMESH_CFG80211
#define CMD_SAE_SET_PASSWORD "SAE_SET_PASSWORD"
#define CMD_SET_RSDB_MODE "RSDB_MODE"
#endif
@@ -126,6 +151,9 @@ uint android_msg_level = ANDROID_ERROR_LEVEL;
#define CMD_ULB_MODE "ULB_MODE"
#define CMD_ULB_BW "ULB_BW"
#endif /* WL11ULB */
#ifdef WLFBT
#define CMD_GET_FTKEY "GET_FTKEY"
#endif
#if defined(WL_SUPPORT_AUTO_CHANNEL)
#define CMD_GET_BEST_CHANNELS "GET_BEST_CHANNELS"
@@ -1565,9 +1593,8 @@ int wl_android_wifi_on(struct net_device *dev)
return -EINVAL;
}
printf("%s in 1\n", __FUNCTION__);
dhd_net_if_lock(dev);
printf("%s in 2: g_wifi_on=%d\n", __FUNCTION__, g_wifi_on);
WL_MSG(dev->name, "in g_wifi_on=%d\n", g_wifi_on);
if (!g_wifi_on) {
do {
if (!dhd_net_wifi_platform_set_power(dev, TRUE, WIFI_TURNON_DELAY)) {
@@ -1612,7 +1639,7 @@ int wl_android_wifi_on(struct net_device *dev)
}
exit:
printf("%s: Success\n", __FUNCTION__);
WL_MSG(dev->name, "Success\n");
dhd_net_if_unlock(dev);
return ret;
@@ -1623,7 +1650,7 @@ err:
dhd_net_bus_suspend(dev);
#endif /* BCMSDIO */
dhd_net_wifi_platform_set_power(dev, FALSE, WIFI_TURNOFF_DELAY);
printf("%s: Failed\n", __FUNCTION__);
WL_MSG(dev->name, "Failed\n");
dhd_net_if_unlock(dev);
return ret;
#endif /* BCMSDIO || BCMDBUS */
@@ -1638,7 +1665,6 @@ int wl_android_wifi_off(struct net_device *dev, bool on_failure)
return -EINVAL;
}
printf("%s in 1\n", __FUNCTION__);
#if defined(BCMPCIE) && defined(DHD_DEBUG_UART)
ret = dhd_debug_uart_is_running(dev);
if (ret) {
@@ -1647,7 +1673,7 @@ int wl_android_wifi_off(struct net_device *dev, bool on_failure)
}
#endif /* BCMPCIE && DHD_DEBUG_UART */
dhd_net_if_lock(dev);
printf("%s in 2: g_wifi_on=%d, on_failure=%d\n", __FUNCTION__, g_wifi_on, on_failure);
WL_MSG(dev->name, "in g_wifi_on=%d, on_failure=%d\n", g_wifi_on, on_failure);
if (g_wifi_on || on_failure) {
#if defined(BCMSDIO) || defined(BCMPCIE) || defined(BCMDBUS)
ret = dhd_net_bus_devreset(dev, TRUE);
@@ -1658,7 +1684,7 @@ int wl_android_wifi_off(struct net_device *dev, bool on_failure)
dhd_net_wifi_platform_set_power(dev, FALSE, WIFI_TURNOFF_DELAY);
g_wifi_on = FALSE;
}
printf("%s out\n", __FUNCTION__);
WL_MSG(dev->name, "out\n");
dhd_net_if_unlock(dev);
return ret;
@@ -2024,7 +2050,7 @@ wl_android_natoe_subcmd_enable(struct net_device *dev, const wl_natoe_sub_cmd_t
int ret = BCME_OK;
wl_natoe_ioc_t *natoe_ioc;
char *pcmd = command;
gfp_t kflags = in_atomic() ? GFP_ATOMIC : GFP_KERNEL;
uint16 kflags = in_atomic() ? GFP_ATOMIC : GFP_KERNEL;
uint16 iocsz = sizeof(*natoe_ioc) + WL_NATOE_IOC_BUFSZ;
uint16 buflen = WL_NATOE_IOC_BUFSZ;
bcm_xtlv_t *pxtlv = NULL;
@@ -2102,7 +2128,7 @@ wl_android_natoe_subcmd_config_ips(struct net_device *dev,
wl_natoe_ioc_t *natoe_ioc;
char *pcmd = command;
char *str;
gfp_t kflags = in_atomic() ? GFP_ATOMIC : GFP_KERNEL;
uint16 kflags = in_atomic() ? GFP_ATOMIC : GFP_KERNEL;
uint16 iocsz = sizeof(*natoe_ioc) + WL_NATOE_IOC_BUFSZ;
uint16 buflen = WL_NATOE_IOC_BUFSZ;
bcm_xtlv_t *pxtlv = NULL;
@@ -2222,7 +2248,7 @@ wl_android_natoe_subcmd_config_ports(struct net_device *dev,
wl_natoe_ioc_t *natoe_ioc;
char *pcmd = command;
char *str;
gfp_t kflags = in_atomic() ? GFP_ATOMIC : GFP_KERNEL;
uint16 kflags = in_atomic() ? GFP_ATOMIC : GFP_KERNEL;
uint16 iocsz = sizeof(*natoe_ioc) + WL_NATOE_IOC_BUFSZ;
uint16 buflen = WL_NATOE_IOC_BUFSZ;
bcm_xtlv_t *pxtlv = NULL;
@@ -2320,7 +2346,7 @@ wl_android_natoe_subcmd_dbg_stats(struct net_device *dev, const wl_natoe_sub_cmd
int ret = BCME_OK;
wl_natoe_ioc_t *natoe_ioc;
char *pcmd = command;
gfp_t kflags = in_atomic() ? GFP_ATOMIC : GFP_KERNEL;
uint16 kflags = in_atomic() ? GFP_ATOMIC : GFP_KERNEL;
uint16 iocsz = sizeof(*natoe_ioc) + WL_NATOE_DBG_STATS_BUFSZ;
uint16 buflen = WL_NATOE_DBG_STATS_BUFSZ;
bcm_xtlv_t *pxtlv = NULL;
@@ -2396,7 +2422,7 @@ wl_android_natoe_subcmd_tbl_cnt(struct net_device *dev, const wl_natoe_sub_cmd_t
int ret = BCME_OK;
wl_natoe_ioc_t *natoe_ioc;
char *pcmd = command;
gfp_t kflags = in_atomic() ? GFP_ATOMIC : GFP_KERNEL;
uint16 kflags = in_atomic() ? GFP_ATOMIC : GFP_KERNEL;
uint16 iocsz = sizeof(*natoe_ioc) + WL_NATOE_IOC_BUFSZ;
uint16 buflen = WL_NATOE_IOC_BUFSZ;
bcm_xtlv_t *pxtlv = NULL;
@@ -2481,6 +2507,74 @@ exit:
#define APCS_MAX_RETRY 10
#define APCS_DEFAULT_2G_CH 1
#define APCS_DEFAULT_5G_CH 149
#ifdef WL_ESCAN
static int
wl_android_escan_autochannel(struct net_device *dev, uint32 band)
{
struct dhd_pub *dhd = dhd_get_pub(dev);
wlc_ssid_t ssid;
struct wl_escan_info *escan = NULL;
int ret = 0, retry = 0, retry_max, retry_interval = 250, channel = 0, up = 1;
#ifdef WL_CFG80211
struct bcm_cfg80211 *cfg = wl_get_cfg(dev);
#endif
escan = dhd->escan;
if (dhd) {
retry_max = WL_ESCAN_TIMER_INTERVAL_MS/retry_interval;
memset(&ssid, 0, sizeof(ssid));
ret = wldev_ioctl_get(dev, WLC_GET_UP, &up, sizeof(s32));
if (ret < 0 || up == 0) {
ret = wldev_ioctl_set(dev, WLC_UP, &up, sizeof(s32));
}
retry = retry_max;
while (retry--) {
#ifdef WL_CFG80211
if (wl_get_drv_status_all(cfg, SCANNING) ||
escan->escan_state == ESCAN_STATE_SCANING)
#else
if (escan->escan_state == ESCAN_STATE_SCANING)
#endif
{
ANDROID_INFO(("Scanning %d tried, ret = %d\n",
(retry_max - retry), ret));
} else {
escan->autochannel = 1;
ret = wl_escan_set_scan(dev, dhd, &ssid, 0, TRUE);
if (!ret)
break;
}
OSL_SLEEP(retry_interval);
}
if ((retry == 0) || (ret < 0))
goto done;
retry = retry_max;
while (retry--) {
if (escan->escan_state == ESCAN_STATE_IDLE) {
if (band == WLC_BAND_5G)
channel = escan->best_5g_ch;
else
channel = escan->best_2g_ch;
WL_MSG(dev->name, "selected channel = %d\n", channel);
goto done;
}
ANDROID_INFO(("escan_state=%d, %d tried, ret = %d\n",
escan->escan_state, (retry_max - retry), ret));
OSL_SLEEP(retry_interval);
}
if ((retry == 0) || (ret < 0))
goto done;
}
done:
if (escan)
escan->autochannel = 0;
return channel;
}
#endif /* WL_ESCAN */
static int
wl_android_set_auto_channel(struct net_device *dev, const char* cmd_str,
char* command, int total_len)
@@ -2491,18 +2585,16 @@ wl_android_set_auto_channel(struct net_device *dev, const char* cmd_str,
int ret = 0;
int spect = 0;
u8 *reqbuf = NULL;
uint32 band = WLC_BAND_2G;
uint32 band = WLC_BAND_2G, sta_band = WLC_BAND_2G;
uint32 buf_size;
char *pos = command;
int band_new, band_cur = 0;
if (cmd_str) {
ANDROID_INFO(("Command: %s len:%d \n", cmd_str, (int)strlen(cmd_str)));
if (strncmp(cmd_str, APCS_BAND_AUTO, strlen(APCS_BAND_AUTO)) == 0) {
if (strnicmp(cmd_str, APCS_BAND_AUTO, strlen(APCS_BAND_AUTO)) == 0) {
band = WLC_BAND_AUTO;
} else if (strncmp(cmd_str, APCS_BAND_5G, strlen(APCS_BAND_5G)) == 0) {
} else if (strnicmp(cmd_str, APCS_BAND_5G, strlen(APCS_BAND_5G)) == 0) {
band = WLC_BAND_5G;
} else if (strncmp(cmd_str, APCS_BAND_2G, strlen(APCS_BAND_2G)) == 0) {
} else if (strnicmp(cmd_str, APCS_BAND_2G, strlen(APCS_BAND_2G)) == 0) {
band = WLC_BAND_2G;
} else {
/*
@@ -2514,22 +2606,55 @@ wl_android_set_auto_channel(struct net_device *dev, const char* cmd_str,
(channel == APCS_BAND_2G_LEGACY2)) {
band = WLC_BAND_2G;
} else {
ANDROID_ERROR(("%s: Invalid argument\n", __FUNCTION__));
ANDROID_ERROR(("Invalid argument\n"));
return -EINVAL;
}
}
} else {
/* If no argument is provided, default to 2G */
ANDROID_ERROR(("%s: No argument given default to 2.4G scan\n", __FUNCTION__));
ANDROID_ERROR(("No argument given default to 2.4G scan\n"));
band = WLC_BAND_2G;
}
ANDROID_INFO(("%s : HAPD_AUTO_CHANNEL = %d, band=%d \n", __FUNCTION__, channel, band));
ANDROID_INFO(("HAPD_AUTO_CHANNEL = %d, band=%d \n", channel, band));
ret = wldev_ioctl_set(dev, WLC_GET_BAND, &band_cur, sizeof(band_cur));
/* If STA is connected, return is STA channel, else ACS can be issued,
* set spect to 0 and proceed with ACS
*/
channel = wl_cfg80211_get_sta_channel(dev);
if (channel) {
sta_band = WL_GET_BAND(channel);
switch (sta_band) {
case (WL_CHANSPEC_BAND_5G): {
if (band == WLC_BAND_2G || band == WLC_BAND_AUTO) {
channel = APCS_DEFAULT_2G_CH;
}
break;
}
case (WL_CHANSPEC_BAND_2G): {
if (band == WLC_BAND_5G) {
channel = APCS_DEFAULT_5G_CH;
}
break;
}
default:
/* Intentional fall through to use same sta channel for softap */
break;
}
WL_MSG(dev->name, "band=%d, sta_band=%d, channel=%d\n", band, sta_band, channel);
goto done2;
}
#ifdef WL_ESCAN
channel = wl_android_escan_autochannel(dev, band);
if (channel)
goto done2;
else
goto done;
#endif /* WL_ESCAN */
if ((ret =
wldev_ioctl_get(dev, WLC_GET_SPECT_MANAGMENT, &spect, sizeof(spect))) < 0) {
ANDROID_ERROR(("%s: ACS: error getting the spect\n", __FUNCTION__));
ANDROID_ERROR(("ACS: error getting the spect\n"));
goto done;
}
@@ -2551,19 +2676,15 @@ wl_android_set_auto_channel(struct net_device *dev, const char* cmd_str,
reqbuf = kzalloc(CHANSPEC_BUF_SIZE, GFP_KERNEL);
if (reqbuf == NULL) {
ANDROID_ERROR(("%s: failed to allocate chanspec buffer\n", __FUNCTION__));
ANDROID_ERROR(("failed to allocate chanspec buffer\n"));
return -ENOMEM;
}
if (band == WLC_BAND_AUTO) {
ANDROID_INFO(("%s: ACS full channel scan \n", __func__));
ANDROID_INFO(("ACS full channel scan \n"));
reqbuf[0] = htod32(0);
} else if (band == WLC_BAND_5G) {
band_new = band_cur==WLC_BAND_2G ? band_cur : WLC_BAND_5G;
ret = wldev_ioctl_set(dev, WLC_SET_BAND, &band_new, sizeof(band_new));
if (ret < 0)
WL_ERR(("WLC_SET_BAND error %d\n", ret));
ANDROID_INFO(("%s: ACS 5G band scan \n", __func__));
ANDROID_INFO(("ACS 5G band scan \n"));
if ((ret = wl_cfg80211_get_chanspecs_5g(dev, reqbuf, CHANSPEC_BUF_SIZE)) < 0) {
ANDROID_ERROR(("ACS 5g chanspec retreival failed! \n"));
goto done;
@@ -2573,7 +2694,7 @@ wl_android_set_auto_channel(struct net_device *dev, const char* cmd_str,
* If channel argument is not provided/ argument 20 is provided,
* Restrict channel to 2GHz, 20MHz BW, No SB
*/
ANDROID_INFO(("%s: ACS 2G band scan \n", __func__));
ANDROID_INFO(("ACS 2G band scan \n"));
if ((ret = wl_cfg80211_get_chanspecs_2g(dev, reqbuf, CHANSPEC_BUF_SIZE)) < 0) {
ANDROID_ERROR(("ACS 2g chanspec retreival failed! \n"));
goto done;
@@ -2583,12 +2704,11 @@ wl_android_set_auto_channel(struct net_device *dev, const char* cmd_str,
goto done2;
}
buf_size = CHANSPEC_BUF_SIZE;
buf_size = (band == WLC_BAND_AUTO) ? sizeof(int) : CHANSPEC_BUF_SIZE;
ret = wldev_ioctl_set(dev, WLC_START_CHANNEL_SEL, (void *)reqbuf,
buf_size);
if (ret < 0) {
ANDROID_ERROR(("%s: can't start auto channel scan, err = %d\n",
__FUNCTION__, ret));
ANDROID_ERROR(("can't start auto channel scan, err = %d\n", ret));
channel = 0;
goto done;
}
@@ -2614,18 +2734,6 @@ wl_android_set_auto_channel(struct net_device *dev, const char* cmd_str,
chosen = dtoh32(chosen);
}
if ((ret == 0) && (dtoh32(chosen) != 0)) {
uint chip;
chip = dhd_conf_get_chip(dhd_get_pub(dev));
if (chip != BCM43143_CHIP_ID) {
u32 chanspec = 0;
chanspec = wl_chspec_driver_to_host(chosen);
ANDROID_INFO(("%s: selected chanspec = 0x%x\n", __FUNCTION__, chanspec));
chosen = wf_chspec_ctlchan(chanspec);
ANDROID_INFO(("%s: selected chosen = 0x%x\n", __FUNCTION__, chosen));
}
}
if (chosen) {
int chosen_band;
int apcs_band;
@@ -2640,15 +2748,12 @@ wl_android_set_auto_channel(struct net_device *dev, const char* cmd_str,
#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 (band == WLC_BAND_AUTO) {
printf("%s: selected channel = %d\n", __FUNCTION__, channel);
break;
} else if (apcs_band == chosen_band) {
printf("%s: selected channel = %d\n", __FUNCTION__, channel);
if (apcs_band == chosen_band) {
WL_MSG(dev->name, "selected channel = %d\n", channel);
break;
}
}
ANDROID_INFO(("%s: %d tried, ret = %d, chosen = 0x%x\n", __FUNCTION__,
ANDROID_INFO(("%d tried, ret = %d, chosen = 0x%x\n",
(APCS_MAX_RETRY - retry), ret, chosen));
OSL_SLEEP(250);
}
@@ -2661,16 +2766,12 @@ done:
} else {
channel = APCS_DEFAULT_2G_CH;
}
ANDROID_ERROR(("%s: ACS failed."
" Fall back to default channel (%d) \n", __FUNCTION__, channel));
ANDROID_ERROR(("ACS failed. Fall back to default channel (%d) \n", channel));
}
done2:
ret = wldev_ioctl_set(dev, WLC_SET_BAND, &band_cur, sizeof(band_cur));
if (ret < 0)
WL_ERR(("WLC_SET_BAND error %d\n", ret));
if (spect > 0) {
if ((ret = wl_cfg80211_set_spect(dev, spect) < 0)) {
ANDROID_ERROR(("%s: ACS: error while setting spect\n", __FUNCTION__));
ANDROID_ERROR(("ACS: error while setting spect\n"));
}
}
@@ -2679,12 +2780,8 @@ done2:
}
if (channel) {
if (channel < 15)
pos += snprintf(pos, total_len, "2g=");
else
pos += snprintf(pos, total_len, "5g=");
pos += snprintf(pos, total_len, "%d", channel);
ANDROID_INFO(("%s: command result is %s \n", __FUNCTION__, command));
snprintf(command, 4, "%d", channel);
ANDROID_INFO(("command result is %s \n", command));
return strlen(command);
} else {
return ret;
@@ -3322,6 +3419,7 @@ wl_android_set_ulb_bw(struct net_device *dev, char *command, int total_len)
return wl_cfg80211_set_ulb_bw(dev, bw, ifname);
}
#endif /* WL11ULB */
static int
wl_android_set_miracast(struct net_device *dev, char *command, int total_len)
{
@@ -3423,6 +3521,7 @@ resume:
}
#endif
#ifdef WL_RELMCAST
#define NETLINK_OXYGEN 30
#define AIBSS_BEACON_TIMEOUT 10
@@ -3508,7 +3607,7 @@ wl_netlink_send_msg(int pid, int type, int seq, const void *data, size_t size)
nlmsg_failure:
return ret;
}
#endif /* WL_RELMCAST */
int wl_keep_alive_set(struct net_device *dev, char* extra, int total_len)
{
@@ -4226,7 +4325,7 @@ wl_android_make_hang_with_reason(struct net_device *dev, const char *string_num)
#endif /* DHD_HANG_SEND_UP_TEST */
#ifdef WL_CFG80211
#ifdef WLMESH
#ifdef WLMESH_CFG80211
static int
wl_android_set_rsdb_mode(struct net_device *dev, char *command, int total_len)
{
@@ -4746,8 +4845,8 @@ int wl_android_priv_cmd(struct net_device *net, struct ifreq *ifr, int cmd)
command[0] = '\0';
}
if (bytes_written >= priv_cmd.total_len) {
ANDROID_ERROR(("%s: err. bytes_written:%d >= buf_size:%d \n",
__FUNCTION__, bytes_written, buf_size));
ANDROID_ERROR(("%s: err. bytes_written:%d >= total_len:%d, buf_size:%d\n",
__FUNCTION__, bytes_written, priv_cmd.total_len, buf_size));
ret = BCME_BUFTOOSHORT;
goto exit;
}
@@ -4957,7 +5056,7 @@ wl_handle_private_cmd(struct net_device *net, char *command, u32 cmd_len)
bytes_written = wl_android_get_p2p_dev_addr(net, command, priv_cmd.total_len);
}
#ifdef WL_CFG80211
#ifdef WLMESH
#ifdef WLMESH_CFG80211
else if (strnicmp(command, CMD_SAE_SET_PASSWORD, strlen(CMD_SAE_SET_PASSWORD)) == 0) {
int skip = strlen(CMD_SAE_SET_PASSWORD) + 1;
bytes_written = wl_cfg80211_set_sae_password(net, command + skip,
@@ -5007,6 +5106,11 @@ wl_handle_private_cmd(struct net_device *net, char *command, u32 cmd_len)
bytes_written = wl_cfg80211_set_wps_p2p_ie(net, command + skip,
priv_cmd.total_len - skip, *(command + skip - 2) - '0');
}
#ifdef WLFBT
else if (strnicmp(command, CMD_GET_FTKEY, strlen(CMD_GET_FTKEY)) == 0) {
bytes_written = wl_cfg80211_get_fbt_key(net, command, priv_cmd.total_len);
}
#endif /* WLFBT */
#endif /* WL_CFG80211 */
#if defined(WL_SUPPORT_AUTO_CHANNEL)
else if (strnicmp(command, CMD_GET_BEST_CHANNELS,
@@ -5409,7 +5513,7 @@ int wl_android_init(void)
{
int ret = 0;
#ifdef ENABLE_INSMOD_NO_FW_LOAD
#if defined(ENABLE_INSMOD_NO_FW_LOAD) || defined(BUS_POWER_RESTORE)
dhd_download_fw_on_driverload = FALSE;
#endif /* ENABLE_INSMOD_NO_FW_LOAD */
if (!iface_name[0]) {
@@ -5417,7 +5521,9 @@ int wl_android_init(void)
bcm_strncpy_s(iface_name, IFNAMSIZ, "wlan", IFNAMSIZ);
}
#ifdef WL_RELMCAST
wl_netlink_init();
#endif /* WL_RELMCAST */
return ret;
}
@@ -5427,7 +5533,9 @@ int wl_android_exit(void)
int ret = 0;
struct io_cfg *cur, *q;
#ifdef WL_RELMCAST
wl_netlink_deinit();
#endif
#if defined(STRICT_GCC_WARNINGS) && defined(__GNUC__)
#pragma GCC diagnostic push

View File

@@ -66,37 +66,17 @@ typedef struct _compat_android_wifi_priv_cmd {
*/
/* message levels */
#define ANDROID_ERROR_LEVEL 0x0001
#define ANDROID_TRACE_LEVEL 0x0002
#define ANDROID_INFO_LEVEL 0x0004
#define ANDROID_EVENT_LEVEL 0x0008
#define ANDROID_ERROR_LEVEL (1 << 0)
#define ANDROID_TRACE_LEVEL (1 << 1)
#define ANDROID_INFO_LEVEL (1 << 2)
#define ANDROID_SCAN_LEVEL (1 << 3)
#define ANDROID_DBG_LEVEL (1 << 4)
#define ANDROID_MSG_LEVEL (1 << 0)
#define ANDROID_ERROR(x) \
#define WL_MSG(name, arg1, args...) \
do { \
if (android_msg_level & ANDROID_ERROR_LEVEL) { \
printk(KERN_ERR "ANDROID-ERROR) "); \
printk x; \
} \
} while (0)
#define ANDROID_TRACE(x) \
do { \
if (android_msg_level & ANDROID_TRACE_LEVEL) { \
printk(KERN_ERR "ANDROID-TRACE) "); \
printk x; \
} \
} while (0)
#define ANDROID_INFO(x) \
do { \
if (android_msg_level & ANDROID_INFO_LEVEL) { \
printk(KERN_ERR "ANDROID-INFO) "); \
printk x; \
} \
} while (0)
#define ANDROID_EVENT(x) \
do { \
if (android_msg_level & ANDROID_EVENT_LEVEL) { \
printk(KERN_ERR "ANDROID-EVENT) "); \
printk x; \
if (android_msg_level & ANDROID_MSG_LEVEL) { \
printk(KERN_ERR "[dhd-%s] %s : " arg1, name, __func__, ## args); \
} \
} while (0)
@@ -117,23 +97,69 @@ s32 wl_netlink_send_msg(int pid, int type, int seq, const void *data, size_t siz
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);
u32 wl_ext_iapsta_update_channel(struct net_device *dev, u32 channel);
u32 wl_ext_iapsta_update_channel(dhd_pub_t *dhd, struct net_device *dev, u32 channel);
int wl_ext_iapsta_alive_preinit(struct net_device *dev);
int wl_ext_iapsta_alive_postinit(struct net_device *dev);
int wl_ext_iapsta_event(struct net_device *dev, wl_event_msg_t *e, void* data);
int wl_ext_iapsta_attach(dhd_pub_t *pub);
void wl_ext_iapsta_dettach(dhd_pub_t *pub);
bool wl_ext_check_mesh_creating(struct net_device *net);
#ifdef WL_CFG80211
void wl_ext_iapsta_update_iftype(struct net_device *net, int ifidx, int wl_iftype);
#endif
extern int op_mode;
#endif
typedef struct bcol_gtk_para {
int enable;
int ptk_len;
char ptk[64];
char replay[8];
} bcol_gtk_para_t;
#if defined(WL_EXT_IAPSTA) || defined(USE_IW)
typedef enum WL_EVENT_PRIO {
PRIO_EVENT_IAPSTA,
PRIO_EVENT_ESCAN,
PRIO_EVENT_WEXT
}wl_event_prio_t;
s32 wl_ext_event_attach(struct net_device *dev, dhd_pub_t *dhdp);
void wl_ext_event_dettach(dhd_pub_t *dhdp);
int wl_ext_event_attach_netdev(struct net_device *net, int ifidx, uint8 bssidx);
int wl_ext_event_dettach_netdev(struct net_device *net, int ifidx);
int wl_ext_event_register(struct net_device *dev, dhd_pub_t *dhd,
uint32 event, void *cb_func, void *data, wl_event_prio_t prio);
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
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 wl_ext_check_scan(struct net_device *dev, dhd_pub_t *dhdp);
#if defined(WL_CFG80211) || defined(WL_ESCAN)
void wl_ext_user_sync(struct dhd_pub *dhd, int ifidx, bool lock);
bool wl_ext_event_complete(struct dhd_pub *dhd, int ifidx);
#endif
enum wl_ext_status {
WL_EXT_STATUS_DISCONNECTING = 0,
WL_EXT_STATUS_DISCONNECTED,
WL_EXT_STATUS_SCAN,
WL_EXT_STATUS_CONNECTING,
WL_EXT_STATUS_CONNECTED,
WL_EXT_STATUS_ADD_KEY,
WL_EXT_STATUS_AP_ENABLED,
WL_EXT_STATUS_DELETE_STA,
WL_EXT_STATUS_STA_DISCONNECTED,
WL_EXT_STATUS_STA_CONNECTED,
WL_EXT_STATUS_AP_DISABLED
};
typedef struct wl_conn_info {
uint8 bssidx;
wlc_ssid_t ssid;
struct ether_addr bssid;
uint16 channel;
} wl_conn_info_t;
#if defined(WL_WIRELESS_EXT)
s32 wl_ext_connect(struct net_device *dev, wl_conn_info_t *conn_info);
#endif /* defined(WL_WIRELESS_EXT) */
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 0, 0))
#define strnicmp(str1, str2, len) strncasecmp((str1), (str2), (len))
#endif
@@ -154,6 +180,8 @@ s32 wl_ext_connect(struct net_device *dev, wl_conn_info_t *conn_info);
* restrict max number to 10 as maximum cmd string size is 255
*/
#define MAX_NUM_MAC_FILT 10
#define WL_GET_BAND(ch) (((uint)(ch) <= CH_MAX_2G_CHANNEL) ? \
WLC_BAND_2G : WLC_BAND_5G)
int wl_android_set_ap_mac_list(struct net_device *dev, int macmode, struct maclist *maclist);
@@ -189,7 +217,7 @@ extern int g_wifi_on;
typedef struct wl_rssi_cache {
struct wl_rssi_cache *next;
int dirty;
struct timeval tv;
struct osl_timespec tv;
struct ether_addr BSSID;
int16 RSSI[RSSIAVG_LEN];
} wl_rssi_cache_t;
@@ -225,7 +253,7 @@ int wl_update_rssi_offset(struct net_device *net, int rssi);
typedef struct wl_bss_cache {
struct wl_bss_cache *next;
int dirty;
struct timeval tv;
struct osl_timespec tv;
wl_scan_results_t results;
} wl_bss_cache_t;

File diff suppressed because it is too large Load Diff

View File

@@ -52,6 +52,9 @@ struct bcm_cfg80211;
struct wl_security;
struct wl_ibss;
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 14, 0)
#undef WL_SAE
#endif // endif
#define htod32(i) (i)
#define htod16(i) (i)
@@ -84,116 +87,135 @@ extern char *dhd_log_dump_get_timestamp(void);
#define WL_DBG_LEVEL 0xFF
#ifdef CUSTOMER_HW4_DEBUG
#define CFG80211_ERROR_TEXT "CFG80211-INFO2) "
#define CFG80211_ERROR_TEXT "[dhd] CFG80211-INFO2) "
#else
#define CFG80211_ERROR_TEXT "CFG80211-ERROR) "
#define CFG80211_ERROR_TEXT "[dhd] CFG80211-ERROR) "
#endif /* CUSTOMER_HW4_DEBUG */
#if defined(DHD_DEBUG)
#ifdef DHD_LOG_DUMP
#define WL_ERR(args) \
#define WL_ERR_MSG(x, args...) \
do { \
if (wl_dbg_level & WL_DBG_ERR) { \
printk(KERN_INFO CFG80211_ERROR_TEXT "%s : ", __func__); \
printk args; \
printk(KERN_INFO CFG80211_ERROR_TEXT "%s : " x, __func__, ## args); \
DHD_LOG_DUMP_WRITE("[%s] %s: ", dhd_log_dump_get_timestamp(), __func__); \
DHD_LOG_DUMP_WRITE args; \
DHD_LOG_DUMP_WRITE(x, ## args); \
} \
} while (0)
#define WL_ERR_MEM(args) \
do { \
if (wl_dbg_level & WL_DBG_ERR) { \
DHD_LOG_DUMP_WRITE("[%s] %s: ", dhd_log_dump_get_timestamp(), __func__); \
DHD_LOG_DUMP_WRITE args; \
DHD_LOG_DUMP_WRITE(x, ## args); \
} \
} while (0)
#define WL_ERR_EX(args) \
#define WL_ERR_EX_MSG(x, args...) \
do { \
if (wl_dbg_level & WL_DBG_ERR) { \
printk(KERN_INFO CFG80211_ERROR_TEXT "%s : ", __func__); \
printk args; \
DHD_LOG_DUMP_WRITE_EX("[%s] %s: ", dhd_log_dump_get_timestamp(), __func__); \
DHD_LOG_DUMP_WRITE_EX args; \
printk(KERN_INFO CFG80211_ERROR_TEXT "%s : " x, __func__, ## args); \
DHD_LOG_DUMP_WRITE_EX("[%s] %s: ", dhd_log_dump_get_timestamp(), __func__); \
DHD_LOG_DUMP_WRITE_EX(x, ## args); \
} \
} while (0)
#define WL_ERR(x) WL_ERR_MSG x
#define WL_ERR_EX(args) WL_ERR_EX_MSG(args)
#else
#define WL_ERR(args) \
#define WL_ERR_MSG(x, args...) \
do { \
if (wl_dbg_level & WL_DBG_ERR) { \
printk(KERN_INFO CFG80211_ERROR_TEXT "%s : ", __func__); \
printk args; \
} \
printk(KERN_INFO CFG80211_ERROR_TEXT "%s : " x, __func__, ## args); \
} \
} while (0)
#define WL_ERR(x) WL_ERR_MSG x
#define WL_ERR_MEM(args) WL_ERR(args)
#define WL_ERR_EX(args) WL_ERR(args)
#endif /* DHD_LOG_DUMP */
#else /* defined(DHD_DEBUG) */
#define WL_ERR(args) \
#define WL_ERR_MSG(x, args...) \
do { \
if ((wl_dbg_level & WL_DBG_ERR) && net_ratelimit()) { \
printk(KERN_INFO CFG80211_ERROR_TEXT "%s : ", __func__); \
printk args; \
} \
printk(KERN_INFO CFG80211_ERROR_TEXT "%s : " x, __func__, ## args); \
} \
} while (0)
#define WL_ERR(x) WL_ERR_MSG x
#define WL_ERR_MEM(args) WL_ERR(args)
#define WL_ERR_EX(args) WL_ERR(args)
#endif /* defined(DHD_DEBUG) */
#define WL_PRINT_RATE_LIMIT_PERIOD 4000000000u /* 4s in units of ns */
#define WL_ERR_RLMT(args) \
do { \
if (wl_dbg_level & WL_DBG_ERR) { \
static uint64 __err_ts = 0; \
static uint32 __err_cnt = 0; \
uint64 __cur_ts = 0; \
__cur_ts = local_clock(); \
if (__err_ts == 0 || (__cur_ts > __err_ts && \
(__cur_ts - __err_ts > WL_PRINT_RATE_LIMIT_PERIOD))) { \
__err_ts = __cur_ts; \
WL_ERR(args); \
WL_ERR(("[Repeats %u times]\n", __err_cnt)); \
__err_cnt = 0; \
} else { \
++__err_cnt; \
} \
} \
} while (0)
#ifdef WL_INFORM
#undef WL_INFORM
#endif
#define WL_INFORM(args) \
#define WL_INFORM_MSG(x, args...) \
do { \
if (wl_dbg_level & WL_DBG_INFO) { \
printk(KERN_INFO "CFG80211-INFO) %s : ", __func__); \
printk args; \
} \
printk(KERN_INFO "[dhd] CFG80211-INFO) %s : " x, __func__, ## args); \
} \
} while (0)
#define WL_INFORM(x) WL_INFORM_MSG x
#ifdef WL_SCAN
#undef WL_SCAN
#endif
#define WL_SCAN(args) \
#define WL_SCAN_MSG(x, args...) \
do { \
if (wl_dbg_level & WL_DBG_SCAN) { \
printk(KERN_INFO "CFG80211-SCAN) %s :", __func__); \
printk args; \
printk(KERN_INFO "[dhd] CFG80211-SCAN) %s :" x, __func__, ## args); \
} \
} while (0)
#define WL_SCAN(x) WL_SCAN_MSG x
#ifdef WL_TRACE
#undef WL_TRACE
#endif
#define WL_TRACE(args) \
#define WL_TRACE_MSG(x, args...) \
do { \
if (wl_dbg_level & WL_DBG_TRACE) { \
printk(KERN_INFO "CFG80211-TRACE) %s :", __func__); \
printk args; \
printk(KERN_INFO "[dhd] CFG80211-TRACE) %s :" x, __func__, ## args); \
} \
} while (0)
#define WL_TRACE(x) WL_TRACE_MSG x
#ifdef WL_TRACE_HW4
#undef WL_TRACE_HW4
#endif
#ifdef CUSTOMER_HW4_DEBUG
#define WL_TRACE_HW4(args) \
#define WL_TRACE_HW4_MSG(x, args...) \
do { \
if (wl_dbg_level & WL_DBG_ERR) { \
printk(KERN_INFO "CFG80211-TRACE) %s : ", __func__); \
printk args; \
} \
printk(KERN_INFO "[dhd] CFG80211-TRACE) %s : " x, __func__, ## args); \
} \
} while (0)
#define WL_TRACE_HW4(x) WL_TRACE_HW4_MSG x
#else
#define WL_TRACE_HW4 WL_TRACE
#endif /* CUSTOMER_HW4_DEBUG */
#if (WL_DBG_LEVEL > 0)
#define WL_DBG(args) \
#define WL_DBG_MSG(x, args...) \
do { \
if (wl_dbg_level & WL_DBG_DBG) { \
printk(KERN_INFO "CFG80211-DEBUG) %s :", __func__); \
printk args; \
printk(KERN_INFO "[dhd] CFG80211-DEBUG) %s :" x, __func__, ## args); \
} \
} while (0)
#define WL_DBG(x) WL_DBG_MSG x
#else /* !(WL_DBG_LEVEL > 0) */
#define WL_DBG(args)
#endif /* (WL_DBG_LEVEL > 0) */
@@ -207,8 +229,8 @@ do { \
#define IEEE80211_NUM_BANDS NUM_NL80211_BANDS
#endif
#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0))
#ifdef WLMESH
#undef WLMESH
#ifdef WLMESH_CFG80211
#undef WLMESH_CFG80211
#endif
#endif
@@ -341,26 +363,12 @@ enum wl_status {
WL_STATUS_NESTED_CONNECT
};
enum wl_ext_status {
WL_EXT_STATUS_DISCONNECTING = 0,
WL_EXT_STATUS_DISCONNECTED,
WL_EXT_STATUS_SCAN,
WL_EXT_STATUS_CONNECTING,
WL_EXT_STATUS_CONNECTED,
WL_EXT_STATUS_ADD_KEY,
WL_EXT_STATUS_AP_ENABLED,
WL_EXT_STATUS_DELETE_STA,
WL_EXT_STATUS_STA_DISCONNECTED,
WL_EXT_STATUS_STA_CONNECTED,
WL_EXT_STATUS_AP_DISABLED
};
/* wi-fi mode */
enum wl_mode {
WL_MODE_BSS,
WL_MODE_IBSS,
WL_MODE_AP,
#ifdef WLMESH
#ifdef WLMESH_CFG80211
WL_MODE_MESH
#endif
};
@@ -631,6 +639,9 @@ typedef struct {
/* Max length of Interworking element */
#define IW_IES_MAX_BUF_LEN 9
#endif
#ifdef WLFBT
#define FBT_KEYLEN 32
#endif
#define MAX_EVENT_BUF_NUM 16
typedef struct wl_eventmsg_buf {
u16 num;
@@ -783,7 +794,7 @@ struct bcm_cfg80211 {
struct p2p_info *p2p;
bool p2p_supported;
void *btcoex_info;
struct timer_list scan_timeout; /* Timer for catch scan event timeout */
timer_list_compat_t scan_timeout; /* Timer for catch scan event timeout */
#if defined(P2P_IE_MISSING_FIX)
bool p2p_prb_noti;
#endif
@@ -797,7 +808,7 @@ struct bcm_cfg80211 {
bool sched_scan_running; /* scheduled scan req status */
struct cfg80211_sched_scan_request *sched_scan_req; /* scheduled scan req */
bool scan_suppressed;
struct timer_list scan_supp_timer;
timer_list_compat_t scan_supp_timer;
struct work_struct wlan_work;
struct mutex event_sync; /* maily for up/down synchronization */
bool disable_roam_event;
@@ -817,6 +828,9 @@ struct bcm_cfg80211 {
bcm_struct_cfgdev *ibss_cfgdev; /* For AIBSS */
#endif /* WLAIBSS_MCHAN */
bool bss_pending_op; /* indicate where there is a pending IF operation */
#ifdef WLFBT
uint8 fbt_key[FBT_KEYLEN];
#endif
int roam_offload;
#ifdef WL_CFG80211_P2P_DEV_IF
bool down_disc_if;
@@ -847,7 +861,7 @@ struct bcm_cfg80211 {
bool random_mac_enabled;
#endif /* SUPPORT_RANDOM_MAC_SCAN */
#ifdef DHD_LOSSLESS_ROAMING
struct timer_list roam_timeout; /* Timer for catch roam timeout */
timer_list_compat_t roam_timeout; /* Timer for catch roam timeout */
#endif
uint16 escan_sync_id_cntr;
#ifdef WLTDLS
@@ -869,10 +883,10 @@ struct bcm_cfg80211 {
#ifdef STAT_REPORT
void *stat_report_info;
#endif
#ifdef WLMESH
#ifdef WLMESH_CFG80211
char sae_password[SAE_MAX_PASSWD_LEN];
uint sae_password_len;
#endif /* WLMESH */
#endif /* WLMESH_CFG80211 */
#if defined(RSSIAVG)
wl_rssi_cache_ctrl_t g_rssi_cache_ctrl;
wl_rssi_cache_ctrl_t g_connected_rssi_cache_ctrl;
@@ -886,12 +900,23 @@ struct bcm_cfg80211 {
int best_2g_ch;
int best_5g_ch;
uint handshaking;
int btc_mode;
bool wps_done;
wait_queue_head_t wps_done_event;
struct mutex in4way_sync;
ulong disconnected_jiffies;
};
#ifdef WL_SAE
typedef struct wl_sae_key_info {
uint8 peer_mac[ETHER_ADDR_LEN];
uint16 pmk_len;
uint16 pmkid_len;
const uint8 *pmk;
const uint8 *pmkid;
} wl_sae_key_info_t;
#endif /* WL_SAE */
#if defined(STRICT_GCC_WARNINGS) && defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == \
4 && __GNUC_MINOR__ >= 6))
#define GCC_DIAGNOSTIC_PUSH() \
@@ -1447,7 +1472,20 @@ wl_get_netinfo_by_wdev(struct bcm_cfg80211 *cfg, struct wireless_dev *wdev)
(!_sme->crypto.n_ciphers_pairwise) && \
(!_sme->crypto.cipher_group))
#ifdef WLFBT
#if defined(WLAN_AKM_SUITE_FT_8021X) && defined(WLAN_AKM_SUITE_FT_PSK)
#define IS_AKM_SUITE_FT(sec) (sec->wpa_auth == WLAN_AKM_SUITE_FT_8021X || \
sec->wpa_auth == WLAN_AKM_SUITE_FT_PSK)
#elif defined(WLAN_AKM_SUITE_FT_8021X)
#define IS_AKM_SUITE_FT(sec) (sec->wpa_auth == WLAN_AKM_SUITE_FT_8021X)
#elif defined(WLAN_AKM_SUITE_FT_PSK)
#define IS_AKM_SUITE_FT(sec) (sec->wpa_auth == WLAN_AKM_SUITE_FT_PSK)
#else
#define IS_AKM_SUITE_FT(sec) ({BCM_REFERENCE(sec); FALSE;})
#endif /* WLAN_AKM_SUITE_FT_8021X && WLAN_AKM_SUITE_FT_PSK */
#else
#define IS_AKM_SUITE_FT(sec) ({BCM_REFERENCE(sec); FALSE;})
#endif /* WLFBT */
#define IS_AKM_SUITE_CCKM(sec) ({BCM_REFERENCE(sec); FALSE;})
@@ -1504,7 +1542,7 @@ extern s32 wl_cfg80211_set_wps_p2p_ie(struct net_device *net, char *buf, int len
extern s32 wl_cfg80211_set_p2p_ps(struct net_device *net, char* buf, int len);
extern s32 wl_cfg80211_set_p2p_ecsa(struct net_device *net, char* buf, int len);
extern s32 wl_cfg80211_increase_p2p_bw(struct net_device *net, char* buf, int len);
#ifdef WLMESH
#ifdef WLMESH_CFG80211
extern s32 wl_cfg80211_set_sae_password(struct net_device *net, char* buf, int len);
#endif
#ifdef WL11ULB
@@ -1586,6 +1624,9 @@ extern int wl_cfg80211_set_mgmt_vndr_ies(struct bcm_cfg80211 *cfg,
bcm_struct_cfgdev *cfgdev, s32 bssidx, s32 pktflag,
const u8 *vndr_ie, u32 vndr_ie_len);
#ifdef WLFBT
extern int wl_cfg80211_get_fbt_key(struct net_device *dev, uint8 *key, int total_len);
#endif
/* Action frame specific functions */
extern u8 wl_get_action_category(void *frame, u32 frame_len);

View File

@@ -45,7 +45,7 @@ extern void dhd_pktfilter_offload_enable(dhd_pub_t * dhd, char *arg, int enable,
#endif
struct btcoex_info {
struct timer_list timer;
timer_list_compat_t timer;
u32 timer_ms;
u32 timer_on;
u32 ts_dhcp_start; /* ms ts ecord time stats */
@@ -294,19 +294,9 @@ wl_cfg80211_bt_setflag(struct net_device *dev, bool set)
#endif
}
static void wl_cfg80211_bt_timerfunc(
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
struct timer_list *t
#else
unsigned long data
#endif
)
static void wl_cfg80211_bt_timerfunc(ulong data)
{
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
struct btcoex_info *bt_local = from_timer(bt_local, t, timer);
#else
struct btcoex_info *bt_local = (struct btcoex_info *)data;
#endif
WL_TRACE(("Enter\n"));
bt_local->timer_on = 0;
schedule_work(&bt_local->work);
@@ -403,13 +393,7 @@ void* wl_cfg80211_btcoex_init(struct net_device *ndev)
btco_inf->ts_dhcp_ok = 0;
/* Set up timer for BT */
btco_inf->timer_ms = 10;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
timer_setup(&btco_inf->timer, wl_cfg80211_bt_timerfunc, 0);
#else
init_timer(&btco_inf->timer);
btco_inf->timer.data = (ulong)btco_inf;
btco_inf->timer.function = wl_cfg80211_bt_timerfunc;
#endif
init_timer_compat(&btco_inf->timer, wl_cfg80211_bt_timerfunc, btco_inf);
btco_inf->dev = ndev;
@@ -506,7 +490,8 @@ int wl_cfg80211_set_btcoex_dhcp(struct net_device *dev, dhd_pub_t *dhd, char *co
btco_inf->bt_state = BT_DHCP_START;
btco_inf->timer_on = 1;
mod_timer(&btco_inf->timer, btco_inf->timer.expires);
mod_timer(&btco_inf->timer,
timer_expires(&btco_inf->timer));
WL_TRACE(("enable BT DHCP Timer\n"));
}
}

View File

@@ -334,9 +334,6 @@ wl_cfgp2p_init_priv(struct bcm_cfg80211 *cfg)
return -ENOMEM;
}
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
cfg->p2p->cfg = cfg;
#endif
wl_to_p2p_bss_ndev(cfg, P2PAPI_BSSCFG_PRIMARY) = bcmcfg_to_prmry_ndev(cfg);
wl_to_p2p_bss_bssidx(cfg, P2PAPI_BSSCFG_PRIMARY) = 0;
wl_to_p2p_bss_ndev(cfg, P2PAPI_BSSCFG_DEVICE) = NULL;
@@ -1389,21 +1386,10 @@ wl_cfgp2p_listen_complete(struct bcm_cfg80211 *cfg, bcm_struct_cfgdev *cfgdev,
* so lets do it from thread context.
*/
void
wl_cfgp2p_listen_expired(
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
struct timer_list *t
#else
ulong data
#endif
)
wl_cfgp2p_listen_expired(unsigned long data)
{
wl_event_msg_t msg;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
struct p2p_info *p2p = from_timer(p2p, t, listen_timer);
struct bcm_cfg80211 *cfg = p2p->cfg;
#else
struct bcm_cfg80211 *cfg = (struct bcm_cfg80211 *) data;
#endif
struct net_device *ndev;
CFGP2P_DBG((" Enter\n"));
@@ -1469,7 +1455,7 @@ wl_cfgp2p_discover_listen(struct bcm_cfg80211 *cfg, s32 channel, u32 duration_ms
{
#define EXTRA_DELAY_TIME 100
s32 ret = BCME_OK;
struct timer_list *_timer;
timer_list_compat_t *_timer;
s32 extra_delay;
struct net_device *netdev = bcmcfg_to_prmry_ndev(cfg);

View File

@@ -71,16 +71,13 @@ struct p2p_bss {
};
struct p2p_info {
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
struct bcm_cfg80211 *cfg;
#endif
bool on; /**< p2p on/off switch */
bool scan;
int16 search_state;
s8 vir_ifname[IFNAMSIZ];
unsigned long status;
struct p2p_bss bss[P2PAPI_BSSCFG_MAX];
struct timer_list listen_timer;
timer_list_compat_t listen_timer;
wl_p2p_sched_t noa;
wl_p2p_ops_t ops;
wlc_ssid_t ssid;
@@ -186,23 +183,13 @@ enum wl_cfgp2p_status {
printk args; \
} \
} while (0)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
#define INIT_TIMER(timer, func, duration, extra_delay) \
do { \
timer_setup(timer, func, 0); \
timer->expires = jiffies + msecs_to_jiffies(duration + extra_delay); \
init_timer_compat(timer, func, cfg); \
timer_expires(timer) = jiffies + msecs_to_jiffies(duration + extra_delay); \
add_timer(timer); \
} while (0);
#else
#define INIT_TIMER(timer, func, duration, extra_delay) \
do { \
init_timer(timer); \
timer->function = func; \
timer->expires = jiffies + msecs_to_jiffies(duration + extra_delay); \
timer->data = (unsigned long) cfg; \
add_timer(timer); \
} while (0);
#endif
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(3, 0, 8))
#ifdef WL_SUPPORT_BACKPORTED_KPATCHES
@@ -257,13 +244,7 @@ enum wl_cfgp2p_status {
#define P2P_ECSA_CNT 50
extern void
wl_cfgp2p_listen_expired(
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0)
struct timer_list *t
#else
ulong data
#endif
);
wl_cfgp2p_listen_expired(ulong data);
extern bool
wl_cfgp2p_is_pub_action(void *frame, u32 frame_len);
extern bool

View File

@@ -2080,6 +2080,53 @@ wl_cfgvendor_get_ndev(struct bcm_cfg80211 *cfg, struct wireless_dev *wdev,
return ndev;
}
#ifdef WL_SAE
static int
wl_cfgvendor_set_sae_password(struct wiphy *wiphy,
struct wireless_dev *wdev, const void *data, int len)
{
int err = BCME_OK;
struct net_device *net = wdev->netdev;
struct bcm_cfg80211 *cfg = wl_get_cfg(net);
wsec_pmk_t pmk;
s32 bssidx;
/* clear the content of pmk structure before usage */
(void)memset(&pmk, 0x0, sizeof(wsec_pmk_t));
if ((bssidx = wl_get_bssidx_by_wdev(cfg, net->ieee80211_ptr)) < 0) {
WL_ERR(("Find p2p index from wdev(%p) failed\n", net->ieee80211_ptr));
return BCME_ERROR;
}
if ((len < WSEC_MIN_PSK_LEN) || (len >= WSEC_MAX_PASSPHRASE_LEN)) {
WL_ERR(("Invalid passphrase length %d..should be >= 8 and < 256\n",
len));
err = BCME_BADLEN;
goto done;
}
/* Set AUTH to SAE */
err = wldev_iovar_setint_bsscfg(net, "wpa_auth", WPA3_AUTH_SAE_PSK, bssidx);
if (unlikely(err)) {
WL_ERR(("could not set wpa_auth (0x%x)\n", err));
goto done;
}
pmk.key_len = htod16(len);
bcopy((const u8*)data, pmk.key, len);
pmk.flags = htod16(WSEC_PASSPHRASE);
err = wldev_ioctl_set(net, WLC_SET_WSEC_PMK, &pmk, sizeof(pmk));
if (err) {
WL_ERR(("\n failed to set pmk %d\n", err));
goto done;
} else {
WL_INFORM(("sae passphrase set successfully\n"));
}
done:
return err;
}
#endif /* WL_SAE */
/* Max length for the reply buffer. For BRCM_ATTR_DRIVER_CMD, the reply
* would be a formatted string and reply buf would be the size of the
* string.
@@ -3212,6 +3259,16 @@ static const struct wiphy_vendor_command wl_vendor_cmds [] = {
.flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV,
.doit = wl_cfgvendor_priv_bcm_handler
},
#ifdef WL_SAE
{
{
.vendor_id = OUI_BRCM,
.subcmd = BRCM_VENDOR_SCMD_BCM_PSK
},
.flags = WIPHY_VENDOR_CMD_NEED_WDEV | WIPHY_VENDOR_CMD_NEED_NETDEV,
.doit = wl_cfgvendor_set_sae_password
},
#endif /* WL_SAE */
#ifdef GSCAN_SUPPORT
{
{
@@ -3612,40 +3669,45 @@ static const struct wiphy_vendor_command wl_vendor_cmds [] = {
static const struct nl80211_vendor_cmd_info wl_vendor_events [] = {
{ OUI_BRCM, BRCM_VENDOR_EVENT_UNSPEC },
{ OUI_BRCM, BRCM_VENDOR_EVENT_PRIV_STR },
#ifdef GSCAN_SUPPORT
{ OUI_GOOGLE, GOOGLE_GSCAN_SIGNIFICANT_EVENT },
{ OUI_GOOGLE, GOOGLE_GSCAN_GEOFENCE_FOUND_EVENT },
{ OUI_GOOGLE, GOOGLE_GSCAN_BATCH_SCAN_EVENT },
{ OUI_GOOGLE, GOOGLE_SCAN_FULL_RESULTS_EVENT },
#endif /* GSCAN_SUPPORT */
#ifdef RTT_SUPPORT
{ OUI_GOOGLE, GOOGLE_RTT_COMPLETE_EVENT },
#endif /* RTT_SUPPORT */
#ifdef GSCAN_SUPPORT
{ OUI_GOOGLE, GOOGLE_SCAN_COMPLETE_EVENT },
{ OUI_GOOGLE, GOOGLE_GSCAN_GEOFENCE_LOST_EVENT },
{ OUI_GOOGLE, GOOGLE_SCAN_EPNO_EVENT },
#endif /* GSCAN_SUPPORT */
{ OUI_GOOGLE, GOOGLE_DEBUG_RING_EVENT },
{ OUI_GOOGLE, GOOGLE_FW_DUMP_EVENT },
#ifdef GSCAN_SUPPORT
{ OUI_GOOGLE, GOOGLE_PNO_HOTSPOT_FOUND_EVENT },
#endif /* GSCAN_SUPPORT */
{ OUI_GOOGLE, GOOGLE_RSSI_MONITOR_EVENT },
{ OUI_GOOGLE, GOOGLE_MKEEP_ALIVE_EVENT },
{ OUI_GOOGLE, GOOGLE_NAN_EVENT_ENABLED},
{ OUI_GOOGLE, GOOGLE_NAN_EVENT_DISABLED},
{ OUI_GOOGLE, GOOGLE_NAN_EVENT_PUBLISH_TERMINATED},
{ OUI_GOOGLE, GOOGLE_NAN_EVENT_SUBSCRIBE_MATCH},
{ OUI_GOOGLE, GOOGLE_NAN_EVENT_SUBSCRIBE_UNMATCH},
{ OUI_GOOGLE, GOOGLE_NAN_EVENT_REPLIED},
{ OUI_GOOGLE, GOOGLE_NAN_EVENT_PUBLISH_TERMINATED},
{ OUI_GOOGLE, GOOGLE_NAN_EVENT_SUBSCRIBE_TERMINATED},
{ OUI_GOOGLE, GOOGLE_NAN_EVENT_DE_EVENT},
{ OUI_GOOGLE, GOOGLE_NAN_EVENT_FOLLOWUP},
{ OUI_GOOGLE, GOOGLE_NAN_EVENT_TRANSMIT_FOLLOWUP_IND},
{ OUI_GOOGLE, GOOGLE_NAN_EVENT_DATA_REQUEST},
{ OUI_GOOGLE, GOOGLE_NAN_EVENT_DATA_CONFIRMATION},
{ OUI_GOOGLE, GOOGLE_NAN_EVENT_DATA_END},
{ OUI_GOOGLE, GOOGLE_NAN_EVENT_BEACON},
{ OUI_GOOGLE, GOOGLE_NAN_EVENT_SDF},
{ OUI_GOOGLE, GOOGLE_NAN_EVENT_TCA},
#ifdef NAN_DP
{ OUI_GOOGLE, GOOGLE_NAN_EVENT_DATA_PATH_OPEN},
#endif /* NAN_DP */
{ OUI_GOOGLE, GOOGLE_NAN_EVENT_UNKNOWN}
{ OUI_GOOGLE, GOOGLE_NAN_EVENT_SUBSCRIBE_UNMATCH},
{ OUI_GOOGLE, GOOGLE_NAN_EVENT_UNKNOWN},
{ OUI_GOOGLE, GOOGLE_ROAM_EVENT_START},
{ OUI_BRCM, BRCM_VENDOR_EVENT_HANGED},
{ OUI_BRCM, BRCM_VENDOR_EVENT_SAE_KEY},
{ OUI_BRCM, BRCM_VENDOR_EVENT_BEACON_RECV},
{ OUI_BRCM, BRCM_VENDOR_EVENT_PORT_AUTHORIZED},
{ OUI_GOOGLE, GOOGLE_FILE_DUMP_EVENT },
{ OUI_BRCM, BRCM_VENDOR_EVENT_CU},
{ OUI_BRCM, BRCM_VENDOR_EVENT_WIPS},
{ OUI_GOOGLE, NAN_ASYNC_RESPONSE_DISABLED}
};
int wl_cfgvendor_attach(struct wiphy *wiphy, dhd_pub_t *dhd)

View File

@@ -359,6 +359,12 @@ enum wifi_rssi_monitor_attr {
RSSI_MONITOR_ATTRIBUTE_START
};
enum wifi_sae_key_attr {
BRCM_SAE_KEY_ATTR_PEER_MAC,
BRCM_SAE_KEY_ATTR_PMK,
BRCM_SAE_KEY_ATTR_PMKID
};
enum debug_attributes {
DEBUG_ATTRIBUTE_GET_DRIVER,
DEBUG_ATTRIBUTE_GET_FW,
@@ -395,38 +401,53 @@ enum apf_attributes {
};
typedef enum wl_vendor_event {
BRCM_VENDOR_EVENT_UNSPEC,
BRCM_VENDOR_EVENT_PRIV_STR,
GOOGLE_GSCAN_SIGNIFICANT_EVENT,
GOOGLE_GSCAN_GEOFENCE_FOUND_EVENT,
GOOGLE_GSCAN_BATCH_SCAN_EVENT,
GOOGLE_SCAN_FULL_RESULTS_EVENT,
GOOGLE_RTT_COMPLETE_EVENT,
GOOGLE_SCAN_COMPLETE_EVENT,
GOOGLE_GSCAN_GEOFENCE_LOST_EVENT,
GOOGLE_SCAN_EPNO_EVENT,
GOOGLE_DEBUG_RING_EVENT,
GOOGLE_FW_DUMP_EVENT,
GOOGLE_PNO_HOTSPOT_FOUND_EVENT,
GOOGLE_RSSI_MONITOR_EVENT,
GOOGLE_MKEEP_ALIVE_EVENT,
BRCM_VENDOR_EVENT_UNSPEC = 0,
BRCM_VENDOR_EVENT_PRIV_STR = 1,
GOOGLE_GSCAN_SIGNIFICANT_EVENT = 2,
GOOGLE_GSCAN_GEOFENCE_FOUND_EVENT = 3,
GOOGLE_GSCAN_BATCH_SCAN_EVENT = 4,
GOOGLE_SCAN_FULL_RESULTS_EVENT = 5,
GOOGLE_RTT_COMPLETE_EVENT = 6,
GOOGLE_SCAN_COMPLETE_EVENT = 7,
GOOGLE_GSCAN_GEOFENCE_LOST_EVENT = 8,
GOOGLE_SCAN_EPNO_EVENT = 9,
GOOGLE_DEBUG_RING_EVENT = 10,
GOOGLE_FW_DUMP_EVENT = 11,
GOOGLE_PNO_HOTSPOT_FOUND_EVENT = 12,
GOOGLE_RSSI_MONITOR_EVENT = 13,
GOOGLE_MKEEP_ALIVE_EVENT = 14,
/*
* BRCM specific events should be placed after
* the Generic events so that enums don't mismatch
* between the DHD and HAL
*/
GOOGLE_NAN_EVENT_ENABLED = 150,
GOOGLE_NAN_EVENT_DISABLED,
GOOGLE_NAN_EVENT_PUBLISH_TERMINATED,
GOOGLE_NAN_EVENT_SUBSCRIBE_MATCH,
GOOGLE_NAN_EVENT_SUBSCRIBE_UNMATCH,
GOOGLE_NAN_EVENT_SUBSCRIBE_TERMINATED,
GOOGLE_NAN_EVENT_DE_EVENT,
GOOGLE_NAN_EVENT_FOLLOWUP,
GOOGLE_NAN_EVENT_TCA,
GOOGLE_NAN_EVENT_DATA_IF_ADD,
GOOGLE_NAN_EVENT_DATA_PATH_OPEN,
GOOGLE_NAN_EVENT_UNKNOWN
GOOGLE_NAN_EVENT_ENABLED = 15,
GOOGLE_NAN_EVENT_DISABLED = 16,
GOOGLE_NAN_EVENT_SUBSCRIBE_MATCH = 17,
GOOGLE_NAN_EVENT_REPLIED = 18,
GOOGLE_NAN_EVENT_PUBLISH_TERMINATED = 19,
GOOGLE_NAN_EVENT_SUBSCRIBE_TERMINATED = 20,
GOOGLE_NAN_EVENT_DE_EVENT = 21,
GOOGLE_NAN_EVENT_FOLLOWUP = 22,
GOOGLE_NAN_EVENT_TRANSMIT_FOLLOWUP_IND = 23,
GOOGLE_NAN_EVENT_DATA_REQUEST = 24,
GOOGLE_NAN_EVENT_DATA_CONFIRMATION = 25,
GOOGLE_NAN_EVENT_DATA_END = 26,
GOOGLE_NAN_EVENT_BEACON = 27,
GOOGLE_NAN_EVENT_SDF = 28,
GOOGLE_NAN_EVENT_TCA = 29,
GOOGLE_NAN_EVENT_SUBSCRIBE_UNMATCH = 30,
GOOGLE_NAN_EVENT_UNKNOWN = 31,
GOOGLE_ROAM_EVENT_START = 32,
BRCM_VENDOR_EVENT_HANGED = 33,
BRCM_VENDOR_EVENT_SAE_KEY = 34,
BRCM_VENDOR_EVENT_BEACON_RECV = 35,
BRCM_VENDOR_EVENT_PORT_AUTHORIZED = 36,
GOOGLE_FILE_DUMP_EVENT = 37,
BRCM_VENDOR_EVENT_CU = 38,
BRCM_VENDOR_EVENT_WIPS = 39,
NAN_ASYNC_RESPONSE_DISABLED = 40
} wl_vendor_event_t;
enum andr_wifi_attr {

File diff suppressed because it is too large Load Diff

View File

@@ -1,65 +1,30 @@
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _wl_escan_
#define _wl_escan_
#include <linux/wireless.h>
#include <linuxver.h>
#include <wl_iw.h>
#include <dngl_stats.h>
#include <dhd.h>
#include <linux/time.h>
#ifdef DHD_MAX_IFS
#define WL_MAX_IFS DHD_MAX_IFS
#else
#define WL_MAX_IFS 16
#endif
#define ESCAN_BUF_SIZE (64 * 1024)
#define WL_ESCAN_TIMER_INTERVAL_MS 10000 /* Scan timeout */
/* event queue for cfg80211 main event */
struct escan_event_q {
struct list_head eq_list;
u32 etype;
wl_event_msg_t emsg;
s8 edata[1];
};
struct pmk_list {
pmkid_list_t pmkids;
pmkid_t foo[MAXPMKID - 1];
};
/* donlge escan state */
enum escan_state {
ESCAN_STATE_DOWN,
ESCAN_STATE_IDLE,
ESCAN_STATE_SCANING
};
struct wl_escan_info;
typedef s32(*ESCAN_EVENT_HANDLER) (struct wl_escan_info *escan,
const wl_event_msg_t *e, void *data);
typedef struct wl_escan_info {
struct net_device *dev;
dhd_pub_t *pub;
struct timer_list scan_timeout; /* Timer for catch scan event timeout */
int escan_state;
timer_list_compat_t scan_timeout; /* Timer for catch scan event timeout */
int escan_state;
int ioctl_ver;
char ioctlbuf[WLC_IOCTL_SMLEN];
u8 escan_buf[ESCAN_BUF_SIZE];
struct wl_scan_results *bss_list;
struct wl_scan_results *scan_results;
struct ether_addr disconnected_bssid;
u8 *escan_ioctl_buf;
spinlock_t eq_lock; /* for event queue synchronization */
struct list_head eq_list; /* used for event queue */
tsk_ctl_t event_tsk; /* task of main event handler thread */
ESCAN_EVENT_HANDLER evt_handler[WLC_E_LAST];
struct mutex usr_sync; /* maily for up/down synchronization */
int autochannel;
int best_2g_ch;
@@ -71,23 +36,43 @@ typedef struct wl_escan_info {
#if defined(BSSCACHE)
wl_bss_cache_ctrl_t g_bss_cache_ctrl;
#endif
struct pmk_list pmk_list;
wl_conn_info_t conn_info;
} wl_escan_info_t;
void wl_escan_event(struct net_device *dev, const wl_event_msg_t * e, void *data);
#if defined(WLMESH)
/* donlge escan state */
enum mesh_info_id {
MESH_INFO_MASTER_BSSID = 1,
MESH_INFO_MASTER_CHANNEL,
MESH_INFO_HOP_CNT,
MESH_INFO_PEER_BSSID
};
int wl_escan_set_scan(
struct net_device *dev,
struct iw_request_info *info,
union iwreq_data *wrqu,
char *extra
);
int wl_escan_get_scan(struct net_device *dev, struct iw_request_info *info,
struct iw_point *dwrq, char *extra);
s32 wl_escan_autochannel(struct net_device *dev, char* command, int total_len);
typedef struct wl_mesh_params {
struct ether_addr master_bssid;
uint16 master_channel;
uint hop_cnt;
struct ether_addr peer_bssid;
uint16 channel;
uint16 scan_channel;
} wl_mesh_params_t;
int 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 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);
#endif /* WLMESH */
int wl_escan_set_scan(struct net_device *dev, dhd_pub_t *dhdp,
wlc_ssid_t *ssid, uint16 channel, bool bcast);
int wl_escan_get_scan(struct net_device *dev, dhd_pub_t *dhdp,
struct iw_request_info *info, struct iw_point *dwrq, char *extra);
int wl_escan_attach(struct net_device *dev, dhd_pub_t *dhdp);
void wl_escan_detach(dhd_pub_t *dhdp);
void wl_escan_detach(struct net_device *dev, dhd_pub_t *dhdp);
int wl_escan_event_attach(struct net_device *dev, dhd_pub_t *dhdp);
int wl_escan_event_dettach(struct net_device *dev, dhd_pub_t *dhdp);
int wl_escan_up(struct net_device *dev, dhd_pub_t *dhdp);
void wl_escan_down(struct net_device *dev, dhd_pub_t *dhdp);
#endif /* _wl_escan_ */

View File

@@ -0,0 +1,504 @@
#if defined(WL_EXT_IAPSTA) || defined(USE_IW)
#include <bcmendian.h>
#include <wl_android.h>
#include <dhd_config.h>
#define EVENT_ERROR(name, arg1, args...) \
do { \
if (android_msg_level & ANDROID_ERROR_LEVEL) { \
printk(KERN_ERR "[dhd-%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_ERR "[dhd-%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_ERR "[dhd-%s] EVENT-DBG) %s : " arg1, name, __func__, ## args); \
} \
} while (0)
#if defined(STRICT_GCC_WARNINGS) && defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == \
4 && __GNUC_MINOR__ >= 6))
#define BCM_SET_LIST_FIRST_ENTRY(entry, ptr, type, member) \
_Pragma("GCC diagnostic push") \
_Pragma("GCC diagnostic ignored \"-Wcast-qual\"") \
(entry) = list_first_entry((ptr), type, member); \
_Pragma("GCC diagnostic pop") \
#define BCM_SET_CONTAINER_OF(entry, ptr, type, member) \
_Pragma("GCC diagnostic push") \
_Pragma("GCC diagnostic ignored \"-Wcast-qual\"") \
entry = container_of((ptr), type, member); \
_Pragma("GCC diagnostic pop") \
#else
#define BCM_SET_LIST_FIRST_ENTRY(entry, ptr, type, member) \
(entry) = list_first_entry((ptr), type, member); \
#define BCM_SET_CONTAINER_OF(entry, ptr, type, member) \
entry = container_of((ptr), type, member); \
#endif /* STRICT_GCC_WARNINGS */
#ifdef DHD_MAX_IFS
#define WL_MAX_IFS DHD_MAX_IFS
#else
#define WL_MAX_IFS 16
#endif
/* event queue for cfg80211 main event */
struct wl_event_q {
struct list_head eq_list;
u32 etype;
wl_event_msg_t emsg;
s8 edata[1];
};
typedef s32(*EXT_EVENT_HANDLER) (struct net_device *dev, void *cb_argu,
const wl_event_msg_t *e, void *data);
typedef struct event_handler_list {
struct event_handler_list *next;
struct net_device *dev;
uint32 etype;
EXT_EVENT_HANDLER cb_func;
void *cb_argu;
wl_event_prio_t prio;
} event_handler_list_t;
typedef struct event_handler_head {
event_handler_list_t *evt_head;
} event_handler_head_t;
typedef struct wl_event_params {
dhd_pub_t *pub;
struct net_device *dev[WL_MAX_IFS];
struct event_handler_head evt_head;
struct list_head eq_list; /* used for event queue */
spinlock_t eq_lock; /* for event queue synchronization */
struct workqueue_struct *event_workq; /* workqueue for event */
struct work_struct event_work; /* work item for event */
struct mutex event_sync;
} wl_event_params_t;
static unsigned long
wl_ext_event_lock_eq(struct wl_event_params *event_params)
{
unsigned long flags;
spin_lock_irqsave(&event_params->eq_lock, flags);
return flags;
}
static void
wl_ext_event_unlock_eq(struct wl_event_params *event_params, unsigned long flags)
{
spin_unlock_irqrestore(&event_params->eq_lock, flags);
}
static void
wl_ext_event_init_eq_lock(struct wl_event_params *event_params)
{
spin_lock_init(&event_params->eq_lock);
}
static void
wl_ext_event_init_eq(struct wl_event_params *event_params)
{
wl_ext_event_init_eq_lock(event_params);
INIT_LIST_HEAD(&event_params->eq_list);
}
static void
wl_ext_event_flush_eq(struct wl_event_params *event_params)
{
struct wl_event_q *e;
unsigned long flags;
flags = wl_ext_event_lock_eq(event_params);
while (!list_empty_careful(&event_params->eq_list)) {
BCM_SET_LIST_FIRST_ENTRY(e, &event_params->eq_list, struct wl_event_q, eq_list);
list_del(&e->eq_list);
kfree(e);
}
wl_ext_event_unlock_eq(event_params, flags);
}
/*
* retrieve first queued event from head
*/
static struct wl_event_q *
wl_ext_event_deq_event(struct wl_event_params *event_params)
{
struct wl_event_q *e = NULL;
unsigned long flags;
flags = wl_ext_event_lock_eq(event_params);
if (likely(!list_empty(&event_params->eq_list))) {
BCM_SET_LIST_FIRST_ENTRY(e, &event_params->eq_list, struct wl_event_q, eq_list);
list_del(&e->eq_list);
}
wl_ext_event_unlock_eq(event_params, flags);
return e;
}
/*
* push event to tail of the queue
*/
static s32
wl_ext_event_enq_event(struct wl_event_params *event_params, u32 event,
const wl_event_msg_t *msg, void *data)
{
struct wl_event_q *e;
s32 err = 0;
uint32 evtq_size;
uint32 data_len;
unsigned long flags;
gfp_t aflags;
data_len = 0;
if (data)
data_len = ntoh32(msg->datalen);
evtq_size = sizeof(struct wl_event_q) + data_len;
aflags = (in_atomic()) ? GFP_ATOMIC : GFP_KERNEL;
e = kzalloc(evtq_size, aflags);
if (unlikely(!e)) {
EVENT_ERROR("wlan", "event alloc failed\n");
return -ENOMEM;
}
e->etype = event;
memcpy(&e->emsg, msg, sizeof(wl_event_msg_t));
if (data)
memcpy(e->edata, data, data_len);
flags = wl_ext_event_lock_eq(event_params);
list_add_tail(&e->eq_list, &event_params->eq_list);
wl_ext_event_unlock_eq(event_params, flags);
return err;
}
static void
wl_ext_event_put_event(struct wl_event_q *e)
{
kfree(e);
}
static void
wl_ext_event_handler(struct work_struct *work_data)
{
struct wl_event_params *event_params = NULL;
struct wl_event_q *e;
struct net_device *dev = NULL;
struct event_handler_list *evt_node;
dhd_pub_t *dhd;
BCM_SET_CONTAINER_OF(event_params, work_data, struct wl_event_params, event_work);
DHD_EVENT_WAKE_LOCK(event_params->pub);
while ((e = wl_ext_event_deq_event(event_params))) {
if (e->emsg.ifidx >= DHD_MAX_IFS) {
EVENT_ERROR("wlan", "ifidx=%d not in range\n", e->emsg.ifidx);
goto fail;
}
dev = event_params->dev[e->emsg.ifidx];
if (!dev) {
EVENT_DBG("wlan", "ifidx=%d dev not ready\n", e->emsg.ifidx);
goto fail;
}
dhd = dhd_get_pub(dev);
if (e->etype > WLC_E_LAST) {
EVENT_TRACE(dev->name, "Unknown Event (%d): ignoring\n", e->etype);
goto fail;
}
if (dhd->busstate == DHD_BUS_DOWN) {
EVENT_ERROR(dev->name, "BUS is DOWN.\n");
goto fail;
}
EVENT_DBG(dev->name, "event type (%d)\n", e->etype);
mutex_lock(&event_params->event_sync);
evt_node = event_params->evt_head.evt_head;
for (;evt_node;) {
if (evt_node->dev == dev &&
(evt_node->etype == e->etype || evt_node->etype == WLC_E_LAST))
evt_node->cb_func(dev, evt_node->cb_argu, &e->emsg, e->edata);
evt_node = evt_node->next;
}
mutex_unlock(&event_params->event_sync);
fail:
wl_ext_event_put_event(e);
}
DHD_EVENT_WAKE_UNLOCK(event_params->pub);
}
void
wl_ext_event_send(void *params, const wl_event_msg_t * e, void *data)
{
struct wl_event_params *event_params = params;
u32 event_type = ntoh32(e->event_type);
if (event_params == NULL) {
EVENT_ERROR("wlan", "Stale event %d(%s) ignored\n",
event_type, bcmevent_get_name(event_type));
return;
}
if (event_params->event_workq == NULL) {
EVENT_ERROR("wlan", "Event handler is not created %d(%s)\n",
event_type, bcmevent_get_name(event_type));
return;
}
if (likely(!wl_ext_event_enq_event(event_params, event_type, e, data))) {
queue_work(event_params->event_workq, &event_params->event_work);
}
}
static s32
wl_ext_event_create_handler(struct wl_event_params *event_params)
{
int ret = 0;
EVENT_TRACE("wlan", "Enter\n");
/* Allocate workqueue for event */
if (!event_params->event_workq) {
event_params->event_workq = alloc_workqueue("ext_eventd", WQ_MEM_RECLAIM | WQ_HIGHPRI, 0);
}
if (!event_params->event_workq) {
EVENT_ERROR("wlan", "event_workq alloc_workqueue failed\n");
ret = -ENOMEM;
} else {
INIT_WORK(&event_params->event_work, wl_ext_event_handler);
}
return ret;
}
static void
wl_ext_event_free(struct wl_event_params *event_params)
{
struct event_handler_list *node, *cur, **evt_head;
evt_head = &event_params->evt_head.evt_head;
node = *evt_head;
for (;node;) {
EVENT_TRACE(node->dev->name, "Free etype=%d\n", node->etype);
cur = node;
node = cur->next;
kfree(cur);
}
*evt_head = NULL;
}
static void
wl_ext_event_destroy_handler(struct wl_event_params *event_params)
{
if (event_params && event_params->event_workq) {
cancel_work_sync(&event_params->event_work);
destroy_workqueue(event_params->event_workq);
event_params->event_workq = NULL;
}
}
int
wl_ext_event_register(struct net_device *dev, dhd_pub_t *dhd, uint32 event,
void *cb_func, void *data, wl_event_prio_t prio)
{
struct wl_event_params *event_params = dhd->event_params;
struct event_handler_list *node, *leaf, *node_prev, **evt_head;
int ret = 0;
if (event_params) {
mutex_lock(&event_params->event_sync);
evt_head = &event_params->evt_head.evt_head;
node = *evt_head;
for (;node;) {
if (node->dev == dev && node->etype == event && node->cb_func == cb_func) {
EVENT_TRACE(dev->name, "skip event %d\n", event);
mutex_unlock(&event_params->event_sync);
return 0;
}
node = node->next;
}
leaf = kmalloc(sizeof(event_handler_list_t), GFP_KERNEL);
if (!leaf) {
EVENT_ERROR(dev->name, "Memory alloc failure %d for event %d\n",
(int)sizeof(event_handler_list_t), event);
mutex_unlock(&event_params->event_sync);
return -ENOMEM;
}
leaf->next = NULL;
leaf->dev = dev;
leaf->etype = event;
leaf->cb_func = cb_func;
leaf->cb_argu = data;
leaf->prio = prio;
if (*evt_head == NULL) {
*evt_head = leaf;
} else {
node = *evt_head;
node_prev = NULL;
for (;node;) {
if (node->prio <= prio) {
leaf->next = node;
if (node_prev)
node_prev->next = leaf;
else
*evt_head = leaf;
break;
} else if (node->next == NULL) {
node->next = leaf;
break;
}
node_prev = node;
node = node->next;
}
}
EVENT_TRACE(dev->name, "event %d registered\n", event);
mutex_unlock(&event_params->event_sync);
} else {
EVENT_ERROR(dev->name, "event_params not ready %d\n", event);
ret = -ENODEV;
}
return ret;
}
void
wl_ext_event_deregister(struct net_device *dev, dhd_pub_t *dhd,
uint32 event, void *cb_func)
{
struct wl_event_params *event_params = dhd->event_params;
struct event_handler_list *node, *prev, **evt_head;
int tmp = 0;
if (event_params) {
mutex_lock(&event_params->event_sync);
evt_head = &event_params->evt_head.evt_head;
node = *evt_head;
prev = node;
for (;node;) {
if (node->dev == dev && node->etype == event && node->cb_func == cb_func) {
if (node == *evt_head) {
tmp = 1;
*evt_head = node->next;
} else {
tmp = 0;
prev->next = node->next;
}
EVENT_TRACE(dev->name, "event %d deregistered\n", event);
kfree(node);
if (tmp == 1) {
node = *evt_head;
prev = node;
} else {
node = prev->next;
}
continue;
}
prev = node;
node = node->next;
}
mutex_unlock(&event_params->event_sync);
} else {
EVENT_ERROR(dev->name, "event_params not ready %d\n", event);
}
}
static s32
wl_ext_event_init_priv(struct wl_event_params *event_params)
{
s32 err = 0;
mutex_init(&event_params->event_sync);
wl_ext_event_init_eq(event_params);
if (wl_ext_event_create_handler(event_params))
return -ENOMEM;
return err;
}
static void
wl_ext_event_deinit_priv(struct wl_event_params *event_params)
{
wl_ext_event_destroy_handler(event_params);
wl_ext_event_flush_eq(event_params);
wl_ext_event_free(event_params);
}
int
wl_ext_event_attach_netdev(struct net_device *net, int ifidx, uint8 bssidx)
{
struct dhd_pub *dhd = dhd_get_pub(net);
struct wl_event_params *event_params = dhd->event_params;
EVENT_TRACE(net->name, "ifidx=%d, bssidx=%d\n", ifidx, bssidx);
if (event_params && ifidx < WL_MAX_IFS) {
event_params->dev[ifidx] = net;
}
return 0;
}
int
wl_ext_event_dettach_netdev(struct net_device *net, int ifidx)
{
struct dhd_pub *dhd = dhd_get_pub(net);
struct wl_event_params *event_params = dhd->event_params;
EVENT_TRACE(net->name, "ifidx=%d\n", ifidx);
if (event_params && ifidx < WL_MAX_IFS) {
event_params->dev[ifidx] = NULL;
}
return 0;
}
s32
wl_ext_event_attach(struct net_device *dev, dhd_pub_t *dhdp)
{
struct wl_event_params *event_params = NULL;
s32 err = 0;
event_params = kmalloc(sizeof(wl_event_params_t), GFP_KERNEL);
if (!event_params) {
EVENT_ERROR(dev->name, "Failed to allocate memory (%zu)\n",
sizeof(wl_event_params_t));
return -ENOMEM;
}
dhdp->event_params = event_params;
memset(event_params, 0, sizeof(wl_event_params_t));
event_params->pub = dhdp;
err = wl_ext_event_init_priv(event_params);
if (err) {
EVENT_ERROR(dev->name, "Failed to wl_ext_event_init_priv (%d)\n", err);
goto ext_attach_out;
}
return err;
ext_attach_out:
wl_ext_event_dettach(dhdp);
return err;
}
void
wl_ext_event_dettach(dhd_pub_t *dhdp)
{
struct wl_event_params *event_params = dhdp->event_params;
if (event_params) {
wl_ext_event_deinit_priv(event_params);
kfree(event_params);
dhdp->event_params = NULL;
}
}
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -109,7 +109,7 @@ typedef struct wl_iw {
} wl_iw_t;
struct wl_ctrl {
struct timer_list *timer;
timer_list_compat_t *timer;
struct net_device *dev;
long sysioc_pid;
struct semaphore sysioc_sem;
@@ -123,16 +123,24 @@ extern const struct iw_handler_def wl_iw_handler_def;
#endif /* WIRELESS_EXT > 12 */
extern int wl_iw_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
extern void wl_iw_event(struct net_device *dev, wl_event_msg_t *e, void* data);
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);
#else
int wl_iw_attach(struct net_device *dev, dhd_pub_t *dhdp);
void wl_iw_detach(dhd_pub_t *dhdp);
#endif
int wl_iw_attach(struct net_device *dev, dhd_pub_t *dhdp);
void wl_iw_detach(struct net_device *dev, dhd_pub_t *dhdp);
int wl_iw_up(struct net_device *dev, dhd_pub_t *dhdp);
void wl_iw_down(struct net_device *dev, dhd_pub_t *dhdp);
s32 wl_iw_autochannel(struct net_device *dev, char* command, int total_len);
/* message levels */
#define WL_ERROR_LEVEL (1 << 0)
#define WL_TRACE_LEVEL (1 << 1)
#define WL_INFO_LEVEL (1 << 2)
#define WL_SCAN_LEVEL (1 << 3)
#define WL_WSEC_LEVEL (1 << 4)
#define CSCAN_COMMAND "CSCAN "
#define CSCAN_TLV_PREFIX 'S'

View File

@@ -46,17 +46,17 @@
#define htodchanspec(i) (i)
#define dtohchanspec(i) (i)
#define WLDEV_ERROR(args) \
do { \
printk(KERN_ERR "WLDEV-ERROR) "); \
printk args; \
#define WLDEV_ERROR_MSG(x, args...) \
do { \
printk(KERN_INFO "WLDEV-ERROR) " x, ## args); \
} while (0)
#define WLDEV_ERROR(x) WLDEV_ERROR_MSG x
#define WLDEV_INFO(args) \
do { \
printk(KERN_INFO "WLDEV-INFO) "); \
printk args; \
#define WLDEV_INFO_MSG(x, args...) \
do { \
printk(KERN_INFO "WLDEV-INFO) " x, ## args); \
} while (0)
#define WLDEV_INFO(x) WLDEV_INFO_MSG x
extern int dhd_ioctl_entry_local(struct net_device *net, wl_ioctl_t *ioc, int cmd);
@@ -479,7 +479,6 @@ int wldev_set_country(
wl_country_t cspec = {{0}, 0, {0}};
wl_country_t cur_cspec = {{0}, 0, {0}}; /* current ccode */
scb_val_t scbval;
char smbuf[WLC_IOCTL_SMLEN];
#ifdef WL_CFG80211
struct wireless_dev *wdev = ndev_to_wdev(dev);
struct wiphy *wiphy = wdev->wiphy;
@@ -525,8 +524,7 @@ int wldev_set_country(
}
}
error = wldev_iovar_setbuf(dev, "country", &cspec, sizeof(cspec),
smbuf, sizeof(smbuf), NULL);
error = dhd_conf_set_country(dhd_get_pub(dev), &cspec);
if (error < 0) {
WLDEV_ERROR(("%s: set country for %s as %s rev %d failed\n",
__FUNCTION__, country_code, cspec.ccode, cspec.rev));