Driver commit for release MM6X18540.p22_V0 2025-10-07_15:04:46

Firmware version for commit:
W8997-16.92.21.p153.6
W9098-17.92.1.p149.79
IW416-16.92.21.p153.6
W8987-16.92.21.p153.6
IW612-18.99.3.p27
IW610-18.99.5.p78
AW693-18.99.2.p145.124

Signed-off-by: Pushpendra Tiwari <pushpendra.tiwari@nxp.com>
This commit is contained in:
Pushpendra Tiwari 2025-10-07 15:04:46 +05:30 • committed by Sherry Sun
parent 166182fdcc
commit 65b034884c
44 changed files with 2986 additions and 845 deletions

View file

@ -175,7 +175,7 @@ APPDIR= $(shell if test -d "mapp"; then echo mapp; fi)
#############################################################################
ccflags-y += -I$(KERNELDIR)/include
ccflags-y += -DMLAN_RELEASE_VERSION='"540.p10"'
ccflags-y += -DMLAN_RELEASE_VERSION='"540.p22"'
ccflags-y += -DFPNUM='"92"'

View file

@ -1209,9 +1209,8 @@ mlan_status wlan_11ax_ioctl_cmd(pmlan_adapter pmadapter,
/* reset old entries */
pmadapter->llde_totalMacFilters = 0;
// coverity[bad_memset: SUPPRESS]
memset(pmadapter, (t_u8 *)&pmadapter->llde_macfilters, 0,
MAX_MAC_FILTER_ENTRIES * MLAN_MAC_ADDR_LENGTH);
_memset(pmadapter, (t_u8 *)&pmadapter->llde_macfilters, 0,
MAX_MAC_FILTER_ENTRIES * MLAN_MAC_ADDR_LENGTH);
/* copy valid mac adresses only */
if (memcmp(pmadapter, &llde_pkt_filter->macfilter1,
@ -1246,11 +1245,10 @@ mlan_status wlan_11ax_ioctl_cmd(pmlan_adapter pmadapter,
/* remove llde packet filter parameters from buffer which will
* be passed to fimrware */
/* pass mlan_ds_11ax_llde_cmd params only to fw */
// coverity[bad_memset: SUPPRESS]
memset(pmadapter,
(t_u8 *)cfg + mlan_ds_11ax_cmd_cfg_header +
sizeof(mlan_ds_11ax_llde_cmd),
0, sizeof(mlan_ds_11ax_llde_pkt_filter_cmd));
_memset(pmadapter,
(t_u8 *)cfg + mlan_ds_11ax_cmd_cfg_header +
sizeof(mlan_ds_11ax_llde_cmd),
0, sizeof(mlan_ds_11ax_llde_pkt_filter_cmd));
}
/* Send request to firmware */
status = wlan_prepare_cmd(pmpriv, HostCmd_CMD_11AX_CMD, cmd_action, 0,
@ -1550,9 +1548,8 @@ mlan_status wlan_cmd_twt_cfg(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd,
break;
case MLAN_11AX_TWT_INFORMATION_SUBID:
twt_information_params = &hostcmd_twtcfg->param.twt_information;
// coverity[bad_memset: SUPPRESS]
memset(pmadapter, twt_information_params, 0x00,
sizeof(hostcmd_twtcfg->param.twt_information));
_memset(pmadapter, twt_information_params, 0x00,
sizeof(hostcmd_twtcfg->param.twt_information));
twt_information_params->flow_identifier =
ds_twtcfg->param.twt_information.flow_identifier;
twt_information_params->suspend_duration = wlan_cpu_to_le32(
@ -1561,9 +1558,8 @@ mlan_status wlan_cmd_twt_cfg(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd,
break;
case MLAN_11AX_BTWT_AP_CONFIG_SUBID:
btwt_ap_config_params = &hostcmd_twtcfg->param.btwt_ap_config;
// coverity[bad_memset: SUPPRESS]
memset(pmadapter, btwt_ap_config_params, 0x00,
sizeof(hostcmd_twtcfg->param.btwt_ap_config));
_memset(pmadapter, btwt_ap_config_params, 0x00,
sizeof(hostcmd_twtcfg->param.btwt_ap_config));
btwt_ap_config_params->ap_bcast_bet_sta_wait =
ds_twtcfg->param.btwt_ap_config.ap_bcast_bet_sta_wait;
btwt_ap_config_params->Ap_Bcast_Offset = wlan_cpu_to_le16(

View file

@ -115,8 +115,7 @@ static void wlan_11n_form_amsdu_txpd(mlan_private *priv, mlan_buffer *mbuf)
ENTER();
ptx_pd = (TxPD *)mbuf->pbuf;
// coverity[bad_memset:SUPPRESS]
memset(pmadapter, ptx_pd, 0, Tx_PD_SIZEOF(pmadapter));
_memset(pmadapter, ptx_pd, 0, Tx_PD_SIZEOF(pmadapter));
/*
* Original priority has been overwritten
@ -194,8 +193,7 @@ static t_u16 wlan_form_amsdu_txpd(mlan_private *priv, mlan_buffer *pmbuf,
* Gather*/
head_ptr = (t_u8 *)((t_ptr)head_ptr & ~((t_ptr)(7)));
ptx_pd = (TxPD *)(head_ptr + priv->intf_hr_len);
// coverity[bad_memset:SUPPRESS]
memset(pmadapter, ptx_pd, 0, Tx_PD_SIZEOF(pmadapter));
_memset(pmadapter, ptx_pd, 0, Tx_PD_SIZEOF(pmadapter));
/* Set the BSS number to TxPD */
ptx_pd->bss_num = GET_BSS_NUM(priv);
@ -665,6 +663,8 @@ mlan_status wlan_11n_deaggregate_pkt(mlan_private *priv, pmlan_buffer pmbuf)
pmadapter->pmoal_handle, &out_ts_sec, &out_ts_usec);
delay += (t_u32)(out_ts_sec - in_ts_sec) * 1000000;
delay += (t_u32)(out_ts_usec - in_ts_usec);
// input values are internally generated and controlled, not
// externally sourced
// coverity[misra_c_2012_directive_4_14_violation:SUPPRESS]
pmadapter->callbacks.moal_amsdu_tp_accounting(
pmadapter->pmoal_handle, delay, copy_delay);

View file

@ -677,7 +677,7 @@ static t_u32 wlan_hexval(t_u8 chr)
* @return The converted hex value if param a is a valid hex, else
* 0
*/
static int wlan_atox(t_u8 *a)
static int wlan_atox(const t_u8 *a)
{
int i = 0;
@ -699,9 +699,9 @@ static int wlan_atox(t_u8 *a)
*
* @return The parsed hex data length
*/
static t_u32 wlan_parse_cal_cfg(t_u8 *src, t_size len, t_u8 *dst)
static t_u32 wlan_parse_cal_cfg(const t_u8 *src, t_size len, t_u8 *dst)
{
t_u8 *ptr;
const t_u8 *ptr;
t_u8 *dptr;
ENTER();
@ -784,9 +784,9 @@ static t_u8 *wlan_strstr(t_u8 *s1, t_u8 *s2)
* @return Location of the first occurrence of the char
* if found, else NULL
*/
static t_u8 *wlan_strchr(t_u8 *s, int c)
static const t_u8 *wlan_strchr(const t_u8 *s, int c)
{
t_u8 *pos = s;
const t_u8 *pos = s;
while (*pos != '\0') {
if (*pos == (t_u8)c)
return pos;
@ -810,11 +810,11 @@ static t_u8 *wlan_strchr(t_u8 *s, int c)
* @return MLAN_STATUS_SUCCESS--success, otherwise--fail
*/
static t_u32 wlan_process_hostcmd_cfg(pmlan_private pmpriv, t_u16 cfg_type,
t_u8 *data, t_size size)
const t_u8 *data, t_size size)
{
mlan_status ret = MLAN_STATUS_SUCCESS;
t_u8 *pos = data;
t_u8 *intf_s, *intf_e;
const t_u8 *pos = data;
const t_u8 *intf_s, *intf_e;
t_u8 *buf = MNULL;
t_u8 *ptr = MNULL;
t_u32 cmd_len = 0;
@ -825,7 +825,7 @@ static t_u32 wlan_process_hostcmd_cfg(pmlan_private pmpriv, t_u16 cfg_type,
mlan_adapter *pmadapter = MNULL;
mlan_callbacks *pcb = MNULL;
t_u8 hostcmd_flag = MFALSE;
t_u8 *temp = pos;
const t_u8 *temp = pos;
t_u8 len = 0;
char psd_name[50];
t_u8 *intf_p;
@ -899,11 +899,14 @@ static t_u32 wlan_process_hostcmd_cfg(pmlan_private pmpriv, t_u16 cfg_type,
}
/* Excluding the 6E Mode based PSD string */
if (cfg_type == CFG_TYPE_HOSTCMD) {
if (*pos == 'r' || *pos == 'e' || *pos == 's') {
if ((start_raw == MFALSE) &&
(*pos == 'r' || *pos == 'e' || *pos == 's')) {
memset(pmadapter, psd_name, 0,
sizeof(psd_name));
len = 0;
while (*temp != ' ') {
while (((temp - data) < size) &&
(*temp != ' ') &&
(len < sizeof(psd_name) - 1)) {
temp++;
len++;
}
@ -916,8 +919,10 @@ static t_u32 wlan_process_hostcmd_cfg(pmlan_private pmpriv, t_u16 cfg_type,
* "rg_powerXX.bin" */
intf_p = wlan_strstr(psd_name, "PSD");
if (intf_p) {
while (*temp != '}') {
while (*temp != '\n')
while (((temp - data) < size) &&
*temp != '}') {
while (((temp - data) < size) &&
*temp != '\n')
temp++;
temp++;
}
@ -3590,7 +3595,8 @@ mlan_status wlan_fill_hal_rtt_results(pmlan_private pmpriv,
rtt_result_elem->len = pos - rtt_result_elem->data;
/* Check the left length's validity */
if (event_left_len < (tlv_rtt_result_len + sizeof(tlv_rtt_result->header)))
if (event_left_len <
(tlv_rtt_result_len + sizeof(tlv_rtt_result->header)))
break;
tlv += tlv_rtt_result_len + sizeof(tlv_rtt_result->header);
event_left_len -=
@ -3960,12 +3966,20 @@ mlan_status wlan_ret_802_11_hs_cfg(pmlan_private pmpriv,
phs_cfg->params.hs_config.conditions =
wlan_le32_to_cpu(phs_cfg->params.hs_config.conditions);
phs_cfg->action = wlan_le16_to_cpu(phs_cfg->action);
PRINTM(MCMND,
"CMD_RESP: HS_CFG cmd reply result=%#x,"
" action=0x%x conditions=0x%x gpio=0x%x gap=0x%x\n",
resp->result, phs_cfg->action,
phs_cfg->params.hs_config.conditions,
phs_cfg->params.hs_config.gpio, phs_cfg->params.hs_config.gap);
if (phs_cfg->action == HS_CONFIGURE) {
PRINTM(MCMND,
"CMD_RESP: HS_CFG cmd reply result=%#x,"
" action=0x%x conditions=0x%x gpio=0x%x gap=0x%x\n",
resp->result, phs_cfg->action,
phs_cfg->params.hs_config.conditions,
phs_cfg->params.hs_config.gpio,
phs_cfg->params.hs_config.gap);
} else {
PRINTM(MCMND,
"CMD_RESP: HS_CFG cmd reply result=%#x,"
" action=0x%x (Activate)\n",
resp->result, phs_cfg->action);
}
if ((phs_cfg->action == HS_ACTIVATE &&
!pmadapter->pcard_info->supp_ps_handshake) ||
pmadapter->pcard_info->supp_ps_handshake) {
@ -6635,7 +6649,7 @@ mlan_status wlan_cmd_cfg_data(pmlan_private pmpriv, HostCmd_DS_COMMAND *pcmd,
if ((cmd_oid == OID_TYPE_CAL) && (pmadapter->pcal_data) &&
(pmadapter->cal_data_len > 0)) {
len = wlan_parse_cal_cfg((t_u8 *)pmadapter->pcal_data,
len = wlan_parse_cal_cfg(pmadapter->pcal_data,
pmadapter->cal_data_len,
(t_u8 *)(temp_pcmd + data_offset));
}
@ -7000,8 +7014,8 @@ mlan_status wlan_ret_get_hw_spec(pmlan_private pmpriv, HostCmd_DS_COMMAND *resp,
pmadapter->pcard_sd->mp_end_port =
wlan_le16_to_cpu(hw_spec->mp_end_port);
for (i = 1; i <= (unsigned)(pmadapter->pcard_sd->max_ports -
pmadapter->pcard_sd->mp_end_port);
for (i = 1; i <= ((unsigned)pmadapter->pcard_sd->max_ports -
(unsigned)pmadapter->pcard_sd->mp_end_port);
i++)
pmadapter->pcard_sd->mp_data_port_mask &=
~(1 << (pmadapter->pcard_sd->max_ports - i));
@ -11736,7 +11750,10 @@ mlan_status wlan_cmd_tsp_config(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd,
wlan_cpu_to_le32(cfg->high_thrshld_temp);
tsp_config->low_thrshld_temp =
wlan_cpu_to_le32(cfg->low_thrshld_temp);
tsp_config->throttle_duty_cycle =
wlan_cpu_to_le32(cfg->throttle_duty_cycle);
tsp_config->rf_temp_poll_cnt =
wlan_cpu_to_le32(cfg->rf_temp_poll_cnt);
for (rfu = 0; rfu < MAX_RFUS; rfu++) {
for (rpath = 0; rpath < MAX_PATHS; rpath++) {
tsp_config->reg_rfu_val
@ -11790,6 +11807,11 @@ mlan_status wlan_ret_tsp_config(pmlan_private pmpriv, HostCmd_DS_COMMAND *resp,
wlan_le32_to_cpu(tsp_config->high_thrshld_temp);
cfg->param.tsp_cfg.low_thrshld_temp =
wlan_le32_to_cpu(tsp_config->low_thrshld_temp);
cfg->param.tsp_cfg.throttle_duty_cycle =
wlan_le32_to_cpu(
tsp_config->throttle_duty_cycle);
cfg->param.tsp_cfg.rf_temp_poll_cnt =
wlan_le32_to_cpu(tsp_config->rf_temp_poll_cnt);
for (rfu = 0; rfu < MAX_RFUS; rfu++) {
for (rpath = 0; rpath < MAX_PATHS; rpath++) {
@ -11857,8 +11879,8 @@ mlan_status wlan_cmd_tx_frame(pmlan_private pmpriv, HostCmd_DS_COMMAND *cmd,
tx_frame_cmd->buffer + Tx_PD_SIZEOF(pmpriv->adapter), pdata,
data_len, data_len);
// coverity[bad_memset:SUPPRESS]
memset(pmpriv->adapter, plocal_tx_pd, 0, Tx_PD_SIZEOF(pmpriv->adapter));
_memset(pmpriv->adapter, plocal_tx_pd, 0,
Tx_PD_SIZEOF(pmpriv->adapter));
plocal_tx_pd->bss_num = GET_BSS_NUM(pmpriv);
plocal_tx_pd->bss_type = pmpriv->bss_type;
plocal_tx_pd->tx_pkt_length = (t_u16)data_len;

View file

@ -614,6 +614,7 @@ typedef enum {
/** BIT value */
#define MBIT(x) (((t_u32)1) << (x))
#define MBIT64(x) (1ULL << (x))
/** Buffer flag for requeued packet */
#define MLAN_BUF_FLAG_REQUEUED_PKT MBIT(0)
@ -1010,15 +1011,15 @@ typedef MLAN_PACK_START struct _MrvlIEtypes_Data_t {
/** Custom data structure */
typedef struct _mlan_init_param {
/** DPD data buffer pointer */
t_u8 *pdpd_data_buf;
const t_u8 *pdpd_data_buf;
/** DPD data length */
t_u32 dpd_data_len;
/** region txpowerlimit cfg data buffer pointer */
t_u8 *ptxpwr_data_buf;
const t_u8 *ptxpwr_data_buf;
/** region txpowerlimit cfg data length */
t_u32 txpwr_data_len;
/** Cal data buffer pointer */
t_u8 *pcal_data_buf;
const t_u8 *pcal_data_buf;
/** Cal data length */
t_u32 cal_data_len;
/** Other custom data */
@ -1351,6 +1352,7 @@ typedef MLAN_PACK_START struct _radiotap_timestamp {
* 1 microseconds,
* 2 nanoseconds,
* 3-15 reserved */
// bit-field usage is required to match protocol-defined layout
// coverity[misra_c_2012_rule_6_1_violation:SUPPRESS]
t_u8 unit : 4;
/* position:
@ -1361,6 +1363,7 @@ typedef MLAN_PACK_START struct _radiotap_timestamp {
* 4-14 reserved
* 15 unknown or vendor/OOB defined
*/
// bit-field usage is required to match protocol-defined layout
// coverity[misra_c_2012_rule_6_1_violation:SUPPRESS]
t_u8 position : 4;
/* flags

View file

@ -324,6 +324,11 @@ typedef enum _WLAN_802_11_WEP_STATUS {
/** 2K buf size */
#define MLAN_TX_DATA_BUF_SIZE_2K 2048
#define SECURE_MULT_UINT32(a, b, c) \
(((t_u64)(a) * (b) * (c)) > UINT32_MAX ? \
UINT32_MAX : \
(t_u32)((t_u32)(a) * (b) * (c)))
/** ADDBA TID mask */
#define ADDBA_TID_MASK (MBIT(2) | MBIT(3) | MBIT(4) | MBIT(5))
/** DELBA TID mask */
@ -4096,6 +4101,10 @@ typedef MLAN_PACK_START struct _HostCmd_DS_TSP_CFG {
t_s32 high_thrshld_temp;
/** TSP config LOW_THRESHOLD_TEMP */
t_s32 low_thrshld_temp;
/** TSP current throttle percentage */
t_u32 throttle_duty_cycle;
/** TSP rfu temp poll count */
t_u32 rf_temp_poll_cnt;
/** TSP CAU TSEN read value */
t_s32 reg_cau_val;
/** TSP RFU read values */

View file

@ -370,10 +370,10 @@ mlan_status wlan_allocate_adapter(pmlan_adapter pmadapter)
}
#ifdef DEBUG_LEVEL1
if (mlan_drvdbg & MMPA_D) {
pmadapter->pcard_sd->mpa_buf_size =
SDIO_MP_DBG_NUM *
pmadapter->pcard_sd->mp_aggr_pkt_limit *
pmadapter->pcard_sd->sdio_blk_size;
pmadapter->pcard_sd->mpa_buf_size = (SECURE_MULT_UINT32(
SDIO_MP_DBG_NUM,
pmadapter->pcard_sd->mp_aggr_pkt_limit,
pmadapter->pcard_sd->sdio_blk_size));
if (pmadapter->callbacks.moal_vmalloc &&
pmadapter->callbacks.moal_vfree)
ret = pmadapter->callbacks.moal_vmalloc(
@ -2073,8 +2073,8 @@ static mlan_status wlan_init_interface(pmlan_adapter pmadapter)
}
pmadapter->priv_num++;
memset(pmadapter, pmadapter->priv[i], 0,
sizeof(mlan_private));
_memset(pmadapter, pmadapter->priv[i], 0,
sizeof(mlan_private));
}
pmadapter->priv[i]->adapter = pmadapter;
@ -2113,6 +2113,11 @@ static mlan_status wlan_init_interface(pmlan_adapter pmadapter)
for (j = 0; mlan_ops[j]; j++) {
if (mlan_ops[j]->bss_role ==
GET_BSS_ROLE(pmadapter->priv[i])) {
/* coverity assumes that Passing
* pmadapter to memset, sets
* pmadapter->callbacks.moal_memcpy_ext
* to NULL
*/
// coverity[cert_exp34_c_violation:SUPPRESS]
memcpy_ext(pmadapter,
&pmadapter->priv[i]->ops,

View file

@ -2660,6 +2660,8 @@ typedef struct _mlan_debug_info {
t_u8 *evtbd_ring_vbase;
/** evtbd ring size */
t_u32 evtbd_ring_size;
/** pending tx ring buffer in firmware */
t_u16 txbd_pending;
#endif
/** Corresponds to cmdresp_received member of mlan_adapter */
t_u8 cmd_resp_received;
@ -6545,6 +6547,10 @@ typedef struct _mlan_ds_tsp_cfg {
t_s32 high_thrshld_temp;
/** TSP config LOW_THRESHOLD_TEMP */
t_s32 low_thrshld_temp;
/** TSP current throttle percentage */
t_u32 throttle_duty_cycle;
/** TSP rfu temp poll count */
t_u32 rf_temp_poll_cnt;
/** TSP CAU TSEN register */
t_s32 reg_cau_val;
/** TSP RFU registers */

View file

@ -557,7 +557,7 @@ static int wlan_cmd_append_osen_ie(mlan_private *priv, t_u8 **ppbuffer)
LEAVE();
return retlen;
}
#if defined(STA_SUPPORT)
/**
* @brief This function get the rsn_cap from RSN ie buffer.
*
@ -647,7 +647,7 @@ static t_u8 wlan_use_mfp(mlan_private *pmpriv, BSSDescriptor_t *pbss_desc)
return MFALSE;
return MTRUE;
}
#endif
/********************************************************
Global Functions
********************************************************/
@ -1306,6 +1306,7 @@ mlan_status wlan_cmd_802_11_associate(mlan_private *pmpriv,
psecurity_cfg_ie->header.type =
wlan_cpu_to_le16(TLV_TYPE_SECURITY_CFG);
#if defined(STA_SUPPORT)
pmpriv->curr_bss_params.use_mfp =
wlan_use_mfp(pmpriv, pbss_desc);
PRINTM(MCMND, "use_mfp=%d\n",
@ -1320,6 +1321,7 @@ mlan_status wlan_cmd_802_11_associate(mlan_private *pmpriv,
psecurity_cfg_ie->header.len;
psecurity_cfg_ie->header.len =
wlan_cpu_to_le16(psecurity_cfg_ie->header.len);
#endif
} else if (pmpriv->sec_info.ewpa_enabled ||
(pbss_desc->owe_transition_mode ==
OWE_TRANS_MODE_OWE) ||
@ -1854,10 +1856,9 @@ mlan_status wlan_ret_802_11_associate(mlan_private *pmpriv,
pmpriv->assoc_req_size,
ASSOC_RSP_BUF_SIZE);
// coverity[no_effect:SUPPRESS]
memset(pmpriv->adapter,
pmpriv->curr_bss_params.prev_bssid, 0,
MLAN_MAC_ADDR_LENGTH);
_memset(pmpriv->adapter,
pmpriv->curr_bss_params.prev_bssid, 0,
MLAN_MAC_ADDR_LENGTH);
}
} else
wlan_reset_connect_state(pmpriv, MTRUE);

View file

@ -244,6 +244,10 @@ extern t_u32 mlan_drvdbg;
#define memset(adapter, s, c, len) \
(adapter->callbacks.moal_memset(adapter->pmoal_handle, s, c, len))
/** Memset routine */
#define _memset(adapter, s, c, len) \
(adapter->callbacks.moal_memset(adapter->pmoal_handle, s, c, len))
#ifdef memmove
#undef memmove
#endif
@ -3035,15 +3039,15 @@ struct _mlan_adapter {
/** SCAN IOCTL request buffer pointer */
pmlan_ioctl_req pscan_ioctl_req;
/** DPD data pointer */
t_u8 *pdpd_data;
const t_u8 *pdpd_data;
/** DPD data length */
t_u32 dpd_data_len;
/** region txpowerlimit cfg data buf pointer */
t_u8 *ptxpwr_data;
const t_u8 *ptxpwr_data;
/** region txpowerlimit cfg data len */
t_u32 txpwr_data_len;
/** Cal data pointer */
t_u8 *pcal_data;
const t_u8 *pcal_data;
/** Cal data length */
t_u32 cal_data_len;
/** tdls status */
@ -4875,7 +4879,7 @@ static INLINE t_u32 wlan_strlen(const char *str)
*
* @return Non zero if chr is a hex, else 0
*/
static INLINE t_u32 wlan_isxdigit(t_u8 chr)
static INLINE t_u32 wlan_isxdigit(const t_u8 chr)
{
return (chr <= 'f' && chr >= 'a') || (chr <= 'F' && chr >= 'A') ||
(chr <= '9' && chr >= '0');

View file

@ -733,6 +733,8 @@ mlan_status wlan_get_info_debug_info(pmlan_adapter pmadapter,
pmadapter->pcard_pcie->evtbd_ring_size;
debug_info->txrx_bd_size =
pmadapter->pcard_pcie->txrx_bd_size;
debug_info->txbd_pending =
pmadapter->pcard_pcie->txbd_pending;
}
#endif
debug_info->data_sent = pmadapter->data_sent;
@ -2071,11 +2073,10 @@ void wlan_delete_iPhone_entry(mlan_private *priv, t_u8 *mac)
MLAN_MAC_ADDR_LENGTH],
mac, MLAN_MAC_ADDR_LENGTH) == 0) {
/* remove device as it is not available */
// coverity[bad_memset: SUPPRESS]
memset(priv->adapter,
(t_u8 *)&priv->adapter->llde_iphonefilters
[i * MLAN_MAC_ADDR_LENGTH],
0, MLAN_MAC_ADDR_LENGTH);
_memset(priv->adapter,
(t_u8 *)&priv->adapter->llde_iphonefilters
[i * MLAN_MAC_ADDR_LENGTH],
0, MLAN_MAC_ADDR_LENGTH);
priv->adapter->llde_totalIPhones--;
break;
}
@ -3949,10 +3950,9 @@ void wlan_add_iPhone_entry(mlan_private *priv, t_u8 *mac)
MAX_IPHONE_FILTER_ENTRIES * MLAN_MAC_ADDR_LENGTH);
/* clear original list */
// coverity[bad_memset: SUPPRESS]
memset(priv->adapter,
(t_u8 *)&priv->adapter->llde_iphonefilters, 0,
MAX_IPHONE_FILTER_ENTRIES * MLAN_MAC_ADDR_LENGTH);
_memset(priv->adapter,
(t_u8 *)&priv->adapter->llde_iphonefilters, 0,
MAX_IPHONE_FILTER_ENTRIES * MLAN_MAC_ADDR_LENGTH);
/* copy valid entries into original list */
for (i = 0, j = 1; i < MAX_IPHONE_FILTER_ENTRIES &&
@ -5509,10 +5509,8 @@ mlan_status wlan_radio_ioctl_remain_chan_cfg(pmlan_adapter pmadapter,
if (pioctl_req->action == MLAN_ACT_SET) {
if (pmpriv->adapter->remain_on_channel &&
!radio_cfg->param.remain_chan.remove) {
PRINTM(MCMND, "Ignore New Remain on channe: chan=%d\n",
PRINTM(MCMND, "Set New Remain on channe: chan=%d\n",
radio_cfg->param.remain_chan.channel);
LEAVE();
return MLAN_STATUS_SUCCESS;
}
}

View file

@ -6354,6 +6354,10 @@ static mlan_status wlan_update_nonTx_bss_desc(mlan_adapter *pmadapter,
rate_size = 0;
/* Allocate the beacon buffer for new entry */
/* The beacon_buf_size is calculated using validated inputs
* (BEACON_FIX_SIZE and ie_len), both of which are bounded and
* controlled.
*/
// coverity[overflow_sink:SUPPRESS]
ret = pcb->moal_malloc(pmadapter->pmoal_handle, beacon_buf_size,
MLAN_MEM_DEF, (t_u8 **)&pbuf);

View file

@ -531,7 +531,8 @@ static mlan_status wlan_get_rd_port(mlan_adapter *pmadapter, t_u8 *pport)
if (pmadapter->pcard_sd->mp_rd_bitmap &
(1 << pmadapter->pcard_sd->curr_rd_port)) {
pmadapter->pcard_sd->mp_rd_bitmap &=
(t_u32)(~(1 << pmadapter->pcard_sd->curr_rd_port));
~(t_u32)((t_u32)1U
<< ((t_u32)pmadapter->pcard_sd->curr_rd_port));
*pport = pmadapter->pcard_sd->curr_rd_port;
/* hw rx wraps round only after port (MAX_PORT-1) */
@ -575,7 +576,8 @@ static mlan_status wlan_get_wr_port_data(mlan_adapter *pmadapter, t_u8 *pport)
if (pmadapter->pcard_sd->mp_wr_bitmap &
(1 << pmadapter->pcard_sd->curr_wr_port)) {
pmadapter->pcard_sd->mp_wr_bitmap &=
(t_u32)(~(1 << pmadapter->pcard_sd->curr_wr_port));
~(t_u32)((t_u32)1U
<< ((t_u32)pmadapter->pcard_sd->curr_wr_port));
*pport = pmadapter->pcard_sd->curr_wr_port;
if (++pmadapter->pcard_sd->curr_wr_port ==
pmadapter->pcard_sd->mp_end_port)
@ -1827,6 +1829,7 @@ static mlan_status wlan_host_to_card_mp_aggr(mlan_adapter *pmadapter,
t_u8 aggr_sg = 0;
t_u8 mp_aggr_pkt_limit = pmadapter->pcard_sd->mp_aggr_pkt_limit;
t_bool new_mode = pmadapter->pcard_sd->supports_sdio_new_mode;
t_u8 mp_index = pmadapter->pcard_sd->last_mp_index;
ENTER();
@ -1960,14 +1963,26 @@ tx_curr_single:
[pmadapter->pcard_sd->last_mp_index *
mp_aggr_pkt_limit],
0, sizeof(t_u16) * mp_aggr_pkt_limit);
pmadapter->pcard_sd
->last_mp_wr_info[pmadapter->pcard_sd->last_mp_index *
mp_aggr_pkt_limit] =
read_u16_unaligned(pmadapter,
mbuf->pbuf + mbuf->data_offset);
pmadapter->pcard_sd
->last_curr_wr_port[pmadapter->pcard_sd->last_mp_index] =
pmadapter->pcard_sd->curr_wr_port;
/* CID 24721242: (#1 of 1): CERT-C Array (CERT ARR30-C)
* Fix for array bounds violation */
/* CID 48066770: (#1 of 1):
* Negative array index read (REVERSE_NEGATIVE) */
/* CID 48066772 48066773 48066774: (#1 of 1):
* Out-of-bounds write (OVERRUN) */
if (mp_index < SDIO_MP_DBG_NUM) {
t_u16 index = mp_index * mp_aggr_pkt_limit;
if (index <
SDIO_MP_DBG_NUM * SDIO_MP_AGGR_DEF_PKT_LIMIT_MAX)
pmadapter->pcard_sd->last_mp_wr_info[index] =
read_u16_unaligned(
pmadapter,
mbuf->pbuf + mbuf->data_offset);
pmadapter->pcard_sd->last_curr_wr_port[mp_index] =
pmadapter->pcard_sd->curr_wr_port;
}
if (pmadapter->pcard_sd->mpa_buf)
memcpy_ext(pmadapter,
pmadapter->pcard_sd->mpa_buf +
@ -3073,6 +3088,10 @@ void wlan_decode_spa_buffer(mlan_adapter *pmadapter, t_u8 *buf, t_u32 len)
break;
}
if (pkt_len > SDIO_INTF_HEADER_LEN) {
/* mbuf_deaggr is freed in moal_recv_complete(),
* therefore Overwriting mbuf_deaggr is not harmful.
*/
// coverity[overwrite_var:SUPPRESS]
mbuf_deaggr = wlan_alloc_mlan_buffer(
pmadapter, pkt_len - SDIO_INTF_HEADER_LEN,
MLAN_RX_HEADER_LEN, MOAL_ALLOC_MLAN_BUFFER);
@ -3098,6 +3117,10 @@ void wlan_decode_spa_buffer(mlan_adapter *pmadapter, t_u8 *buf, t_u32 len)
}
done:
LEAVE();
/* mbuf_deaggr is freed in moal_recv_complete(), therefore
* Overwriting mbuf_deaggr is not harmful.
*/
// coverity[overwrite_var:SUPPRESS]
return;
}

View file

@ -340,6 +340,11 @@ mlan_status mlan_register(pmlan_device pmdevice, t_void **ppmlan_adapter)
pmadapter->init_para.dmcs = pmdevice->dmcs;
pmadapter->init_para.pref_dbc = pmdevice->pref_dbc;
if (pmadapter->callbacks.moal_memcpy_ext == MNULL) {
ret = MLAN_STATUS_FAILURE;
goto error;
}
#ifdef SDIO
if (IS_SD(pmadapter->card_type)) {
PRINTM(MMSG,
@ -392,7 +397,6 @@ mlan_status mlan_register(pmlan_device pmdevice, t_void **ppmlan_adapter)
PRINTM(MMSG,
"Attach mlan adapter operations.card_type is 0x%x.\n",
pmdevice->card_type);
// coverity[cert_exp34_c_violation:SUPPRESS]
memcpy_ext(pmadapter, &pmadapter->ops, &mlan_pcie_ops,
sizeof(mlan_adapter_operations),
sizeof(mlan_adapter_operations));
@ -1371,6 +1375,8 @@ process_start:
pmadapter->wakeup_fw_timer_is_set = MFALSE;
}
} else {
if (pmadapter->driver_status)
break;
/* We have tried to wakeup the card already */
if (pmadapter->pm_wakeup_fw_try)
break;
@ -1385,7 +1391,7 @@ process_start:
(pmadapter->tx_lock_flag == MTRUE))
break;
if (pmadapter->data_sent || pmadapter->driver_status ||
if (pmadapter->data_sent ||
wlan_is_tdls_link_chan_switching(
pmadapter->tdls_status) ||
(wlan_bypass_tx_list_empty(pmadapter) &&

View file

@ -717,11 +717,8 @@ static mlan_status wlan_ret_get_log(pmlan_private pmpriv,
if (pioctl_buf) {
pget_info = (mlan_ds_get_info *)pioctl_buf->pbuf;
// coverity[bad_memset:SUPPRESS]
// coverity[too_many_arguments:SUPPRESS]
// coverity[misra_c_2012_rule_21_18_violation:SUPPRESS]
memset(pmpriv->adapter, &pget_info->param.stats, 0,
sizeof(HostCmd_DS_802_11_GET_LOG));
_memset(pmpriv->adapter, &pget_info->param.stats, 0,
sizeof(HostCmd_DS_802_11_GET_LOG));
memcpy_ext(pmpriv->adapter, (t_u8 *)&get_log_tmp,
(t_u8 *)pget_log,
((resp->size) - (sizeof(HostCmd_DS_GEN))),

View file

@ -1127,7 +1127,6 @@ mlan_status wlan_ops_sta_process_event(t_void *priv)
pmpriv, pevent, &radar_chan, &bandwidth);
/* Also send this event as passthru */
pevent->event_id = MLAN_EVENT_ID_DRV_PASSTHRU;
pevent->event_len = pmbuf->data_len;
// Ensure event_len does not exceed buffer size
pevent->event_len = MIN(pmbuf->data_len, MAX_EVENT_SIZE);
memcpy_ext(pmadapter, (t_u8 *)pevent->event_buf,
@ -1400,7 +1399,7 @@ mlan_status wlan_ops_sta_process_event(t_void *priv)
PRINTM(MINFO, "EVENT: Dump FW info\n");
if (pmadapter->cmd_timer_is_set) {
pcb->moal_stop_timer(pmadapter->pmoal_handle,
pmadapter->pmlan_cmd_timer);
pmadapter->pmlan_cmd_timer);
/* Cancel command timeout timer */
pmadapter->cmd_timer_is_set = MFALSE;
}

View file

@ -3915,10 +3915,12 @@ static mlan_status wlan_misc_ioctl_sdio_mpa_ctrl(pmlan_adapter pmadapter,
pmadapter->pcard_sd->mpa_tx
.buf_size = MIN(
mpa_ctrl->tx_buf_size,
pmadapter->pcard_sd
->max_blk_count *
(SECURE_MULT_UINT32(
1,
pmadapter->pcard_sd
->sdio_blk_size);
->max_blk_count,
pmadapter->pcard_sd
->sdio_blk_size)));
}
if (mpa_ctrl->rx_buf_size > 0)
pmadapter->pcard_sd->mpa_rx.buf_size =

View file

@ -537,7 +537,6 @@ mlan_status wlan_process_rx_packet(pmlan_adapter pmadapter, pmlan_buffer pmbuf)
ret = MLAN_STATUS_FAILURE;
goto done;
}
hdr_chop = (t_u16)((t_ptr)peth_hdr - (t_ptr)prx_pd);
} else {
HEXDUMP("RX Data: LLC/SNAP", (t_u8 *)&prx_pkt->rfc1042_hdr,

View file

@ -103,8 +103,7 @@ t_void *wlan_ops_sta_process_txpd(t_void *priv, pmlan_buffer pmbuf)
// coverity[misra_c_2012_rule_10_8_violation:SUPPRESS]
head_ptr = (t_u8 *)((t_ptr)head_ptr & ~((t_ptr)(DMA_ALIGNMENT - 1)));
plocal_tx_pd = (TxPD *)(head_ptr + pmpriv->intf_hr_len);
// coverity[bad_memset:SUPPRESS]
memset(pmadapter, plocal_tx_pd, 0, Tx_PD_SIZEOF(pmadapter));
_memset(pmadapter, plocal_tx_pd, 0, Tx_PD_SIZEOF(pmadapter));
/* Set the BSS number to TxPD */
plocal_tx_pd->bss_num = GET_BSS_NUM(pmpriv);
plocal_tx_pd->bss_type = pmpriv->bss_type;
@ -296,6 +295,7 @@ mlan_status wlan_send_null_packet(pmlan_private priv, t_u8 flags)
ptx_pd->bss_type = priv->bss_type;
endian_convert_TxPD(ptx_pd);
/* Here pmadapter->ops.host_to_card is not a null pointer. */
// coverity[cert_exp34_c_violation:SUPPRESS]
ret = pmadapter->ops.host_to_card(priv, MLAN_TYPE_DATA, pmbuf, MNULL);

View file

@ -3353,6 +3353,11 @@ static mlan_status wlan_uap_ret_snmp_mib(pmlan_private pmpriv,
tlv_type = wlan_le16_to_cpu(
read_u16_unaligned(pmadapter, psnmp_oid));
psnmp_oid += sizeof(t_u16) + sizeof(t_u16);
/* The memcpy_ext() call copies a fixed number of bytes
* (sizeof(t_u32)) from a buffer (psnmp_oid) that is
* validated to have sufficient remaining length before
* the copy.
*/
// coverity[cert_arr30_c_violation:SUPPRESS]
// coverity[overrun:SUPPRESS]
// coverity[cert_str31_c_violation:SUPPRESS]
@ -3493,11 +3498,8 @@ static mlan_status wlan_uap_ret_get_log(pmlan_private pmpriv,
if (pioctl_buf) {
pget_info = (mlan_ds_get_info *)pioctl_buf->pbuf;
// coverity[bad_memset:SUPPRESS]
// coverity[too_many_arguments:SUPPRESS]
// coverity[misra_c_2012_rule_21_18_violation:SUPPRESS]
memset(pmpriv->adapter, &pget_info->param.stats, 0,
sizeof(HostCmd_DS_802_11_GET_LOG));
_memset(pmpriv->adapter, &pget_info->param.stats, 0,
sizeof(HostCmd_DS_802_11_GET_LOG));
memcpy_ext(pmpriv->adapter, (t_u8 *)&get_log_tmp,
(t_u8 *)pget_log,
((resp->size) - (sizeof(HostCmd_DS_GEN))),
@ -6935,6 +6937,9 @@ mlan_status wlan_ops_uap_process_event(t_void *priv)
memcpy_ext(pmadapter, (t_u8 *)pevent->event_buf,
pmbuf->pbuf + pmbuf->data_offset, pevent->event_len,
pevent->event_len);
/* The buffer pevent->event_buf is populated using memcpy_ext
* with a known bounded length.
*/
// coverity[cert_str32_c_violation:SUPPRESS]
wlan_recv_event(pmpriv, pevent->event_id, pevent);
}

View file

@ -2035,7 +2035,7 @@ static mlan_status wlan_uap_snmp_mib_chan_track(pmlan_adapter pmadapter,
* @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE
*/
static mlan_status wlan_uap_agcs_cfg(pmlan_adapter pmadapter,
pmlan_ioctl_req pioctl_req)
pmlan_ioctl_req pioctl_req)
{
mlan_private *pmpriv = pmadapter->priv[pioctl_req->bss_index];
mlan_status ret = MLAN_STATUS_SUCCESS;

View file

@ -165,8 +165,8 @@ t_void *wlan_ops_uap_process_txpd(t_void *priv, pmlan_buffer pmbuf)
// coverity[misra_c_2012_rule_10_8_violation:SUPPRESS]
head_ptr = (t_u8 *)((t_ptr)head_ptr & ~((t_ptr)(DMA_ALIGNMENT - 1)));
plocal_tx_pd = (TxPD *)(head_ptr + pmpriv->intf_hr_len);
// coverity[bad_memset:SUPPRESS]
memset(pmpriv->adapter, plocal_tx_pd, 0, Tx_PD_SIZEOF(pmpriv->adapter));
_memset(pmpriv->adapter, plocal_tx_pd, 0,
Tx_PD_SIZEOF(pmpriv->adapter));
/* Set the BSS number to TxPD */
plocal_tx_pd->bss_num = GET_BSS_NUM(pmpriv);

View file

@ -219,7 +219,6 @@ static mlan_status wlan_usb_prog_fw_w_helper(pmlan_adapter pmadapter,
#if defined(USB9098)
t_u32 revision_id = 0;
#endif
t_u32 i = 0;
t_u32 fw_data_param = pmadapter->init_para.fw_data_cfg;
fw_data_t fw_data_list[MAX_FW_DATA_BLOCK] = {0};
t_u32 fw_data_param_num = 0, fw_data_index = 0;
@ -290,8 +289,9 @@ static mlan_status wlan_usb_prog_fw_w_helper(pmlan_adapter pmadapter,
sizeof(FWHeader));
DataLength = 0;
} else {
/* Copy the header of the firmware data to get the
* length */
/* reset length and Copy the header of the firmware data
* to get the length */
fwdata->fw_header.data_length = 0;
if (firmware)
memcpy_ext(pmadapter, &fwdata->fw_header,
&firmware[TotalBytes],
@ -441,16 +441,16 @@ static mlan_status wlan_usb_prog_fw_w_helper(pmlan_adapter pmadapter,
PRINTM(MINFO, ".\n");
if (fw_data_param) {
for (i = fw_data_index; i < fw_data_param_num;) {
firmware = fw_data_list[i].fw_data_buffer;
if (fw_data_index < fw_data_param_num) {
firmware = fw_data_list[fw_data_index]
.fw_data_buffer;
/** make TotalBytes as 0 as allocated custom Fw
* data buffers are not contiguous */
TotalBytes = 0;
fw_data_index++;
break;
}
/** custom Fw data download complete, restore Fw */
if (i >= fw_data_param_num) {
if (fw_data_index >= fw_data_param_num) {
firmware = pmfw->pfw_buf;
fw_data_param = 0;
fw_data_index = 0;
@ -906,7 +906,7 @@ mlan_status wlan_usb_deaggr_rx_pkt(pmlan_adapter pmadapter, pmlan_buffer pmbuf)
RxPD *prx_pd;
t_u8 *pdata;
t_s32 aggr_len;
pmlan_buffer pdeaggr_buf;
pmlan_buffer pdeaggr_buf = MNULL;
t_u16 max_loop_cnt = 0;
/* (8 * (MLAN_USB_BLOCK_SIZE * 4)) */
#define MAX_USB_RX_DATA_SIZE (MLAN_USB_RX_MAX_AGGR_NUM * MLAN_USB_MAX_PKT_SIZE)
@ -944,6 +944,10 @@ mlan_status wlan_usb_deaggr_rx_pkt(pmlan_adapter pmadapter, pmlan_buffer pmbuf)
/* make new buffer and copy packet to it (including RxPD).
* Also, reserve headroom so that there must have space
* to change RxPD to TxPD for bridge packet in uAP mode */
/* pdeaggr_buf is freed in moal_recv_complete(), therefore
* Overwriting pdeaggr_buf is not harmful.
*/
// coverity[overwrite_var:SUPPRESS]
pdeaggr_buf = wlan_alloc_mlan_buffer(pmadapter, curr_pkt_len,
MLAN_RX_HEADER_LEN,
MOAL_ALLOC_MLAN_BUFFER);
@ -962,7 +966,11 @@ mlan_status wlan_usb_deaggr_rx_pkt(pmlan_adapter pmadapter, pmlan_buffer pmbuf)
memcpy_ext(pmadapter,
pdeaggr_buf->pbuf + pdeaggr_buf->data_offset, pdata,
curr_pkt_len, pdeaggr_buf->data_len);
/* Deaggr buffer is freed in moal_recv_complete() after rx data
* handling completed, Coverity is not able to trace callbacks
* registered for and process_rx_packet and moal_recv_complete
*/
// coverity[RESOURCE_LEAK]: SUPPRESS
/* send new packet to processing */
ret = wlan_handle_rx_packet(pmadapter, pdeaggr_buf);
if (ret == MLAN_STATUS_FAILURE) {
@ -999,6 +1007,8 @@ mlan_status wlan_usb_deaggr_rx_pkt(pmlan_adapter pmadapter, pmlan_buffer pmbuf)
pmadapter->callbacks.moal_recv_complete(pmadapter->pmoal_handle, pmbuf,
pmadapter->rx_data_ep, ret);
LEAVE();
/* pdeaggr_buf is freed in moal_recv_complete() */
// coverity[leaked_storage:SUPPRESS]
return ret;
}

View file

@ -656,6 +656,7 @@ static INLINE t_bool util_is_time_before(t_u64 t1, t_u64 t2)
{
t_s64 delta = t2 - t1;
/* The subtraction is safe */
// coverity[integer_overflow:SUPPRESS]
return delta > 0;
}

View file

@ -1543,6 +1543,8 @@ static raListTbl *wlan_wmm_get_next_priolist_ptr(pmlan_adapter pmadapter,
}
pmadapter->selected_mlan_bss = MNULL;
/* priv_num is checked earlier in the function to ensure it is non-zero.
*/
// coverity[cert_arr30_c_violation:SUPPRESS]
return wlan_wmm_get_highest_priolist_ptr(pmadapter, priv, tid);
}
@ -2620,6 +2622,8 @@ void wlan_ralist_add(mlan_private *priv, t_u8 *ra)
}
LEAVE();
// allocated ra_list is enqueued and managed via
// wmm.tid_tbl_ptr[i].ra_list, freed during cleanup
// coverity[leaked_storage:SUPPRESS]
}
@ -5189,7 +5193,9 @@ static t_u32 wlam_wmm_get_vht_rate(t_u32 bw, t_u32 sgi, t_u32 nss, t_u32 mcs)
}
rate = rate * nss;
/* The maximum possible value of rate after all operations
* remains within the bounds of a 32-bit unsigned integer.
*/
// coverity[integer_overflow:SUPPRESS]
return rate;
}
@ -5246,7 +5252,9 @@ static t_u32 wlam_wmm_get_ht_rate(t_u32 bw, t_u32 sgi, t_u32 mcs)
if (bw == bw_40) {
rate = (rate * 2077u) / 1000;
}
/* The maximum possible value of rate after all operations
* remains within the bounds of a 32-bit unsigned integer.
*/
// coverity[integer_overflow:SUPPRESS]
return rate;
}

View file

@ -3,7 +3,7 @@
* @brief This file contains IOCTL error code ID definitions.
*
*
* Copyright 2024 NXP
* Copyright 2024-2025 NXP
*
* This software file (the File) is distributed by NXP
* under the terms of the GNU General Public License Version 2, June 1991

View file

@ -614,6 +614,7 @@ typedef enum {
/** BIT value */
#define MBIT(x) (((t_u32)1) << (x))
#define MBIT64(x) (1ULL << (x))
/** Buffer flag for requeued packet */
#define MLAN_BUF_FLAG_REQUEUED_PKT MBIT(0)
@ -1010,15 +1011,15 @@ typedef MLAN_PACK_START struct _MrvlIEtypes_Data_t {
/** Custom data structure */
typedef struct _mlan_init_param {
/** DPD data buffer pointer */
t_u8 *pdpd_data_buf;
const t_u8 *pdpd_data_buf;
/** DPD data length */
t_u32 dpd_data_len;
/** region txpowerlimit cfg data buffer pointer */
t_u8 *ptxpwr_data_buf;
const t_u8 *ptxpwr_data_buf;
/** region txpowerlimit cfg data length */
t_u32 txpwr_data_len;
/** Cal data buffer pointer */
t_u8 *pcal_data_buf;
const t_u8 *pcal_data_buf;
/** Cal data length */
t_u32 cal_data_len;
/** Other custom data */
@ -1351,6 +1352,7 @@ typedef MLAN_PACK_START struct _radiotap_timestamp {
* 1 microseconds,
* 2 nanoseconds,
* 3-15 reserved */
// bit-field usage is required to match protocol-defined layout
// coverity[misra_c_2012_rule_6_1_violation:SUPPRESS]
t_u8 unit : 4;
/* position:
@ -1361,6 +1363,7 @@ typedef MLAN_PACK_START struct _radiotap_timestamp {
* 4-14 reserved
* 15 unknown or vendor/OOB defined
*/
// bit-field usage is required to match protocol-defined layout
// coverity[misra_c_2012_rule_6_1_violation:SUPPRESS]
t_u8 position : 4;
/* flags

View file

@ -2660,6 +2660,8 @@ typedef struct _mlan_debug_info {
t_u8 *evtbd_ring_vbase;
/** evtbd ring size */
t_u32 evtbd_ring_size;
/** pending tx ring buffer in firmware */
t_u16 txbd_pending;
#endif
/** Corresponds to cmdresp_received member of mlan_adapter */
t_u8 cmd_resp_received;
@ -6545,6 +6547,10 @@ typedef struct _mlan_ds_tsp_cfg {
t_s32 high_thrshld_temp;
/** TSP config LOW_THRESHOLD_TEMP */
t_s32 low_thrshld_temp;
/** TSP current throttle percentage */
t_u32 throttle_duty_cycle;
/** TSP rfu temp poll count */
t_u32 rf_temp_poll_cnt;
/** TSP CAU TSEN register */
t_s32 reg_cau_val;
/** TSP RFU registers */

View file

@ -3092,6 +3092,9 @@ static int woal_mgmt_tx(moal_private *priv, const u8 *buf, size_t len,
goto done;
}
if (!new_ie_len) {
/* The moal_memcpy_ext call uses a pre-validated buffer with
* tracked remain_len, ensuring no overflow.
*/
// coverity[overrun:SUPPRESS]
moal_memcpy_ext(priv->phandle,
pbuf + HEADER_SIZE + sizeof(packet_len) +
@ -3100,6 +3103,9 @@ static int woal_mgmt_tx(moal_private *priv, const u8 *buf, size_t len,
remain_len);
} else {
/* new IEs post cleanup of 11ax IEs received from kernel */
/* The moal_memcpy_ext call uses a pre-validated buffer with
* tracked remain_len, ensuring no overflow.
*/
// coverity[overrun:SUPPRESS]
// coverity[cert_arr30_c_violation: SUPPRESS]
moal_memcpy_ext(priv->phandle,
@ -3863,6 +3869,13 @@ int woal_cfg80211_set_qos_map(struct wiphy *wiphy, struct net_device *dev,
/**clear dscp map*/
if (!qos_map) {
memset(priv->dscp_map, 0xFF, sizeof(priv->dscp_map));
#if defined(STA_CFG80211) || defined(UAP_CFG80211)
if (priv->qos_map) {
kfree(priv->qos_map);
priv->qos_map = NULL;
}
#endif
goto done;
}
@ -3925,6 +3938,25 @@ int woal_cfg80211_set_qos_map(struct wiphy *wiphy, struct net_device *dev,
PRINTM(MERROR, "Failed to set beacon wps/p2p ie\n");
goto done;
}
#if defined(STA_CFG80211) || defined(UAP_CFG80211)
if (!priv->qos_map) {
priv->qos_map = kzalloc(sizeof(struct cfg80211_qos_map),
GFP_KERNEL);
if (!priv->qos_map) {
PRINTM(MERROR,
"Set QoS MAP: Failed to alloc memory\n");
LEAVE();
return ret;
}
}
moal_memcpy_ext(priv->phandle, priv->qos_map, qos_map,
sizeof(struct cfg80211_qos_map),
sizeof(struct cfg80211_qos_map));
DBG_HEXDUMP(MCMD_D, "AP: QoS Map", (t_u8 *)priv->qos_map,
sizeof(struct cfg80211_qos_map));
#endif
}
done:
@ -5968,6 +6000,8 @@ void woal_cfg80211_notify_antcfg(moal_private *priv, struct wiphy *wiphy,
mcs_nss[1] = mcs_nss[0] |= 0x0c;
moal_memcpy_ext(
priv->phandle,
/* This cast is safe and
intentional. */
// coverity[misra_c_2012_rule_11_8_violation:SUPPRESS]
(t_void *)&bands->iftype_data
->he_cap.he_mcs_nss_supp
@ -5998,6 +6032,8 @@ void woal_cfg80211_notify_antcfg(moal_private *priv, struct wiphy *wiphy,
moal_memcpy_ext(
priv->phandle,
/* This cast is safe and
intentional. */
// coverity[misra_c_2012_rule_11_8_violation:SUPPRESS]
(t_void *)&bands->iftype_data
->he_cap.he_mcs_nss_supp
@ -6046,6 +6082,8 @@ void woal_cfg80211_notify_antcfg(moal_private *priv, struct wiphy *wiphy,
mcs_nss[1] = mcs_nss[0] |= 0x0c;
moal_memcpy_ext(
priv->phandle,
/* This cast is safe and
intentional. */
// coverity[misra_c_2012_rule_11_8_violation:SUPPRESS]
(t_void *)&bands->iftype_data
->he_cap.he_mcs_nss_supp
@ -6088,6 +6126,8 @@ void woal_cfg80211_notify_antcfg(moal_private *priv, struct wiphy *wiphy,
moal_memcpy_ext(
priv->phandle,
/* This cast is safe and
intentional. */
// coverity[misra_c_2012_rule_11_8_violation:SUPPRESS]
(t_void *)&bands->iftype_data
->he_cap.he_mcs_nss_supp

View file

@ -222,6 +222,14 @@ static const struct nla_policy
};
#endif
static const struct nla_policy
woal_usable_channel_policy[ATTR_USABLE_CHANNEL_MAX + 1] = {
[ATTR_USABLE_CHANNEL_BAND] = {.type = NLA_U32},
[ATTR_USABLE_CHANNEL_IFACE_MODE] = {.type = NLA_U32},
[ATTR_USABLE_CHANNEL_FILTER] = {.type = NLA_U32},
[ATTR_USABLE_CHANNEL_MAX_SIZE] = {.type = NLA_U32},
};
/**
* @brief get the event id of the events array
*
@ -1898,8 +1906,7 @@ static int woal_deinit_ring_buffer(moal_private *priv)
ring_buff->interval = 0;
}
spin_unlock_irqrestore(&ring_buff->lock, lock_flags);
if (ring_state == RING_ACTIVE)
cancel_delayed_work_sync(&ring_buff->work);
cancel_delayed_work_sync(&ring_buff->work);
vfree(ring_buff->ring_buf);
ring_buff->ring_buf = NULL;
vfree(ring_buff);
@ -7432,6 +7439,511 @@ done:
LEAVE();
return ret;
}
/**
* @brief Vendor cmd to trigger btwt_ap_config_set cmd.
* It sets the current uAP BTWT config sets.
*
* @param wiphy A pointer to wiphy struct
* @param wdev A pointer to wireless_dev struct
* @param data a pointer to data
* @param len data length
*
* @return 0: success -1: fail
*/
// Declaration with identifier \"woal_cfg80211_subcmd_btwt_ap_config_set\",
// which is ambiguous. coverity[misra_c_2012_rule_5_2_violation:SUPPRESS]
static int woal_cfg80211_subcmd_btwt_ap_config_set(struct wiphy *wiphy,
struct wireless_dev *wdev,
const void *data, int len)
{
struct net_device *dev = wdev->netdev;
moal_private *priv = (moal_private *)woal_get_netdev_priv(dev);
mlan_ds_twtcfg *btwt_ap_config_cfg = NULL;
mlan_ioctl_req *req = NULL;
struct sk_buff *skb = NULL;
mlan_status status = MLAN_STATUS_SUCCESS;
t_s32 ret = 0;
t_u8 *data_buff = NULL;
char *strBuffer = NULL;
t_u32 strBuff_len = 0;
t_u8 ap_bcast_bet_sta_wait, bcastTWTLI, count, btwtId[5],
Ap_Bcast_Exponent[5], nominalwake[5];
t_u16 Ap_Bcast_Offset, Ap_Bcast_Mantissa[5];
t_u8 i;
ENTER();
if ((len < 1) || (len + 1) < 0) {
PRINTM(MERROR,
"vendor cmd: btwt_ap_config_set - Invalid data length!\n");
ret = -EINVAL;
goto done;
}
data_buff = (t_u8 *)kzalloc(len + 1, GFP_ATOMIC);
if (data_buff == NULL) {
ret = -ENOMEM;
goto done;
}
memset((char *)data_buff, 0, len + 1);
moal_memcpy_ext(priv->phandle, data_buff, data, len, len);
strBuffer = (char *)kzalloc(len + 1, GFP_ATOMIC);
if (strBuffer == NULL) {
ret = -ENOMEM;
goto done;
}
// Convert ascii data into string buffer
asciiToString(data_buff, len, strBuffer, &strBuff_len);
ap_bcast_bet_sta_wait = (t_u8)extractNumericVal(
strBuffer, strBuff_len,
"ap_bcast_bet_sta_wait=", sizeof("ap_bcast_bet_sta_wait="));
Ap_Bcast_Offset = (t_u16)extractNumericVal(
strBuffer, strBuff_len,
"Ap_Bcast_Offset=", sizeof("Ap_Bcast_Offset="));
bcastTWTLI = (t_u8)extractNumericVal(
strBuffer, strBuff_len, "bcastTWTLI=", sizeof("bcastTWTLI="));
count = (t_u8)extractNumericVal(strBuffer, strBuff_len,
"count=", sizeof("count="));
btwtId[0] = (t_u8)extractNumericVal(strBuffer, strBuff_len,
"btwtId0=", sizeof("btwtId0="));
Ap_Bcast_Mantissa[0] = (t_u16)extractNumericVal(
strBuffer, strBuff_len,
"Ap_Bcast_Mantissa0=", sizeof("Ap_Bcast_Mantissa0="));
Ap_Bcast_Exponent[0] = (t_u8)extractNumericVal(
strBuffer, strBuff_len,
"Ap_Bcast_Exponent0=", sizeof("Ap_Bcast_Exponent0="));
nominalwake[0] = (t_u8)extractNumericVal(
strBuffer, strBuff_len,
"nominalwake0=", sizeof("nominalwake0="));
btwtId[1] = (t_u8)extractNumericVal(strBuffer, strBuff_len,
"btwtId1=", sizeof("btwtId1="));
Ap_Bcast_Mantissa[1] = (t_u16)extractNumericVal(
strBuffer, strBuff_len,
"Ap_Bcast_Mantissa1=", sizeof("Ap_Bcast_Mantissa1="));
Ap_Bcast_Exponent[1] = (t_u8)extractNumericVal(
strBuffer, strBuff_len,
"Ap_Bcast_Exponent1=", sizeof("Ap_Bcast_Exponent1="));
nominalwake[1] = (t_u8)extractNumericVal(
strBuffer, strBuff_len,
"nominalwake1=", sizeof("nominalwake1="));
btwtId[2] = (t_u8)extractNumericVal(strBuffer, strBuff_len,
"btwtId2=", sizeof("btwtId2="));
Ap_Bcast_Mantissa[2] = (t_u16)extractNumericVal(
strBuffer, strBuff_len,
"Ap_Bcast_Mantissa2=", sizeof("Ap_Bcast_Mantissa2="));
Ap_Bcast_Exponent[2] = (t_u8)extractNumericVal(
strBuffer, strBuff_len,
"Ap_Bcast_Exponent2=", sizeof("Ap_Bcast_Exponent2="));
nominalwake[2] = (t_u8)extractNumericVal(
strBuffer, strBuff_len,
"nominalwake2=", sizeof("nominalwake2="));
btwtId[3] = (t_u8)extractNumericVal(strBuffer, strBuff_len,
"btwtId3=", sizeof("btwtId3="));
Ap_Bcast_Mantissa[3] = (t_u16)extractNumericVal(
strBuffer, strBuff_len,
"Ap_Bcast_Mantissa3=", sizeof("Ap_Bcast_Mantissa3="));
Ap_Bcast_Exponent[3] = (t_u8)extractNumericVal(
strBuffer, strBuff_len,
"Ap_Bcast_Exponent3=", sizeof("Ap_Bcast_Exponent3="));
nominalwake[3] = (t_u8)extractNumericVal(
strBuffer, strBuff_len,
"nominalwake3=", sizeof("nominalwake3="));
btwtId[4] = (t_u8)extractNumericVal(strBuffer, strBuff_len,
"btwtId4=", sizeof("btwtId4="));
Ap_Bcast_Mantissa[4] = (t_u16)extractNumericVal(
strBuffer, strBuff_len,
"Ap_Bcast_Mantissa4=", sizeof("Ap_Bcast_Mantissa4="));
Ap_Bcast_Exponent[4] = (t_u8)extractNumericVal(
strBuffer, strBuff_len,
"Ap_Bcast_Exponent4=", sizeof("Ap_Bcast_Exponent4="));
nominalwake[4] = (t_u8)extractNumericVal(
strBuffer, strBuff_len,
"nominalwake4=", sizeof("nominalwake4="));
/* Allocate an IOCTL request buffer */
req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_twtcfg));
if (req == NULL) {
PRINTM(MERROR,
"vendor cmd: Could not allocate mlan ioctl request, btwt_ap_config_set!\n");
ret = -ENOMEM;
goto done;
}
/* Fill request buffer */
btwt_ap_config_cfg = (mlan_ds_twtcfg *)req->pbuf;
btwt_ap_config_cfg->sub_command = MLAN_OID_11AX_TWT_CFG;
btwt_ap_config_cfg->sub_id = MLAN_11AX_BTWT_AP_CONFIG_SUBID;
req->req_id = MLAN_IOCTL_11AX_CFG;
req->action = MLAN_ACT_SET;
btwt_ap_config_cfg->param.btwt_ap_config.ap_bcast_bet_sta_wait =
ap_bcast_bet_sta_wait;
btwt_ap_config_cfg->param.btwt_ap_config.Ap_Bcast_Offset =
Ap_Bcast_Offset;
btwt_ap_config_cfg->param.btwt_ap_config.bcastTWTLI = bcastTWTLI;
btwt_ap_config_cfg->param.btwt_ap_config.count = count;
for (i = 0; i < 5; i++) {
btwt_ap_config_cfg->param.btwt_ap_config.BTWT_sets[i].btwtId =
btwtId[i];
btwt_ap_config_cfg->param.btwt_ap_config.BTWT_sets[i]
.Ap_Bcast_Mantissa = Ap_Bcast_Mantissa[i];
btwt_ap_config_cfg->param.btwt_ap_config.BTWT_sets[i]
.Ap_Bcast_Exponent = Ap_Bcast_Exponent[i];
btwt_ap_config_cfg->param.btwt_ap_config.BTWT_sets[i]
.nominalwake = nominalwake[i];
}
status = woal_request_ioctl(priv, req, MOAL_IOCTL_WAIT);
if (status != MLAN_STATUS_SUCCESS) {
PRINTM(MERROR,
"vendor cmd: BTWT AP Config SET ioctl failed!\n");
ret = -EFAULT;
goto done;
}
/* Allocate skb for cmd reply*/
skb = cfg80211_vendor_cmd_alloc_reply_skb(
wiphy, sizeof(mlan_ds_btwt_ap_config));
if (!skb) {
PRINTM(MERROR,
"vendor cmd: allocate memory fail for vendor cmd\n");
ret = -ENOMEM;
goto done;
}
ret = cfg80211_vendor_cmd_reply(skb);
if (unlikely(ret))
PRINTM(MERROR, "vendor cmd: reply failed with ret:%d \n", ret);
done:
if (data_buff)
kfree(data_buff);
if (strBuffer)
kfree(strBuffer);
if (status != MLAN_STATUS_PENDING && req)
kfree(req);
LEAVE();
return ret;
}
/**
* @brief Vendor cmd to trigger btwt_ap_config_get cmd.
* It gets the current uAP BTWT config sets.
*
* @param wiphy A pointer to wiphy struct
* @param wdev A pointer to wireless_dev struct
* @param data a pointer to data
* @param len data length
*
* @return 0: success -1: fail
*/
static int woal_cfg80211_subcmd_btwt_ap_config_get(struct wiphy *wiphy,
struct wireless_dev *wdev,
const void *data, int len)
{
struct net_device *dev = wdev->netdev;
moal_private *priv = (moal_private *)woal_get_netdev_priv(dev);
mlan_ds_twtcfg *btwt_ap_config_cfg = NULL;
mlan_ioctl_req *req = NULL;
struct sk_buff *skb = NULL;
mlan_status status = MLAN_STATUS_SUCCESS;
t_s32 ret = 0;
t_u8 *data_buff = NULL;
char *strBuffer = NULL;
t_u32 strBuff_len = 0;
t_u8 ap_bcast_bet_sta_wait, bcastTWTLI, count;
t_u16 Ap_Bcast_Offset;
ENTER();
if ((len < 1) || (len + 1) < 0) {
PRINTM(MERROR,
"vendor cmd: btwt_ap_config_get - Invalid data length!\n");
ret = -EINVAL;
goto done;
}
data_buff = (t_u8 *)kzalloc(len + 1, GFP_ATOMIC);
if (data_buff == NULL) {
ret = -ENOMEM;
goto done;
}
memset((char *)data_buff, 0, len + 1);
moal_memcpy_ext(priv->phandle, data_buff, data, len, len);
strBuffer = (char *)kzalloc(len + 1, GFP_ATOMIC);
if (strBuffer == NULL) {
ret = -ENOMEM;
goto done;
}
// Convert ascii data into string buffer.
asciiToString(data_buff, len, strBuffer, &strBuff_len);
ap_bcast_bet_sta_wait = (t_u8)extractNumericVal(
strBuffer, strBuff_len,
"ap_bcast_bet_sta_wait=", sizeof("ap_bcast_bet_sta_wait="));
Ap_Bcast_Offset = (t_u16)extractNumericVal(
strBuffer, strBuff_len,
"Ap_Bcast_Offset=", sizeof("Ap_Bcast_Offset="));
bcastTWTLI = (t_u8)extractNumericVal(
strBuffer, strBuff_len, "bcastTWTLI=", sizeof("bcastTWTLI="));
count = (t_u8)extractNumericVal(strBuffer, strBuff_len,
"count=", sizeof("count="));
/* Allocate an IOCTL request buffer */
req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_twtcfg));
if (req == NULL) {
PRINTM(MERROR,
"vendor cmd: Could not allocate mlan ioctl request, btwt_ap_config_get!\n");
ret = -ENOMEM;
goto done;
}
/* Fill request buffer */
btwt_ap_config_cfg = (mlan_ds_twtcfg *)req->pbuf;
btwt_ap_config_cfg->sub_command = MLAN_OID_11AX_TWT_CFG;
btwt_ap_config_cfg->sub_id = MLAN_11AX_BTWT_AP_CONFIG_SUBID;
req->req_id = MLAN_IOCTL_11AX_CFG;
req->action = MLAN_ACT_GET;
btwt_ap_config_cfg->param.btwt_ap_config.ap_bcast_bet_sta_wait =
ap_bcast_bet_sta_wait;
btwt_ap_config_cfg->param.btwt_ap_config.Ap_Bcast_Offset =
Ap_Bcast_Offset;
btwt_ap_config_cfg->param.btwt_ap_config.bcastTWTLI = bcastTWTLI;
btwt_ap_config_cfg->param.btwt_ap_config.count = count;
status = woal_request_ioctl(priv, req, MOAL_IOCTL_WAIT);
if (status != MLAN_STATUS_SUCCESS) {
PRINTM(MERROR,
"vendor cmd: BTWT AP CONFIG GET ioctl failed!\n");
ret = -EFAULT;
goto done;
}
/* Allocate skb for cmd reply*/
skb = cfg80211_vendor_cmd_alloc_reply_skb(
wiphy, sizeof(mlan_ds_btwt_ap_config));
if (!skb) {
PRINTM(MERROR,
"vendor cmd: allocate memory fail for vendor cmd\n");
ret = -ENOMEM;
goto done;
}
ret = cfg80211_vendor_cmd_reply(skb);
if (unlikely(ret))
PRINTM(MERROR, "vendor cmd: reply failed with ret:%d \n", ret);
done:
if (data_buff)
kfree(data_buff);
if (strBuffer)
kfree(strBuffer);
if (status != MLAN_STATUS_PENDING && req)
kfree(req);
LEAVE();
return ret;
}
/**
* @brief Request list of usable channels for requested bands and modes.
* Usable implies channel is allowed as per regulatory for current
* country code and not restricted due to other hard limitations.
* This allows driver to return list of usable channels for each
* mode(STA, AP, P2P-go etc) uniquely to distinguish cases where
* only limited set of modes are allowed on a given channel.
*
* @param wiphy A pointer to wiphy struct
* @param wdev A pointer to wireless_dev struct
*
* @param data a pointer to data
* @param data_len data length
*
* @return 0: success other: fail
*/
static int woal_cfg80211_subcmd_get_usable_channels(struct wiphy *wiphy,
struct wireless_dev *wdev,
const void *data, int len)
{
struct net_device *dev = wdev->netdev;
moal_private *priv = (moal_private *)woal_get_netdev_priv(dev);
struct nlattr *tb[ATTR_WIFI_MAX + 1];
t_u32 band = 0, iface_mode, filter, max_size, size;
t_u8 cnt = 0, i, j;
t_u32 mem_needed = 0;
struct ieee80211_supported_band *sband;
struct ieee80211_channel *ch;
struct sk_buff *skb = NULL;
int err = 0;
wifi_usable_channel *channels = NULL;
ENTER();
err = nla_parse(tb, ATTR_USABLE_CHANNEL_MAX, data, len, NULL
#if KERNEL_VERSION(4, 12, 0) <= CFG80211_VERSION_CODE
,
NULL
#endif
);
if (err) {
PRINTM(MERROR, "%s: nla_parse fail\n", __func__);
err = -EFAULT;
goto done;
}
if (!tb[ATTR_USABLE_CHANNEL_BAND]) {
PRINTM(MERROR,
"%s: null attr: tb[ATTR_USABLE_CHANNEL_BAND]=%p\n",
__func__, tb[ATTR_USABLE_CHANNEL_BAND]);
err = -EINVAL;
goto done;
}
band = nla_get_u32(tb[ATTR_USABLE_CHANNEL_BAND]);
if (!tb[ATTR_USABLE_CHANNEL_IFACE_MODE]) {
PRINTM(MERROR,
"%s: null attr: tb[ATTR_USABLE_CHANNEL_IFACE_MODE]=%p\n",
__func__, tb[ATTR_USABLE_CHANNEL_IFACE_MODE]);
err = -EINVAL;
goto done;
}
iface_mode = nla_get_u32(tb[ATTR_USABLE_CHANNEL_IFACE_MODE]);
if (!tb[ATTR_USABLE_CHANNEL_FILTER]) {
PRINTM(MERROR,
"%s: null attr: tb[ATTR_USABLE_CHANNEL_FILTER]=%p\n",
__func__, tb[ATTR_USABLE_CHANNEL_FILTER]);
err = -EINVAL;
goto done;
}
filter = nla_get_u32(tb[ATTR_USABLE_CHANNEL_FILTER]);
if (!tb[ATTR_USABLE_CHANNEL_MAX_SIZE]) {
PRINTM(MERROR, "%s: null attr: tb[ATTR_USABLE_MAX_SIZE]=%p\n",
__func__, tb[ATTR_USABLE_CHANNEL_MAX_SIZE]);
err = -EINVAL;
goto done;
}
max_size = nla_get_u32(tb[ATTR_USABLE_CHANNEL_MAX_SIZE]);
PRINTM(MCMND,
"get usable channels for - band: %d, iface_mode: %d, filter: %d,"
" max_size: %d",
band, iface_mode, filter, max_size);
channels = kzalloc(sizeof(wifi_usable_channel) *
MIN(MAX_CHANNEL_NUM, max_size),
GFP_ATOMIC);
if (!channels) {
PRINTM(MERROR,
"Failed to allocate memory for wifi_usable_channel of size: %d",
MIN(MAX_CHANNEL_NUM, max_size));
err = -ENOMEM;
goto done;
}
for (i = 0; i < IEEE80211_NUM_BANDS; i++) {
if (!priv->wdev->wiphy->bands[i])
continue;
if ((i == IEEE80211_BAND_2GHZ) && !(band & WLAN_MAC_2_4_BAND))
continue;
if ((i == IEEE80211_BAND_5GHZ) && !(band & WLAN_MAC_5_0_BAND))
continue;
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 8, 0)
if ((i == IEEE80211_BAND_6GHZ) && !(band & WLAN_MAC_6_0_BAND))
continue;
#endif
sband = priv->wdev->wiphy->bands[i];
for (j = 0; (j < sband->n_channels); j++) {
ch = &sband->channels[j];
if (ch->flags & IEEE80211_CHAN_DISABLED) {
PRINTM(MERROR, "Skip DISABLED channels %d\n",
ieee80211_frequency_to_channel(
ch->center_freq));
continue;
}
if (cnt >= MIN(MAX_CHANNEL_NUM, max_size)) {
PRINTM(MERROR,
"cnt=%d exceeds %d, hence ignore remaining channels. "
"cur ch = %dMHz",
cnt, MIN(MAX_CHANNEL_NUM, max_size),
ch->center_freq);
break;
}
channels[cnt].freq = ch->center_freq;
channels[cnt].iface_mode_mask =
IFACE_MODE_STA | IFACE_MODE_SOFTAP |
IFACE_MODE_P2P_CLIENT | IFACE_MODE_P2P_GO;
if (!(ch->flags & IEEE80211_CHAN_NO_80MHZ)) {
channels[cnt].width = WIFI_CHAN_WIDTH_80;
} else if (!(ch->flags & IEEE80211_CHAN_NO_HT40PLUS) ||
!(ch->flags & IEEE80211_CHAN_NO_HT40MINUS)) {
channels[cnt].width = WIFI_CHAN_WIDTH_40;
} else if (!(ch->flags & IEEE80211_CHAN_NO_20MHZ)) {
channels[cnt].width = WIFI_CHAN_WIDTH_20;
} else {
PRINTM(MERROR, "Invalid channel width");
channels[cnt].width = WIFI_CHAN_WIDTH_INVALID;
}
PRINTM(MINFO, "channel : %d width: %d",
ieee80211_frequency_to_channel(
channels[cnt].freq),
channels[cnt].width);
cnt++;
}
}
PRINTM(MCMND, "Usable channel count: %d\n", cnt);
size = cnt;
mem_needed = nla_total_size(size * sizeof(wifi_usable_channel)) +
nla_total_size(sizeof(size)) + VENDOR_REPLY_OVERHEAD;
/* Alloc the SKB for vendor_event */
skb = cfg80211_vendor_cmd_alloc_reply_skb(wiphy, mem_needed);
if (unlikely(!skb)) {
PRINTM(MERROR, "skb alloc failed");
err = -ENOMEM;
goto done;
}
if (nla_put_u32(skb, ATTR_USABLE_CHANNEL_SIZE, size)) {
PRINTM(MERROR, "nla_put ATTR_USABLE_CHANNEL_SIZE failed!\n");
kfree_skb(skb);
err = -ENOMEM;
goto done;
}
if (nla_put(skb, ATTR_USABLE_CHANNEL_LIST,
size * sizeof(wifi_usable_channel), channels)) {
PRINTM(MERROR, "nla_put ATTR_USABLE_CHANNEL_LIST failed!\n");
kfree_skb(skb);
err = -ENOMEM;
goto done;
}
err = cfg80211_vendor_cmd_reply(skb);
if (err) {
PRINTM(MERROR, "Vendor Command reply failed ret:%d\n", err);
goto done;
}
done:
if (channels)
kfree(channels);
LEAVE();
return err;
}
// clang-format off
static const struct wiphy_vendor_command vendor_commands[] = {
{
@ -8109,6 +8621,43 @@ static const struct wiphy_vendor_command vendor_commands[] = {
.policy = VENDOR_CMD_RAW_DATA,
#endif
},
{
.info = {
.vendor_id = MRVL_VENDOR_ID,
.subcmd = subcmd_btwt_ap_config_set,
},
.flags = WIPHY_VENDOR_CMD_NEED_WDEV |
WIPHY_VENDOR_CMD_NEED_NETDEV,
.doit = &woal_cfg80211_subcmd_btwt_ap_config_set,
#if KERNEL_VERSION(5, 3, 0) <= CFG80211_VERSION_CODE
.policy = VENDOR_CMD_RAW_DATA,
#endif
},
{
.info = {
.vendor_id = MRVL_VENDOR_ID,
.subcmd = subcmd_btwt_ap_config_get,
},
.flags = WIPHY_VENDOR_CMD_NEED_WDEV |
WIPHY_VENDOR_CMD_NEED_NETDEV,
.doit = &woal_cfg80211_subcmd_btwt_ap_config_get,
#if KERNEL_VERSION(5, 3, 0) <= CFG80211_VERSION_CODE
.policy = VENDOR_CMD_RAW_DATA,
#endif
},
{
.info = {
.vendor_id = MRVL_VENDOR_ID,
.subcmd = subcmd_get_usable_channels,
},
.flags = WIPHY_VENDOR_CMD_NEED_WDEV |
WIPHY_VENDOR_CMD_NEED_NETDEV,
.doit = woal_cfg80211_subcmd_get_usable_channels,
#if KERNEL_VERSION(5, 3, 0) <= CFG80211_VERSION_CODE
.policy = woal_usable_channel_policy,
.maxattr = ATTR_USABLE_CHANNEL_MAX,
#endif
},
};
// clang-format on

View file

@ -639,6 +639,103 @@ enum ATTR_FW_RELOAD {
void woal_cfg80211_driver_hang_event(moal_private *priv, t_u8 reload_mode);
enum ATTR_USABLE_CHANNEL {
ATTR_USABLE_CHANNEL_INVALID = 0,
ATTR_USABLE_CHANNEL_BAND = 1,
ATTR_USABLE_CHANNEL_IFACE_MODE = 2,
ATTR_USABLE_CHANNEL_FILTER = 3,
ATTR_USABLE_CHANNEL_MAX_SIZE = 4,
ATTR_USABLE_CHANNEL_SIZE = 5,
ATTR_USABLE_CHANNEL_LIST = 6,
ATTR_USABLE_CHANNEL_MAX,
};
/*
* enum wlan_mac_band - Band information corresponding to the WLAN MAC.
*/
typedef enum {
/* WLAN MAC Operates in 2.4 GHz Band */
WLAN_MAC_2_4_BAND = 1 << 0,
/* WLAN MAC Operates in 5 GHz Band */
WLAN_MAC_5_0_BAND = 1 << 1,
/* WLAN MAC Operates in 6 GHz Band */
WLAN_MAC_6_0_BAND = 1 << 2,
/* WLAN MAC Operates in 60 GHz Band */
WLAN_MAC_60_0_BAND = 1 << 3,
} wlan_mac_band;
typedef enum {
/* Interface operation mode is client. */
IFACE_MODE_STA = 1 << 0,
/* Interface operation mode is Hotspot. */
IFACE_MODE_SOFTAP = 1 << 1,
/* Interface operation mode is Ad-Hoc network. */
IFACE_MODE_IBSS = 1 << 2,
/* Interface operation mode is Wifi Direct Client. */
IFACE_MODE_P2P_CLIENT = 1 << 3,
/* Interface operation mode is Wifi Direct Group Owner. */
IFACE_MODE_P2P_GO = 1 << 4,
/* Interface operation mode is Aware. */
IFACE_MODE_NAN = 1 << 5,
/* Interface operation mode is Mesh network. */
IFACE_MODE_MESH = 1 << 6,
/* Interface operation mode is Tunneled Direct Link Setup. */
IFACE_MODE_TDLS = 1 << 7,
} wifi_interface_mode;
typedef enum {
/* Filter Wifi channels that should be avoided due to cellular coex
* restrictions. Some Wifi channels can have extreme interference
* from/to cellular due to short frequency separation with neighboring
* cellular channels or when there is harmonic and intermodulation
* interference. Channels which only have some performance degradation
* (e.g. power back off is sufficient to deal with coexistence issue)
* can be included and should not be filtered out.
*/
WIFI_USABLE_CHANNEL_FILTER_CELLULAR_COEXISTENCE = 1 << 0,
/* Filter channels due to concurrency state.
* Examples:
* - 5GHz SAP operation may be supported in standalone mode, but if
* there is STA connection on 5GHz DFS channel, none of the 5GHz
* channels are usable for SAP if device does not support DFS SAP mode.
* - P2P GO may not be supported on indoor channels in EU during
* standalone mode but if there is a STA connection on indoor channel,
* P2P GO may be supported by some vendors on the same STA channel.
*/
WIFI_USABLE_CHANNEL_FILTER_CONCURRENCY = 1 << 1,
/* This Filter queries Wifi channels and bands that are supported for
* NAN3.1 Instant communication mode. This filter should only be applied
* to NAN interface. If 5G is supported default discovery channel 149/44
* is considered, If 5G is not supported then channel 6 has to be
* considered. Based on regulatory domain if channel 149 and 44 are
* restricted, channel 6 should be considered for instant communication
* channel
*/
WIFI_USABLE_CHANNEL_FILTER_NAN_INSTANT_MODE = 1 << 2,
} wifi_usable_channel_filter;
/*
* wifi_usable_channel specifies a channel frequency, bandwidth, and bitmask
* of modes allowed on the channel.
*/
typedef struct {
/* Channel frequency in MHz */
int freq;
/* Channel operating width (20, 40, 80, 160, 320 etc.) */
wifi_channel_width_t width;
/* BIT MASK of BIT(WIFI_INTERFACE_*) represented by
* |wifi_interface_mode| Bitmask does not represent concurrency.
* Examples:
* - If a channel is usable only for STA, then only the
* WIFI_INTERFACE_STA bit would be set for that channel.
* - If 5GHz SAP is not allowed, then none of the 5GHz channels will
* have WIFI_INTERFACE_SOFTAP bit set. Note: TDLS bit is set only if
* there is a STA connection. TDLS bit is set on non-STA channels only
* if TDLS off channel is supported.
*/
u32 iface_mode_mask;
} wifi_usable_channel;
/**vendor event*/
enum vendor_event {
event_hang = 0,
@ -765,6 +862,10 @@ enum vendor_sub_command {
subcmd_set_get_tx_ampdu_prot_mode = 0x1924,
subcmd_twt_setup = 0x1925,
subcmd_twt_teardown = 0x1926,
subcmd_btwt_ap_config_set = 0x1927,
subcmd_btwt_ap_config_get = 0x1928,
// Get Usable channel list
subcmd_get_usable_channels = 0x1950,
sub_cmd_max,
};

View file

@ -5586,6 +5586,9 @@ static int woal_priv_hssetpara(moal_private *priv, t_u8 *respbuf,
respbuf + (strlen(CMD_NXP) + strlen(PRIV_CMD_HSSETPARA)),
CMD_BUF_LEN -
(strlen(CMD_NXP) + strlen(PRIV_CMD_HSSETPARA)));
/* respbuf is allocated with kzalloc, ensuring null-termination
* snprintf is used safely with bounded size.
*/
// coverity[cert_str32_c_violation:SUPPRESS]
if (snprintf(respbuf, CMD_BUF_LEN, "%s%s%s", CMD_NXP,
PRIV_CMD_HSCFG, buf) <= 0)
@ -13061,6 +13064,8 @@ static int woal_channel_switch(moal_private *priv, t_u8 block_tx,
priv->phandle->chsw_wait_q_woken = MFALSE;
/* wait for channel switch to complete */
// Coverity error raised for kernel's API
// coverity[check_return:SUPPRESS]
wait_rv = wait_event_interruptible_timeout(
priv->phandle->chsw_wait_q, priv->phandle->chsw_wait_q_woken,
(u32)HZ * (switch_count + 2) * 110 / 1000);
@ -17315,7 +17320,7 @@ static int woal_priv_tsp_config(moal_private *priv, t_u8 *respbuf,
mlan_ioctl_req *req = NULL;
mlan_ds_misc_cfg *misc_cfg = NULL;
mlan_status status = MLAN_STATUS_SUCCESS;
int data[8] = {0};
int data[9] = {0};
int header_len = 0;
int user_data_len = 0;
int ret = 0;
@ -17340,7 +17345,7 @@ static int woal_priv_tsp_config(moal_private *priv, t_u8 *respbuf,
parse_arguments(respbuf + header_len, data, ARRAY_SIZE(data),
&user_data_len);
if (user_data_len > 8) {
if (user_data_len > 9) {
PRINTM(MERROR, "invalid parameters\n");
ret = -EINVAL;
goto done;
@ -17415,6 +17420,11 @@ static int woal_priv_tsp_config(moal_private *priv, t_u8 *respbuf,
"err: TSP Low Threshold Temperature is greater than High Threshold Temperature value\n");
ret = -EINVAL;
goto done;
} else if (data[8] < 1 || data[8] > 10) {
PRINTM(MERROR,
"err: TSP RFUTj Temperature poll count isn't in Range\n");
ret = -EINVAL;
goto done;
} else {
tsp_cfg->enable = (t_u16)data[0];
tsp_cfg->backoff = (t_s32)data[1];
@ -17424,6 +17434,8 @@ static int woal_priv_tsp_config(moal_private *priv, t_u8 *respbuf,
tsp_cfg->duty_cyc_min = (t_s32)data[5];
tsp_cfg->high_thrshld_temp = (t_s32)data[6];
tsp_cfg->low_thrshld_temp = (t_s32)data[7];
tsp_cfg->rf_temp_poll_cnt = (t_s32)data[8];
tsp_cfg->throttle_duty_cycle = 0;
}
}
@ -22385,7 +22397,14 @@ static int woal_priv_per_band_txpwr_cap(moal_private *priv, t_u8 *respbuf,
if (data[0] != BAND_2GHZ && data[0] != BAND_5GHZ &&
data[0] != BAND_6GHZ) {
PRINTM(MERROR, "Invalid band\n");
PRINTM(MERROR, "per_band_txpwr_cap: Invalid band input\n");
ret = -EINVAL;
goto done;
}
/* tx power capping cannot be negative or above 25 dBm */
if (data[1] < 0 || data[1] > 25) {
PRINTM(MERROR,
"per_band_txpwr_cap: Invalid power value input\n");
ret = -EINVAL;
goto done;
}

View file

@ -21,6 +21,9 @@
*
*/
#include "moal_main.h"
#ifdef SDIO_MMC
#include "moal_sdio.h"
#endif
/** Global moal_handle array */
extern pmoal_handle m_handle[];
@ -29,6 +32,7 @@ extern pmoal_handle m_handle[];
static char *fw_name;
static int req_fw_nowait;
int fw_reload;
static char *wifi_fw_name;
#ifdef PCIE
int auto_fw_reload = AUTO_FW_RELOAD_ENABLE | AUTO_FW_RELOAD_PCIE_INBAND_RESET;
#else
@ -448,6 +452,26 @@ static int make_before_break = 0;
static int auto_11ax = 1;
static int reject_addba_req = 0;
#if defined(USB) && defined(USB_CUSTOMER_VIDPID)
mlan_status check_device_name_info(char *device_name, t_u16 *card_type)
{
t_u32 tbl_size =
sizeof(card_type_map_tbl) / sizeof(card_type_map_tbl[0]);
t_u32 i;
for (i = 0; i < tbl_size; i++) {
if (strcmp(card_type_map_tbl[i].name, device_name) == 0) {
if (card_type != NULL)
*card_type = card_type_map_tbl[i].card_type;
return MLAN_STATUS_SUCCESS;
}
}
return MLAN_STATUS_FAILURE;
}
#endif
/**
* @brief This function read a line in module parameter file
*
@ -456,7 +480,8 @@ static int reject_addba_req = 0;
* @param line_pos A pointer to offset of current line
* @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE
*/
static t_size parse_cfg_get_line(t_u8 *data, t_size size, t_u8 *line_pos)
static t_size parse_cfg_get_line(t_u8 *data, t_size size, t_u8 *line_pos,
t_s32 *cur_pos)
{
t_u8 *src, *dest;
static t_s32 pos;
@ -489,6 +514,9 @@ static t_size parse_cfg_get_line(t_u8 *data, t_size size, t_u8 *line_pos)
/* parse new line */
pos++;
*dest = '\0';
if (cur_pos != NULL)
*cur_pos = pos;
LEAVE();
return strlen(line_pos);
}
@ -678,6 +706,108 @@ static bool woal_str2mac(char *str, t_u8 *mac)
return MTRUE;
}
#ifdef SDIO_MMC
/**
* @brief This function parses slot ID information from configuration data
*
* @param data A pointer to configuration data
* @param size Size of the configuration data
* @param cur_pos Current position in the data buffer
* @param handle A pointer to moal_handle structure
*
* @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE
*/
static mlan_status parse_cfg_slot_id_info(t_u8 *data, t_u32 size, t_s32 cur_pos,
moal_handle *handle)
{
mlan_status ret = MLAN_STATUS_SUCCESS;
int out_data = -1, end = 0;
t_u8 *src, *dest;
t_s32 pos = cur_pos;
t_u8 line[MAX_LINE_LEN];
sdio_mmc_card *card_info = (sdio_mmc_card *)handle->card;
if (data == NULL)
return MLAN_STATUS_FAILURE;
memset(line, 0, MAX_LINE_LEN);
src = data + pos;
dest = line;
while (!end) {
while (pos < (t_s32)size && *src != '\x0A' && *src != '\0') {
if ((dest - line) >= (MAX_LINE_LEN - 1)) {
PRINTM(MERROR,
"error: input data size exceeds the dest buff limit\n");
return ret;
}
if (*src != ' ' && *src != '\t') /* parse space */
*dest++ = *src++;
else
src++;
pos++;
}
/* parse new line */
pos++;
*dest = '\0';
PRINTM(MINFO, "get line %s \n", line);
if (line[0] == '#' || strstr(line, "={")) {
memset(line, 0, MAX_LINE_LEN);
src = data + pos;
dest = line;
continue;
}
if (strncmp(line, "}", strlen("}")) == 0) {
end = 1;
break;
}
if (end == 0 && strstr(line, "{") != NULL) {
break;
}
if (strncmp(line, "slot_id", strlen("slot_id")) == 0) {
if (parse_line_read_int(line, &out_data) ==
MLAN_STATUS_SUCCESS) {
if (out_data >= 0) {
if (out_data !=
card_info->func->card->host->index) {
ret = MLAN_STATUS_FAILURE;
PRINTM(MINFO,
"incorrect conf slot id %d, device slot id %d \n",
out_data,
card_info->func->card
->host->index);
} else {
PRINTM(MINFO,
"correct conf slot id %d \n",
out_data);
}
break;
} else {
ret = MLAN_STATUS_FAILURE;
PRINTM(MERROR, "negative value \n");
break;
}
} else {
PRINTM(MERROR, "empty value\n");
break;
}
} else {
memset(line, 0, MAX_LINE_LEN);
src = data + pos;
dest = line;
continue;
}
}
return ret;
}
#endif
/**
* @brief This function read blocks in module parameter file
*
@ -697,7 +827,7 @@ static mlan_status parse_cfg_read_block(t_u8 *data, t_u32 size,
t_u8 addr[ETH_ALEN];
mlan_status ret = MLAN_STATUS_SUCCESS;
while ((int)parse_cfg_get_line(data, size, line) != -1) {
while ((int)parse_cfg_get_line(data, size, line, NULL) != -1) {
if (strncmp(line, "}", strlen("}")) == 0) {
end = 1;
break;
@ -766,6 +896,13 @@ static mlan_status parse_cfg_read_block(t_u8 *data, t_u32 size,
params->auto_fw_reload = out_data;
PRINTM(MMSG, "auto_fw_reload %d\n",
params->auto_fw_reload);
} else if (strncmp(line, "wifi_fw_name",
strlen("wifi_fw_name")) == 0) {
if (parse_line_read_string(line, &out_str) !=
MLAN_STATUS_SUCCESS)
goto err;
woal_dup_string(&params->wifi_fw_name, out_str);
PRINTM(MMSG, "wifi_fw_name=%s\n", params->wifi_fw_name);
} else if (strncmp(line, "fw_serial", strlen("fw_serial")) ==
0) {
if (parse_line_read_int(line, &out_data) !=
@ -1810,6 +1947,12 @@ static void woal_setup_module_param(moal_handle *handle, moal_mod_para *params)
handle->params.auto_fw_reload = auto_fw_reload;
if (params)
handle->params.auto_fw_reload = params->auto_fw_reload;
woal_dup_string(&handle->params.wifi_fw_name, wifi_fw_name);
if (params && params->wifi_fw_name)
woal_dup_string(&handle->params.wifi_fw_name,
params->wifi_fw_name);
if (fw_serial)
moal_extflg_set(handle, EXT_FW_SERIAL);
woal_dup_string(&handle->params.hw_name, hw_name);
@ -2241,6 +2384,11 @@ void woal_free_module_param(moal_handle *handle)
kfree(params->fw_name);
params->fw_name = NULL;
}
if (params->wifi_fw_name) {
kfree(params->wifi_fw_name);
params->wifi_fw_name = NULL;
}
if (params->hw_name) {
kfree(params->hw_name);
params->hw_name = NULL;
@ -2469,6 +2617,14 @@ void woal_init_from_dev_tree(void)
fw_name = (char *)string_data;
PRINTM(MIOCTL, "fw_name=%s\n", fw_name);
}
} else if (!strncmp(prop->name, "wifi_fw_name",
strlen("wifi_fw_name"))) {
if (!of_property_read_string(dt_node, prop->name,
&string_data)) {
wifi_fw_name = (char *)string_data;
PRINTM(MIOCTL, "wifi_fw_name=%s\n",
wifi_fw_name);
}
} else if (!strncmp(prop->name, "hw_name", strlen("hw_name"))) {
if (!of_property_read_string(dt_node, prop->name,
&string_data)) {
@ -2876,7 +3032,7 @@ static mlan_status parse_skip_cfg_block(t_u8 *data, t_u32 size)
{
int end = 0;
t_u8 line[MAX_LINE_LEN];
while ((int)parse_cfg_get_line(data, size, line) != -1) {
while ((int)parse_cfg_get_line(data, size, line, NULL) != -1) {
if (strncmp(line, "}", strlen("}")) == 0) {
end = 1;
break;
@ -2935,6 +3091,7 @@ mlan_status woal_init_module_param(moal_handle *handle)
t_u8 line[MAX_LINE_LEN], *data = NULL;
mlan_status ret = MLAN_STATUS_SUCCESS;
char *card_type = NULL, *blk_id = NULL;
t_s32 cur_pos = 0;
memset(line, 0, MAX_LINE_LEN);
woal_setup_module_param(handle, NULL);
@ -2963,7 +3120,7 @@ mlan_status woal_init_module_param(moal_handle *handle)
// Casting is done to read and parse the data
// coverity[misra_c_2012_rule_11_8_violation:SUPPRESS]
data = (t_u8 *)handle->param_data->data;
while ((int)parse_cfg_get_line(data, size, line) != -1) {
while ((int)parse_cfg_get_line(data, size, line, &cur_pos) != -1) {
if (line[0] == '#')
continue;
if (strstr(line, "={")) {
@ -2986,7 +3143,13 @@ mlan_status woal_init_module_param(moal_handle *handle)
card_type, handle->blk_id);
/* check validation of config id */
if (woal_validate_cfg_id(handle) !=
MLAN_STATUS_SUCCESS) {
MLAN_STATUS_SUCCESS
#ifdef SDIO_MMC
|| (parse_cfg_slot_id_info(
data, size, cur_pos, handle) !=
MLAN_STATUS_SUCCESS)
#endif
) {
ret = parse_skip_cfg_block(data, size);
if (ret != MLAN_STATUS_SUCCESS) {
PRINTM(MMSG,
@ -3026,7 +3189,7 @@ out:
if (handle->param_data) {
release_firmware(handle->param_data);
/* rewind pos */
(void)parse_cfg_get_line(NULL, 0, NULL);
(void)parse_cfg_get_line(NULL, 0, NULL, NULL);
}
if (ret != MLAN_STATUS_SUCCESS) {
PRINTM(MERROR, "Invalid block: %s\n", line);
@ -3057,6 +3220,8 @@ module_param(fw_reload, int, 0);
MODULE_PARM_DESC(fw_reload,
"0: disable fw_reload; 1: enable fw reload feature");
module_param(auto_fw_reload, int, 0);
module_param(wifi_fw_name, charp, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP);
MODULE_PARM_DESC(wifi_fw_name, "Wlan firmware name for IR");
#ifdef PCIE
MODULE_PARM_DESC(
auto_fw_reload,
@ -3452,9 +3617,13 @@ MODULE_PARM_DESC(
"1: Set channel tracking; 0: Restore channel tracking for 9098 only");
#if CFG80211_VERSION_CODE > KERNEL_VERSION(4, 12, 14)
// Warning is raised for same input name used for
// module_param and MODULE_PARM_DESC.
// coverity[misra_c_2012_rule_21_2_violation:SUPPRESS]
// coverity[misra_c_2012_rule_5_2_violation:SUPPRESS]
module_param(cfg80211_eapol_offload, int, 0);
// Warning is raised for same input name used for
// module_param and MODULE_PARM_DESC.
// coverity[misra_c_2012_rule_21_2_violation:SUPPRESS]
MODULE_PARM_DESC(cfg80211_eapol_offload,
"0: Disable eapol offload (default); 1: Enable eapol offload");

View file

@ -775,6 +775,8 @@ mlan_status woal_request_ioctl(moal_private *priv, mlan_ioctl_req *req,
cac_left_jiffies / HZ);
/* blocking timeout set to 1.5 * CAC checking period
* left time */
// coverity error raised for kernel's API
// coverity[check_return:SUPPRESS]
wait_rv = wait_event_interruptible_timeout(
priv->phandle->meas_wait_q,
priv->phandle->meas_wait_q_woken,

View file

@ -98,6 +98,10 @@ struct semaphore AddRemoveCardSem;
**/
moal_handle *m_handle[MAX_MLAN_ADAPTER];
static int reg_work;
#if defined(USB) && defined(USB_CUSTOMER_VIDPID)
static char *c_vidpid;
#endif
/********************************************************
Local Variables
********************************************************/
@ -941,7 +945,8 @@ static struct _card_info card_info_SD8987 = {
/** Driver version */
char driver_version[MLAN_MAX_VER_STR_LEN] =
INTF_CARDTYPE KERN_VERSION "--" MLAN_RELEASE_VERSION "-("
INTF_CARDTYPE KERN_VERSION "--" MLAN_RELEASE_VERSION "-GPL"
"-("
"FP" FPNUM ")"
#ifdef DEBUG_LEVEL2
"-dbg"
@ -2309,15 +2314,21 @@ done:
*/
void woal_update_firmware_name(moal_handle *handle)
{
if (handle->params.fw_name) {
handle->drv_mode.fw_name = handle->params.fw_name;
if ((handle->fw_reload || handle->fw_reseting) &&
handle->params.wifi_fw_name) {
handle->drv_mode.fw_name = handle->params.wifi_fw_name;
} else {
if (!moal_extflg_isset(handle, EXT_FW_SERIAL) ||
handle->fw_reload || handle->params.fw_reload) {
handle->drv_mode.fw_name =
handle->card_info->fw_name_wlan;
} else
handle->drv_mode.fw_name = handle->card_info->fw_name;
if (handle->params.fw_name) {
handle->drv_mode.fw_name = handle->params.fw_name;
} else {
if (!moal_extflg_isset(handle, EXT_FW_SERIAL) ||
handle->fw_reload || handle->params.fw_reload) {
handle->drv_mode.fw_name =
handle->card_info->fw_name_wlan;
} else
handle->drv_mode.fw_name =
handle->card_info->fw_name;
}
}
}
/**
@ -2919,6 +2930,8 @@ mlan_status woal_init_sw(moal_handle *handle)
device.mclient_scheduling = handle->params.mclient_scheduling;
/* Clean up the mode_psd_string for 6E Indoor/Outdoor */
memset(handle->mode_psd_string, 0, sizeof(handle->mode_psd_string));
memset(handle->mode_psd_ru_string, 0,
sizeof(handle->mode_psd_ru_string));
moal_memcpy_ext(handle, &device.callbacks, &woal_callbacks,
sizeof(mlan_callbacks), sizeof(mlan_callbacks));
@ -3565,6 +3578,10 @@ static mlan_status woal_process_hostcmd_cfg(moal_private *priv, t_u8 *data,
if (*pos == '}') {
cmd_len = *((t_u16 *)(buf + strlen(CMD_STR) +
sizeof(t_u32) + sizeof(t_u16)));
/* The destination pointer is within the allocated
* buffer and the memcpy is not exceeding the buffer
* size.
*/
// coverity[overrun-buffer-arg:SUPPRESS]
moal_memcpy_ext(priv->phandle, buf + strlen(CMD_STR),
&cmd_len, sizeof(t_u32), sizeof(t_u32));
@ -3581,11 +3598,15 @@ static mlan_status woal_process_hostcmd_cfg(moal_private *priv, t_u8 *data,
}
/* 6E Mode based string parsing logic */
if ((priv->phandle->fw_bands & BAND_6G) &&
(priv->phandle->mode_psd_string[0] != '\0')) {
if (*pos == 'r' || *pos == 'e' || *pos == 's') {
((priv->phandle->mode_psd_string[0] != '\0') ||
(priv->phandle->mode_psd_ru_string[0] != '\0'))) {
if ((start_raw == MFALSE) &&
(*pos == 'r' || *pos == 'e' || *pos == 's')) {
memset(psd_name, 0, sizeof(psd_name));
len = 0;
while (*temp != ' ') {
while (((temp - data) < size) &&
(*temp != ' ') &&
(len < sizeof(psd_name) - 1)) {
temp++;
len++;
}
@ -3595,21 +3616,35 @@ static mlan_status woal_process_hostcmd_cfg(moal_private *priv, t_u8 *data,
psd_name);
/* Picking up the correct Mode/PSD string from
* "rg_powerXX.bin" */
if ((priv->phandle->mode_psd_string[0] == 0) ||
* "rgpower_XX.bin" */
if ((priv->phandle->mode_psd_string[0] != 0) &&
(strcmp(psd_name,
priv->phandle->mode_psd_string) !=
priv->phandle->mode_psd_string) ==
0)) {
while (*temp != '}') {
while (*temp != '\n')
temp++;
temp++;
}
} else {
/* Match */
PRINTM(MMSG, "Downloading: %s\n",
priv->phandle->mode_psd_string);
goto next;
} else if ((priv->phandle
->mode_psd_ru_string[0] !=
0) &&
(strcmp(psd_name,
priv->phandle
->mode_psd_ru_string) ==
0)) {
/* Match */
PRINTM(MMSG, "Downloading: %s\n",
priv->phandle
->mode_psd_ru_string);
goto next;
} else {
while (((temp - data) < size) &&
*temp != '}') {
while (((temp - data) < size) &&
*temp != '\n')
temp++;
temp++;
}
}
/* No Match */
pos = temp + 1;
@ -4699,10 +4734,7 @@ static mlan_status woal_req_dpd_data(moal_handle *handle,
}
}
if (handle->dpd_data) {
/* typecasted to get address pointed by dpd_data->data
*/
// coverity[misra_c_2012_rule_11_8_violation:SUPPRESS]
param->pdpd_data_buf = (t_u8 *)handle->dpd_data->data;
param->pdpd_data_buf = handle->dpd_data->data;
param->dpd_data_len = handle->dpd_data->size;
} else {
param->dpd_data_len = UNKNOW_DPD_LENGTH;
@ -4789,10 +4821,7 @@ static mlan_status woal_req_txpwr_data(moal_handle *handle,
}
}
if (handle->txpwr_data) {
param->ptxpwr_data_buf =
// Typecasting is done to read the value
// coverity[misra_c_2012_rule_11_8_violation:SUPPRESS]
(t_u8 *)handle->txpwr_data->data;
param->ptxpwr_data_buf = handle->txpwr_data->data;
param->txpwr_data_len = handle->txpwr_data->size;
}
}
@ -5087,6 +5116,7 @@ done:
handle->user_data = NULL;
}
handle->mode_psd_string[0] = '\0';
handle->mode_psd_ru_string[0] = '\0';
LEAVE();
return ret;
@ -6182,6 +6212,7 @@ moal_private *woal_add_interface(moal_handle *handle, t_u8 bss_index,
#ifdef STA_CFG80211
INIT_LIST_HEAD(&priv->dhcp_discover_queue);
spin_lock_init(&priv->dhcp_discover_lock);
spin_lock_init(&priv->arp_request_lock);
hash_init(priv->hlist);
#endif
#ifdef STA_CFG80211
@ -6530,6 +6561,15 @@ void woal_remove_interface(moal_handle *handle, t_u8 bss_index)
#endif
woal_flush_mcast_list(priv);
#if defined(STA_CFG80211) || defined(UAP_CFG80211)
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0)
if (priv->qos_map) {
kfree(priv->qos_map);
priv->qos_map = NULL;
}
#endif
#endif
#ifdef STA_CFG80211
if (priv->bss_type == MLAN_BSS_TYPE_STA &&
IS_STA_CFG80211(handle->params.cfg80211_wext)) {
@ -7612,6 +7652,7 @@ void woal_mlan_debug_info(moal_private *priv)
info->rxbd_rdptr, info->rxbd_wrptr);
PRINTM(MERROR, "eventbd: rdptr=0x%x wrptr=0x%x\n",
info->eventbd_rdptr, info->eventbd_wrptr);
PRINTM(MERROR, "txbd pending = %d\n", info->txbd_pending);
}
#endif
PRINTM(MERROR, "------------mlan_debug_info End-------------\n");
@ -7693,7 +7734,6 @@ void woal_tx_timeout(struct net_device *dev
}
if (!auto_fw_dump && !priv->phandle->fw_dump)
woal_process_hang(priv->phandle);
wifi_status = WIFI_STATUS_TX_TIMEOUT;
}
@ -7821,7 +7861,7 @@ u16 woal_select_queue(struct net_device *dev, struct sk_buff *skb
}
#if defined(STA_CFG80211) || defined(UAP_CFG80211)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 0)
tid = skb->priority = cfg80211_classify8021d(skb, NULL);
tid = skb->priority = cfg80211_classify8021d(skb, priv->qos_map);
#else
tid = skb->priority = cfg80211_classify8021d(skb);
#endif
@ -7970,6 +8010,7 @@ static t_u32 woal_generate_hash_factor(t_u32 factor)
factor = (factor << 15) | (factor >> 17);
factor *= 0x1b873593;
// Overflow is expected and safe as part of hash mixing logic.
// coverity[integer_overflow:SUPPRESS]
return factor;
}
@ -8011,6 +8052,7 @@ static t_u32 woal_generate_hash(t_u8 *data, size_t len, t_u32 seed)
hash *= 0xc2b2ae35;
hash ^= hash >> 16;
// Overflow is expected and safe as part of hash mixing logic.
// coverity[integer_overflow:SUPPRESS]
return hash;
}
@ -10803,7 +10845,9 @@ void woal_update_dscp_mapping(moal_private *priv)
return;
}
passoc_rsp = (IEEEtypes_AssocRsp_t *)assoc_rsp->assoc_resp_buf;
passoc_rsp = (IEEEtypes_AssocRsp_t *)(assoc_rsp->assoc_resp_buf +
IEEE80211_HEADER_SIZE);
memset(priv->dscp_map, 0xFF, sizeof(priv->dscp_map));
qos_mapping_ie = (const IEEEtypes_Header_t *)woal_parse_ie_tlv(
passoc_rsp->ie_buffer,
@ -10829,6 +10873,33 @@ void woal_update_dscp_mapping(moal_private *priv)
sizeof(IEEEtypes_Header_t) +
dscp_except_num *
sizeof(DSCP_Exception_t));
#ifdef STA_CFG80211
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0)
if (!priv->qos_map) {
priv->qos_map = kzalloc(sizeof(struct cfg80211_qos_map),
GFP_KERNEL);
if (!priv->qos_map) {
PRINTM(MERROR,
"DSCP update: memory alloc fail\n");
LEAVE();
}
}
priv->qos_map->num_des = dscp_except_num;
moal_memcpy_ext(priv->phandle, priv->qos_map->dscp_exception,
dscp_except,
sizeof(priv->qos_map->dscp_exception),
sizeof(priv->qos_map->dscp_exception));
moal_memcpy_ext(priv->phandle, priv->qos_map->up, pdscp_range,
sizeof(priv->qos_map->up),
sizeof(priv->qos_map->up));
DBG_HEXDUMP(MCMD_D, "STA: QoS Map", (t_u8 *)priv->qos_map,
sizeof(struct cfg80211_qos_map));
#endif
#endif
for (i = 0; i < MAX_NUM_TID; i++) {
PRINTM(MEVENT, "TID %d: dscp_low=%d, dscp_high=%d\n", i,
pdscp_range->dscp_low_value,
@ -10994,10 +11065,23 @@ t_void woal_send_disconnect_to_system(moal_private *priv,
priv->ft_md = 0;
priv->ft_cap = 0;
memset(priv->dscp_map, 0xFF, sizeof(priv->dscp_map));
#ifdef STA_CFG80211
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0)
if (priv->qos_map) {
kfree(priv->qos_map);
priv->qos_map = NULL;
}
#endif
#endif
/* Clear the mode_psd_string for STA disconnect */
if (priv->phandle->fw_bands & BAND_6G)
if (priv->phandle->fw_bands & BAND_6G) {
memset(priv->phandle->mode_psd_string, 0,
sizeof(priv->phandle->mode_psd_string));
memset(priv->phandle->mode_psd_ru_string, 0,
sizeof(priv->phandle->mode_psd_ru_string));
}
if (!moal_extflg_isset(priv->phandle, EXT_COUNTRY_IE_IGNORE))
woal_reset_peer_country_info(priv);
}
#endif /* STA_CFG80211 */
@ -11919,6 +12003,8 @@ static int woal_dump_mlan_drv_info(moal_private *priv, t_u8 *buf)
ptr += snprintf(ptr, MAX_BUF_LEN, "EVTBD Ring:\n");
ptr += woal_save_hex_dump(ROW_SIZE_16, info->evtbd_ring_vbase,
info->evtbd_ring_size, MTRUE, ptr);
ptr += snprintf(ptr, MAX_BUF_LEN, "TXBD Pending = %d\n",
info->txbd_pending);
}
#endif
ptr += snprintf(ptr, MAX_BUF_LEN,
@ -13481,6 +13567,8 @@ t_void woal_evt_work_queue(struct work_struct *work)
*/
t_void woal_rx_work_queue(struct work_struct *work)
{
// Coverity violation raised for kernel's API
// coverity[cert_arr39_c_violation:SUPPRESS]
moal_handle *handle = container_of(work, moal_handle, rx_work);
wifi_timeval start_timeval;
wifi_timeval end_timeval;
@ -13646,7 +13734,8 @@ t_void woal_pcie_tx_complete_work_queue(struct work_struct *work)
container_of(work, moal_handle, pcie_tx_complete_work);
ENTER();
if (!handle || handle->surprise_removed == MTRUE) {
if (!handle || handle->driver_status == MTRUE ||
handle->surprise_removed == MTRUE) {
LEAVE();
return;
}
@ -15100,6 +15189,7 @@ done:
handle->user_data = NULL;
}
handle->mode_psd_string[0] = '\0';
handle->mode_psd_ru_string[0] = '\0';
LEAVE();
return;
}
@ -15357,7 +15447,12 @@ static int woal_init_module(void)
woal_init_from_dev_tree();
#endif
/* Create workqueue for hang process */
#if defined(USB) && defined(USB_CUSTOMER_VIDPID)
if (c_vidpid != NULL)
woal_usb_init_extended_table(c_vidpid);
#endif
/* Create workqueue for hang process */
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 14)
/* For kernel less than 2.6.14 name can not be greater than 10
characters */
@ -15831,6 +15926,11 @@ MODULE_PARM_DESC(
reg_work,
"0: disable register work_queue; 1: enable register work_queue");
#if defined(USB) && defined(USB_CUSTOMER_VIDPID)
module_param(c_vidpid, charp, 0);
MODULE_PARM_DESC(c_vidpid, "Customer USB VID/PID configuration file");
#endif
MODULE_DESCRIPTION("M-WLAN Driver");
MODULE_AUTHOR("NXP");
MODULE_VERSION(MLAN_RELEASE_VERSION);

View file

@ -250,7 +250,7 @@ Change log:
#define IEEE80211_NUM_BANDS NUM_NL80211_BANDS
#endif
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 4, 0)
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 8, 0)
#define IEEE80211_BAND_6GHZ NL80211_BAND_6GHZ
#endif
@ -439,6 +439,10 @@ typedef enum _MOAL_HARDWARE_STATUS {
/** fw cap info BGA */
#define FW_CAPINFO_80211BGA (MBIT(8) | MBIT(9) | MBIT(10))
#define NUM_2G_CHAN 14
#define NUM_5G_CHAN 42
#define NUM_6G_CHAN 59
/** moal_wait_option */
enum { MOAL_NO_WAIT, MOAL_IOCTL_WAIT, MOAL_IOCTL_WAIT_TIMEOUT };
@ -2211,6 +2215,11 @@ struct _moal_private {
moal_priv_linkstats_cfg plinkstats_cfg;
moal_priv_linkstats plinkstats;
#if defined(STA_CFG80211) || defined(UAP_CFG80211)
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0)
struct cfg80211_qos_map *qos_map;
#endif
#endif
/*BSS active time*/
t_u64 bss_active_time;
@ -2654,6 +2663,27 @@ int woal_enable_fw_roaming(moal_private *priv, int data);
#define GTK_REKEY_OFFLOAD_ENABLE 1
#define GTK_REKEY_OFFLOAD_SUSPEND 2
#if defined(STA_CFG80211)
struct chan_power {
/** channel hw value */
t_u8 channel;
/** max tx power value */
t_u8 max_tx_pwr;
};
/** peer countryIE information */
typedef struct _peer_country_info {
/** country code */
t_u8 country_code[COUNTRY_CODE_LEN];
/** for all channels in 2GHz band */
struct chan_power band_2g[NUM_2G_CHAN];
/** for all channels in 5GHz band */
struct chan_power band_5g[NUM_5G_CHAN];
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 8, 0)
/** for all channels in 6GHz band */
struct chan_power band_6g[NUM_6G_CHAN];
#endif
} peer_country_info_t;
#endif
/** Supported bandwidth for monitor mode */
enum {
SNIFF_BW_20MHZ = 0,
@ -2778,6 +2808,7 @@ typedef struct _moal_mod_para {
char *fw_name;
int fw_reload;
int auto_fw_reload;
char *wifi_fw_name;
char *mac_addr;
#ifdef MFG_CMD_SUPPORT
int mfg_mode;
@ -3058,6 +3089,8 @@ struct _moal_handle {
const struct firmware *txpwr_data;
/** Operation Mode PSD String */
char mode_psd_string[64];
/** Operation Mode PSD RU String */
char mode_psd_ru_string[64];
/** Load time file name */
char mode_psd_file[64];
/** Hotplug device */
@ -3236,6 +3269,10 @@ struct _moal_handle {
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(4, 0, 0)
/** regulatory work */
struct work_struct regulatory_work;
#endif
#if defined(STA_CFG80211)
/** peer countryIE information */
peer_country_info_t peer_country_info;
#endif
/** band */
enum ieee80211_band band;
@ -4461,6 +4498,9 @@ mlan_status woal_get_wpa_enable(moal_private *priv, t_u8 wait_option,
#endif /**STA_SUPPORT */
mlan_status woal_set_11d(moal_private *priv, t_u8 wait_option, t_u8 enable);
#if defined(STA_CFG80211)
void woal_reset_peer_country_info(moal_private *priv);
#endif
mlan_status woal_process_rf_test_mode(moal_handle *handle, t_u32 mode);
mlan_status woal_process_rf_test_mode_cmd(moal_handle *handle, t_u32 cmd,
@ -4839,7 +4879,9 @@ void woal_print_linkstats_info(moal_private *priv, bool is_reset);
mlan_status woal_get_ch_load(moal_private *priv, t_u16 duration);
mlan_status woal_get_ch_load_results(moal_private *priv, t_u16 *ch_load,
t_s16 *noise);
#ifdef UAP_SUPPORT
mlan_status woal_get_sta_list(moal_private *priv, mlan_ds_sta_list *sta_list);
#endif
#ifdef DUMP_TO_PROC
void woal_print_firmware_dump_buf(t_u8 *pfd_buf, t_u64 fwdump_len);
@ -4893,4 +4935,7 @@ extern mlan_status moal_agcs_trans_state(moal_private *priv,
extern void woal_agcs_event(moal_private *priv, pagcs_event pacs_start_event);
#endif /* UAP_SUPPORT */
#if defined(USB) && defined(USB_CUSTOMER_VIDPID)
extern mlan_status check_device_name_info(char *device_name, t_u16 *card_type);
#endif
#endif /* _MOAL_MAIN_H */

View file

@ -188,10 +188,11 @@ static t_u16 woal_update_card_type(t_void *card)
moal_memcpy_ext(NULL, driver_version, CARD_PCIE8897,
strlen(CARD_PCIE8897), strlen(driver_version));
/* we are copying card name in middle of full version, we can
not copy null termination. This was already tried and
reverted as full version got terminated in middlei(See commit
57c27201f9a23562337491f3cbb9833ca348076c). thus suppressing
the coverity warning for all card types in this function. */
* not copy null termination. This was already tried and
* reverted as full version got terminated in middle(See commit
* 57c27201f9a23562337491f3cbb9833ca348076c). thus suppressing
* the coverity warning for all card types in this function.
*/
// coverity[string_null:SUPPRESS]
// coverity[cert_str32_c_violation:SUPPRESS]
moal_memcpy_ext(NULL,
@ -207,6 +208,12 @@ static t_u16 woal_update_card_type(t_void *card)
card_type = CARD_TYPE_PCIE8997;
moal_memcpy_ext(NULL, driver_version, CARD_PCIE8997,
strlen(CARD_PCIE8997), strlen(driver_version));
/* we are copying card name in middle of full version, we can
* not copy null termination. This was already tried and
* reverted as full version got terminated in middle(See commit
* 57c27201f9a23562337491f3cbb9833ca348076c). thus suppressing
* the coverity warning for all card types in this function.
*/
// coverity[string_null:SUPPRESS]
// coverity[cert_str32_c_violation:SUPPRESS]
moal_memcpy_ext(NULL,
@ -222,6 +229,12 @@ static t_u16 woal_update_card_type(t_void *card)
card_type = CARD_TYPE_PCIE9097;
moal_memcpy_ext(NULL, driver_version, CARD_PCIE9097,
strlen(CARD_PCIE9097), strlen(driver_version));
/* we are copying card name in middle of full version, we can
* not copy null termination. This was already tried and
* reverted as full version got terminated in middle(See commit
* 57c27201f9a23562337491f3cbb9833ca348076c). thus suppressing
* the coverity warning for all card types in this function.
*/
// coverity[string_null:SUPPRESS]
// coverity[cert_str32_c_violation:SUPPRESS]
moal_memcpy_ext(NULL,
@ -238,6 +251,12 @@ static t_u16 woal_update_card_type(t_void *card)
card_type = CARD_TYPE_PCIE9098;
moal_memcpy_ext(NULL, driver_version, CARD_PCIE9098,
strlen(CARD_PCIE9098), strlen(driver_version));
/* we are copying card name in middle of full version, we can
* not copy null termination. This was already tried and
* reverted as full version got terminated in middle(See commit
* 57c27201f9a23562337491f3cbb9833ca348076c). thus suppressing
* the coverity warning for all card types in this function.
*/
// coverity[string_null:SUPPRESS]
// coverity[cert_str32_c_violation:SUPPRESS]
moal_memcpy_ext(NULL,
@ -254,6 +273,12 @@ static t_u16 woal_update_card_type(t_void *card)
card_type = CARD_TYPE_PCIEAW693;
moal_memcpy_ext(NULL, driver_version, CARD_PCIEAW693,
strlen(CARD_PCIEAW693), strlen(driver_version));
/* we are copying card name in middle of full version, we can
* not copy null termination. This was already tried and
* reverted as full version got terminated in middle(See commit
* 57c27201f9a23562337491f3cbb9833ca348076c). thus suppressing
* the coverity warning for all card types in this function.
*/
// coverity[string_null:SUPPRESS]
// coverity[cert_str32_c_violation:SUPPRESS]
moal_memcpy_ext(NULL,
@ -269,6 +294,12 @@ static t_u16 woal_update_card_type(t_void *card)
card_type = CARD_TYPE_PCIEIW624;
moal_memcpy_ext(NULL, driver_version, CARD_PCIEIW624,
strlen(CARD_PCIEIW624), strlen(driver_version));
/* we are copying card name in middle of full version, we can
* not copy null termination. This was already tried and
* reverted as full version got terminated in middle(See commit
* 57c27201f9a23562337491f3cbb9833ca348076c). thus suppressing
* the coverity warning for all card types in this function.
*/
// coverity[string_null:SUPPRESS]
// coverity[cert_str32_c_violation:SUPPRESS]
moal_memcpy_ext(NULL,

View file

@ -428,6 +428,8 @@ static int parse_cmd52_string(const char *buffer, size_t len, int *func,
moal_memcpy_ext(NULL, string, buffer + strlen("sdcmd52rw="),
len - strlen("sdcmd52rw="), CMD52_STR_LEN - 1);
// Ensure null termination
string[CMD52_STR_LEN - 1] = '\0';
tmp = string;
string = strstrip(string);
@ -766,6 +768,10 @@ static ssize_t woal_config_write(struct file *f, const char __user *buf,
}
if (!strncmp(databuf, "drop_point=", strlen("drop_point="))) {
line += strlen("drop_point") + 1;
/* line is assigned from databuf, which is checked for NULL
* before use. Therefore, line is guaranteed to be non-NULL at
* this point.
*/
// coverity[string_null:SUPPRESS]
config_data = (t_u32)woal_string_to_number(line);
if (config_data) {

View file

@ -331,14 +331,31 @@ static void woal_sdio_interrupt(struct sdio_func *func)
*/
static void woal_sdio_oob_irq_work(struct work_struct *work)
{
sdio_mmc_card *card =
container_of(work, sdio_mmc_card, sdio_oob_irq_work);
struct mmc_card *mmc_card = card->func->card;
sdio_mmc_card *card = NULL;
struct mmc_card *mmc_card = NULL;
struct sdio_func *func;
unsigned char pending;
int i;
int ret;
if (!work) {
PRINTM(MERROR, "Invalid work structure pointer\n");
return;
}
// Use safe container_of with proper type validation
// Coverity raised error for kernel API.
// coverity[cert_arr39_c_violation:SUPPRESS]
card = container_of(work, sdio_mmc_card, sdio_oob_irq_work);
// Validate the resulting card pointer and its members
if (!card || !card->func || !card->func->card) {
PRINTM(MERROR, "Invalid sdio_mmc_card structure or members\n");
return;
}
mmc_card = card->func->card;
for (i = 0; i < mmc_card->sdio_funcs; i++) {
func = NULL;
if (mmc_card->sdio_func[i]) {
@ -587,7 +604,7 @@ static t_u16 woal_update_card_type(t_void *card)
driver_version + strlen(INTF_CARDTYPE) +
strlen(KERN_VERSION),
V15, strlen(V15),
strlen(driver_version) -
strnlen(driver_version, MLAN_MAX_VER_STR_LEN - 1) -
(strlen(INTF_CARDTYPE) + strlen(KERN_VERSION)));
}
#endif
@ -602,7 +619,7 @@ static t_u16 woal_update_card_type(t_void *card)
driver_version + strlen(INTF_CARDTYPE) +
strlen(KERN_VERSION),
V15, strlen(V15),
strlen(driver_version) -
strnlen(driver_version, MLAN_MAX_VER_STR_LEN - 1) -
(strlen(INTF_CARDTYPE) + strlen(KERN_VERSION)));
}
#endif
@ -616,7 +633,7 @@ static t_u16 woal_update_card_type(t_void *card)
driver_version + strlen(INTF_CARDTYPE) +
strlen(KERN_VERSION),
V16, strlen(V16),
strlen(driver_version) -
strnlen(driver_version, MLAN_MAX_VER_STR_LEN - 1) -
(strlen(INTF_CARDTYPE) + strlen(KERN_VERSION)));
}
#endif
@ -630,7 +647,7 @@ static t_u16 woal_update_card_type(t_void *card)
driver_version + strlen(INTF_CARDTYPE) +
strlen(KERN_VERSION),
V16, strlen(V16),
strlen(driver_version) -
strnlen(driver_version, MLAN_MAX_VER_STR_LEN - 1) -
(strlen(INTF_CARDTYPE) + strlen(KERN_VERSION)));
}
#endif
@ -644,7 +661,7 @@ static t_u16 woal_update_card_type(t_void *card)
driver_version + strlen(INTF_CARDTYPE) +
strlen(KERN_VERSION),
V16, strlen(V16),
strlen(driver_version) -
strnlen(driver_version, MLAN_MAX_VER_STR_LEN - 1) -
(strlen(INTF_CARDTYPE) + strlen(KERN_VERSION)));
}
#endif
@ -658,7 +675,7 @@ static t_u16 woal_update_card_type(t_void *card)
driver_version + strlen(INTF_CARDTYPE) +
strlen(KERN_VERSION),
V16, strlen(V16),
strlen(driver_version) -
strnlen(driver_version, MLAN_MAX_VER_STR_LEN - 1) -
(strlen(INTF_CARDTYPE) + strlen(KERN_VERSION)));
}
#endif
@ -672,7 +689,7 @@ static t_u16 woal_update_card_type(t_void *card)
driver_version + strlen(INTF_CARDTYPE) +
strlen(KERN_VERSION),
V18, strlen(V18),
strlen(driver_version) -
strnlen(driver_version, MLAN_MAX_VER_STR_LEN - 1) -
(strlen(INTF_CARDTYPE) + strlen(KERN_VERSION)));
}
#endif
@ -687,7 +704,7 @@ static t_u16 woal_update_card_type(t_void *card)
driver_version + strlen(INTF_CARDTYPE) +
strlen(KERN_VERSION),
V17, strlen(V17),
strlen(driver_version) -
strnlen(driver_version, MLAN_MAX_VER_STR_LEN - 1) -
(strlen(INTF_CARDTYPE) + strlen(KERN_VERSION)));
}
#endif
@ -701,7 +718,7 @@ static t_u16 woal_update_card_type(t_void *card)
driver_version + strlen(INTF_CARDTYPE) +
strlen(KERN_VERSION),
V17, strlen(V17),
strlen(driver_version) -
strnlen(driver_version, MLAN_MAX_VER_STR_LEN - 1) -
(strlen(INTF_CARDTYPE) + strlen(KERN_VERSION)));
}
#endif
@ -716,7 +733,7 @@ static t_u16 woal_update_card_type(t_void *card)
driver_version + strlen(INTF_CARDTYPE) +
strlen(KERN_VERSION),
V17, strlen(V17),
strlen(driver_version) -
strnlen(driver_version, MLAN_MAX_VER_STR_LEN - 1) -
(strlen(INTF_CARDTYPE) + strlen(KERN_VERSION)));
}
#endif
@ -730,7 +747,7 @@ static t_u16 woal_update_card_type(t_void *card)
driver_version + strlen(INTF_CARDTYPE) +
strlen(KERN_VERSION),
V18, strlen(V18),
strlen(driver_version) -
strnlen(driver_version, MLAN_MAX_VER_STR_LEN - 1) -
(strlen(INTF_CARDTYPE) + strlen(KERN_VERSION)));
}
#endif
@ -744,7 +761,7 @@ static t_u16 woal_update_card_type(t_void *card)
driver_version + strlen(INTF_CARDTYPE) +
strlen(KERN_VERSION),
V18, strlen(V18),
strlen(driver_version) -
strnlen(driver_version, MLAN_MAX_VER_STR_LEN - 1) -
(strlen(INTF_CARDTYPE) + strlen(KERN_VERSION)));
}
#endif
@ -910,14 +927,22 @@ void woal_wlan_is_suspended(moal_handle *handle)
*/
void woal_sdio_shutdown(struct device *dev)
{
struct sdio_func *func = dev_to_sdio_func(dev);
moal_handle *handle = NULL;
sdio_mmc_card *cardp;
mlan_ds_ps_info pm_info;
int i, retry_num = 8;
struct sdio_func *func;
ENTER();
PRINTM(MCMND, "<--- Enter woal_sdio_shutdown --->\n");
if (!dev) {
PRINTM(MERROR, "Invalid device pointer in resume\n");
LEAVE();
return;
}
// Coverity violation raised for kernel's API
// coverity[cert_arr39_c_violation:SUPPRESS]
func = dev_to_sdio_func(dev);
cardp = sdio_get_drvdata(func);
if (!cardp || !cardp->handle) {
PRINTM(MERROR, "Card or moal_handle structure is not valid\n");
@ -994,7 +1019,6 @@ done:
*/
int woal_sdio_suspend(struct device *dev)
{
struct sdio_func *func = dev_to_sdio_func(dev);
mmc_pm_flag_t pm_flags = 0;
moal_handle *handle = NULL;
sdio_mmc_card *cardp;
@ -1003,8 +1027,18 @@ int woal_sdio_suspend(struct device *dev)
int hs_actived = 0;
mlan_ds_ps_info pm_info;
struct sdio_func *func;
ENTER();
PRINTM(MCMND, "<--- Enter woal_sdio_suspend --->\n");
if (!dev) {
PRINTM(MERROR, "Invalid device pointer in resume\n");
LEAVE();
return MLAN_STATUS_FAILURE;
}
// coverity issue raised for kernel's API
// coverity[cert_arr39_c_violation:SUPPRESS]
func = dev_to_sdio_func(dev);
pm_flags = sdio_get_host_pm_caps(func);
PRINTM(MCMND, "%s: suspend: PM flags = 0x%x\n", sdio_func_id(func),
pm_flags);
@ -1129,14 +1163,22 @@ done:
*/
int woal_sdio_resume(struct device *dev)
{
struct sdio_func *func = dev_to_sdio_func(dev);
mmc_pm_flag_t pm_flags = 0;
moal_handle *handle = NULL;
sdio_mmc_card *cardp;
int i;
struct sdio_func *func;
ENTER();
PRINTM(MCMND, "<--- Enter woal_sdio_resume --->\n");
if (!dev) {
PRINTM(MERROR, "Invalid device pointer in resume\n");
LEAVE();
return MLAN_STATUS_FAILURE;
}
// coverity issue raised for Kernel's API
// coverity[cert_arr39_c_violation:SUPPRESS]
func = dev_to_sdio_func(dev);
pm_flags = sdio_get_host_pm_caps(func);
PRINTM(MCMND, "%s: resume: PM flags = 0x%x\n", sdio_func_id(func),
pm_flags);
@ -1824,6 +1866,9 @@ static mlan_status woal_sdiommc_get_fw_name(moal_handle *handle)
t_u32 host_strap_reg = handle->card_info->host_strap_reg;
t_u32 strap = 0;
#endif
#if defined(SDAW693) || defined(SDIW610)
char *se_pos = NULL;
#endif
ENTER();
@ -1843,7 +1888,10 @@ static mlan_status woal_sdiommc_get_fw_name(moal_handle *handle)
woal_sdiommc_read_reg(handle, magic_reg, &magic);
/** Revision ID register */
woal_sdiommc_read_reg(handle, host_strap_reg, &strap);
strap &= 0x1;
if (IS_SDIW624(handle->card_type))
strap &= 0x07;
else
strap &= 0x1;
magic &= 0xFF;
/* 1 = SDSD, 0 --SD UART */
PRINTM(MCMND, "magic=0x%x strap=0x%x\n", magic, strap);
@ -2039,16 +2087,17 @@ static mlan_status woal_sdiommc_get_fw_name(moal_handle *handle)
SDAW693_WLAN_V1_FW_NAME, FW_NAMW_MAX_LEN);
if (magic != 0x03) {
/* remove extension .se */
if (strstr(handle->card_info->fw_name, ".se"))
memset(strstr(handle->card_info->fw_name,
".se"),
'\0', sizeof(".se"));
if (strstr(handle->card_info->fw_name_wlan,
".se"))
memset(strstr(handle->card_info
->fw_name_wlan,
".se"),
'\0', sizeof(".se"));
se_pos = strstr(handle->card_info->fw_name,
".se");
if (se_pos) {
memset(se_pos, '\0', sizeof(".se"));
}
se_pos = strstr(handle->card_info->fw_name_wlan,
".se");
if (se_pos) {
memset(se_pos, '\0', sizeof(".se"));
}
}
break;
default:
@ -2173,14 +2222,15 @@ static mlan_status woal_sdiommc_get_fw_name(moal_handle *handle)
SDIW610_DEFAULT_WLAN_FW_NAME, FW_NAMW_MAX_LEN);
if (magic != 0x03) {
/* remove extension .se */
if (strstr(handle->card_info->fw_name, ".se"))
memset(strstr(handle->card_info->fw_name,
".se"),
'\0', sizeof(".se"));
if (strstr(handle->card_info->fw_name_wlan, ".se"))
memset(strstr(handle->card_info->fw_name_wlan,
".se"),
'\0', sizeof(".se"));
se_pos = strstr(handle->card_info->fw_name, ".se");
if (se_pos) {
memset(se_pos, '\0', sizeof(".se"));
}
se_pos = strstr(handle->card_info->fw_name_wlan, ".se");
if (se_pos) {
memset(se_pos, '\0', sizeof(".se"));
}
}
}
#endif
@ -2881,6 +2931,8 @@ static void woal_sdiommc_reg_dbg(moal_handle *phandle)
*/
static void woal_sdiommc_dump_fw_info(moal_handle *phandle)
{
moal_private *priv = NULL;
if (!phandle) {
PRINTM(MERROR, "Could not dump firmwware info\n");
return;
@ -2916,8 +2968,12 @@ static void woal_sdiommc_dump_fw_info(moal_handle *phandle)
woal_sdiommc_reg_dbg(phandle);
if (!phandle->priv_num)
return;
woal_send_fw_dump_complete_event(
woal_get_priv(phandle, MLAN_BSS_ROLE_ANY));
priv = woal_get_priv(phandle, MLAN_BSS_ROLE_ANY);
if (priv) {
woal_send_fw_dump_complete_event(priv);
} else {
PRINTM(MERROR, "Failed to get private structure for BSS\n");
}
mlan_pm_wakeup_card(phandle->pmlan_adapter, MFALSE);
queue_work(phandle->workqueue, &phandle->main_work);
woal_process_hang(phandle);
@ -3407,9 +3463,28 @@ err_init_fw:
*/
static void woal_sdiommc_work(struct work_struct *work)
{
sdio_mmc_card *card = container_of(work, sdio_mmc_card, reset_work);
sdio_mmc_card *card = NULL;
moal_handle *handle = NULL;
moal_handle *ref_handle = NULL;
// Validate work pointer before container_of operation
if (!work) {
PRINTM(MERROR, "Invalid work structure pointer\n");
return;
}
// Use safe container_of with proper type validation
// Coverity raised error for kernel API
// coverity[cert_arr39_c_violation:SUPPRESS]
card = container_of(work, sdio_mmc_card, reset_work);
// Validate the resulting card pointer
if (!card) {
PRINTM(MERROR,
"Failed to get sdio_mmc_card from work structure\n");
return;
}
PRINTM(MMSG, "========START IN-BAND RESET===========\n");
handle = card->handle;
woal_send_auto_recovery_start_event(handle);
@ -3467,8 +3542,7 @@ static void woal_sdiommc_work(struct work_struct *work)
}
card->work_flags = MFALSE;
wifi_status = WIFI_STATUS_OK;
if (handle)
woal_send_auto_recovery_complete_event(handle);
woal_send_auto_recovery_complete_event(handle);
PRINTM(MMSG, "========END IN-BAND RESET===========\n");
return;
}

File diff suppressed because it is too large Load diff

View file

@ -738,7 +738,7 @@ static int woal_cfg80211_set_monitor_channel(struct wiphy *wiphy,
band_chan_cfg.band = BAND_2GHZ;
else if (chandef->chan->band == IEEE80211_BAND_5GHZ)
band_chan_cfg.band = BAND_5GHZ;
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 4, 0)
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 8, 0)
else if (chandef->chan->band == IEEE80211_BAND_6GHZ)
band_chan_cfg.band = BAND_6GHZ;
#endif
@ -998,6 +998,20 @@ done:
return ret;
}
/**
* @brief Reset peer country information
*
* @param priv A pointer to moal private structure
* @return void
*/
void woal_reset_peer_country_info(moal_private *priv)
{
ENTER();
if (priv && priv->phandle)
memset((void *)&priv->phandle->peer_country_info, 0,
sizeof(peer_country_info_t));
LEAVE();
}
/**
* @brief configure ASSOC IE
*
@ -1179,9 +1193,8 @@ static int woal_cfg80211_assoc_ies_cfg(moal_private *priv, const t_u8 *ie,
pcurrent_ptr, NULL,
&total_ie_len, wait_option)) {
PRINTM(MERROR, "Fail to set GEN IE\n");
// coverity[misra_c_2012_rule_11_8_violation:SUPPRESS]
DBG_HEXDUMP(MCMD_D, "GEN IE",
(t_u8 *)pcurrent_ptr, total_ie_len);
DBG_HEXDUMP(MCMD_D, "GEN IE", pcurrent_ptr,
total_ie_len);
ret = -EFAULT;
goto done;
}
@ -1297,6 +1310,71 @@ error:
}
#endif
/**
* @brief Get peer country info channel max tx pwr
*
* @param priv A pointer to moal_private structure
* @param band band
* @param chan hw channel number
*
* @return power value or 0xff
*/
static t_u8 woal_get_peer_country_pwr(moal_private *priv,
struct ieee80211_channel *channel)
{
t_u8 i = 0, pwr = 0xff;
peer_country_info_t *p = NULL;
if (priv == NULL || priv->phandle == NULL)
return pwr;
p = (peer_country_info_t *)&priv->phandle->peer_country_info;
switch (channel->band) {
case IEEE80211_BAND_2GHZ:
while (i < NUM_2G_CHAN) {
if (p->band_2g[i].channel == 0)
break;
/* return power value of the matched channel entry */
if (p->band_2g[i].channel == (t_u8)channel->hw_value) {
pwr = p->band_2g[i].max_tx_pwr;
break;
}
i++;
}
break;
case IEEE80211_BAND_5GHZ:
while (i < NUM_5G_CHAN) {
if (p->band_5g[i].channel == 0)
break;
/* return power value of the matched channel entry */
if (p->band_5g[i].channel == (t_u8)channel->hw_value) {
pwr = p->band_5g[i].max_tx_pwr;
break;
}
i++;
}
break;
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 8, 0)
case IEEE80211_BAND_6GHZ:
while (i < NUM_6G_CHAN) {
if (p->band_6g[i].channel == 0)
break;
/* return power value of the matched channel entry */
if (p->band_6g[i].channel == (t_u8)channel->hw_value) {
pwr = p->band_6g[i].max_tx_pwr;
break;
}
i++;
}
break;
#endif
default:
break;
}
return pwr;
}
/**
* @brief Send domain info command to FW
*
@ -1314,8 +1392,10 @@ static mlan_status woal_send_domain_info_cmd_fw(moal_private *priv,
struct ieee80211_channel *channel = NULL;
t_u8 no_of_sub_band = 0;
t_u8 no_of_parsed_chan = 0;
t_u8 first_chan = 0, next_chan = 0, max_pwr = 0;
t_u8 first_chan = 0, next_chan = 0;
t_u8 max_pwr = 0, pwr = 0;
t_u8 i, flag = 0;
t_bool check_country_info_pwr = MFALSE;
mlan_ds_11d_cfg *cfg_11d = NULL;
mlan_ioctl_req *req = NULL;
mlan_status status = MLAN_STATUS_SUCCESS;
@ -1365,6 +1445,24 @@ static mlan_status woal_send_domain_info_cmd_fw(moal_private *priv,
cfg_11d->param.domain_info.band = woal_ieee_band_to_radio_type(band);
sband = priv->wdev->wiphy->bands[band];
if ((!priv->phandle->params.reg_alpha2 ||
strncmp(priv->phandle->params.reg_alpha2, "99", strlen("99")))
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0)
&& (!moal_extflg_isset(priv->phandle, EXT_COUNTRY_IE_IGNORE))
#endif
) {
/* lookup the peer country info table, only if the country
* code saved from the country ie in the beacon matches with
* the current country code set in the priv handle
*/
if ((priv->phandle->peer_country_info.country_code[0] ==
priv->phandle->country_code[0]) &&
(priv->phandle->peer_country_info.country_code[1] ==
priv->phandle->country_code[1]))
check_country_info_pwr = MTRUE;
}
for (i = 0; (i < sband->n_channels) &&
(no_of_sub_band < MRVDRV_MAX_SUBBAND_802_11D);
i++) {
@ -1372,16 +1470,27 @@ static mlan_status woal_send_domain_info_cmd_fw(moal_private *priv,
if (channel->flags & IEEE80211_CHAN_DISABLED)
continue;
pwr = channel->max_power;
/* get the minimum tx power value among the db.txt and the saved
* ext-AP's countryIE, and insert it into the channel triplet.
* This ensures that we stay within the regulatory domain
* limits by configuring db.txt values, in case where an
* ext-AP advertizes higher power values in countryIE.
*/
if (check_country_info_pwr)
pwr = MIN(pwr,
woal_get_peer_country_pwr(priv, channel));
if (!flag) {
flag = 1;
next_chan = first_chan = (t_u32)channel->hw_value;
max_pwr = channel->max_power;
max_pwr = pwr;
no_of_parsed_chan = 1;
continue;
}
if (channel->hw_value == next_chan + 1 &&
channel->max_power == max_pwr) {
if (channel->hw_value == next_chan + 1 && pwr == max_pwr) {
next_chan++;
no_of_parsed_chan++;
} else {
@ -1390,10 +1499,10 @@ static mlan_status woal_send_domain_info_cmd_fw(moal_private *priv,
cfg_11d->param.domain_info.sub_band[no_of_sub_band]
.no_of_chan = no_of_parsed_chan;
cfg_11d->param.domain_info.sub_band[no_of_sub_band]
.max_tx_pwr = max_pwr;
.max_tx_pwr = pwr;
no_of_sub_band++;
next_chan = first_chan = (t_u32)channel->hw_value;
max_pwr = channel->max_power;
max_pwr = pwr;
no_of_parsed_chan = 1;
}
}
@ -1476,7 +1585,7 @@ static mlan_status woal_dnld_chan_attr(moal_private *priv, t_bool is6g,
ca = (mlan_ds_chan_attr *)&misc->param.chan_attr_cfg;
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 4, 0)
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 8, 0)
if (is6g) {
req->action = MLAN_ACT_SET_6G_CFP_TBL;
sband = wiphy->bands[NL80211_BAND_6GHZ];
@ -1957,9 +2066,12 @@ static int woal_process_country_ie(moal_private *priv, struct cfg80211_bss *bss)
const u8 *country_ie;
u8 country_ie_len;
int ret = 0;
mlan_ioctl_req *req = NULL;
mlan_ds_11d_cfg *cfg_11d = NULL;
mlan_status status = MLAN_STATUS_SUCCESS;
mlan_ds_11d_domain_info domain_info;
enum ieee80211_band band;
struct ieee80211_supported_band *sband = NULL;
struct ieee80211_channel *channel = NULL;
t_u8 i, j = 0, n = 0;
t_u8 pwr = 0, chan_num = 0, chan_count = 0;
ENTER();
@ -1968,6 +2080,11 @@ static int woal_process_country_ie(moal_private *priv, struct cfg80211_bss *bss)
LEAVE();
return 0;
}
if (!priv->wdev || !priv->wdev->wiphy) {
PRINTM(MERROR, "%s(): No wdev or wiphy in wdev\n", __func__);
LEAVE();
return 0;
}
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(4, 0, 0)
if (priv->wdev && priv->wdev->wiphy &&
(priv->wdev->wiphy->regulatory_flags &
@ -2007,57 +2124,85 @@ static int woal_process_country_ie(moal_private *priv, struct cfg80211_bss *bss)
woal_set_region_code(priv, priv->phandle->country_code))
PRINTM(MERROR, "Set country code failed!\n");
/* Allocate an IOCTL request buffer */
req = woal_alloc_mlan_ioctl_req(sizeof(mlan_ds_11d_cfg));
if (req == NULL) {
rcu_read_unlock();
PRINTM(MERROR, "Fail to allocate mlan_ds_11d_cfg buffer\n");
ret = MLAN_STATUS_FAILURE;
goto done;
}
cfg_11d = (mlan_ds_11d_cfg *)req->pbuf;
cfg_11d->sub_command = MLAN_OID_11D_DOMAIN_INFO_EXT;
req->req_id = MLAN_IOCTL_11D_CFG;
req->action = MLAN_ACT_SET;
cfg_11d->param.domain_info.dfs_region = NXP_DFS_UNKNOWN;
/* Set country code */
cfg_11d->param.domain_info.country_code[0] =
priv->phandle->country_code[0];
cfg_11d->param.domain_info.country_code[1] =
priv->phandle->country_code[1];
cfg_11d->param.domain_info.country_code[2] = ' ';
/** IEEE80211_BAND_2GHZ or IEEE80211_BAND_5GHZ */
cfg_11d->param.domain_info.band = priv->phandle->band;
/* save country code from the ie */
priv->phandle->peer_country_info.country_code[0] = country_ie[2];
priv->phandle->peer_country_info.country_code[1] = country_ie[3];
priv->phandle->peer_country_info.country_code[2] = ' ';
country_ie_len -= COUNTRY_CODE_LEN;
cfg_11d->param.domain_info.no_of_sub_band = MIN(
domain_info.no_of_sub_band = MIN(
MRVDRV_MAX_SUBBAND_802_11D,
(country_ie_len / sizeof(struct ieee80211_country_ie_triplet)));
moal_memcpy_ext(priv->phandle,
(u8 *)cfg_11d->param.domain_info.sub_band,
moal_memcpy_ext(priv->phandle, (u8 *)&domain_info.sub_band,
&country_ie[2] + COUNTRY_CODE_LEN,
cfg_11d->param.domain_info.no_of_sub_band *
domain_info.no_of_sub_band *
sizeof(mlan_ds_subband_set_t),
sizeof(cfg_11d->param.domain_info.sub_band));
sizeof(domain_info.sub_band));
band = bss->channel->band;
sband = priv->wdev->wiphy->bands[band];
if (band == IEEE80211_BAND_2GHZ)
chan_count = NUM_2G_CHAN;
else if (band == IEEE80211_BAND_5GHZ)
chan_count = NUM_5G_CHAN;
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 8, 0)
else if (band == IEEE80211_BAND_6GHZ)
chan_count = NUM_6G_CHAN;
#endif
/* Use channel list from the current regulatory settings in the wiphy.
* The reg rules in the countryIe from ext-AP beacon may be different
* from the reg rules defined in db.txt, as a user may opt to customize
* the regulatory database. So, instead of saving the channel triplets
* as is, save the power value in each channel from the first chan up
* to num of channels in each triplet. This also helps in direct
* lookup in the woal_send_domain_info_cmd_fw()
*/
for (i = 0; (i < sband->n_channels) && (i < chan_count) &&
(j < domain_info.no_of_sub_band);
i++) {
channel = &sband->channels[i];
chan_num = (t_u8)channel->hw_value;
if (chan_num == domain_info.sub_band[j].first_chan) {
n = 1;
pwr = domain_info.sub_band[j].max_tx_pwr;
}
if (band == IEEE80211_BAND_2GHZ) {
priv->phandle->peer_country_info.band_2g[i].channel =
chan_num;
if (n)
priv->phandle->peer_country_info.band_2g[i]
.max_tx_pwr = pwr;
} else if (band == IEEE80211_BAND_5GHZ) {
priv->phandle->peer_country_info.band_5g[i].channel =
chan_num;
if (n)
priv->phandle->peer_country_info.band_5g[i]
.max_tx_pwr = pwr;
}
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 8, 0)
else if (band == IEEE80211_BAND_6GHZ) {
priv->phandle->peer_country_info.band_6g[i].channel =
chan_num;
if (n)
priv->phandle->peer_country_info.band_6g[i]
.max_tx_pwr = pwr;
}
#endif
if (n == domain_info.sub_band[j].no_of_chan) {
j++;
n = 0;
} else if (n) {
n++;
}
}
PRINTM(MCMND, "11D: Country IE: %c%c band=%d no_of_sub_band=%d\n",
country_ie[2], country_ie[3], priv->phandle->band,
cfg_11d->param.domain_info.no_of_sub_band);
domain_info.no_of_sub_band);
rcu_read_unlock();
/* Send domain info command to FW */
status = woal_request_ioctl(priv, req, MOAL_IOCTL_WAIT);
if (status != MLAN_STATUS_SUCCESS) {
ret = MLAN_STATUS_FAILURE;
PRINTM(MERROR, "11D: Error setting domain info in FW\n");
goto done;
}
done:
if (status != MLAN_STATUS_PENDING)
kfree(req);
LEAVE();
return ret;
}
@ -2222,6 +2367,8 @@ static void woal_save_assoc_params(moal_private *priv,
struct cfg80211_assoc_request *req,
mlan_ssid_bssid *ssid_bssid)
{
t_u8 *pIe = NULL;
ENTER();
priv->assoc_bss = req->bss;
@ -2237,7 +2384,8 @@ static void woal_save_assoc_params(moal_private *priv,
MLAN_MAC_ADDR_LENGTH);
priv->sme_current.bssid = priv->conn_bssid;
if (req->ie && req->ie_len) {
priv->sme_current.ie = kzalloc(req->ie_len, GFP_ATOMIC);
pIe = kzalloc(req->ie_len, GFP_ATOMIC);
priv->sme_current.ie = pIe;
if (!priv->sme_current.ie) {
PRINTM(MERROR,
"Failed to allocate memory for sme params\n");
@ -2245,10 +2393,8 @@ static void woal_save_assoc_params(moal_private *priv,
return;
}
priv->sme_current.ie_len = req->ie_len;
/* doing memcpy in memory allocated just above */
// coverity[misra_c_2012_rule_11_8_violation:SUPPRESS]
moal_memcpy_ext(priv->phandle, (void *)priv->sme_current.ie,
req->ie, req->ie_len, priv->sme_current.ie_len);
moal_memcpy_ext(priv->phandle, pIe, req->ie, req->ie_len,
priv->sme_current.ie_len);
}
moal_memcpy_ext(priv->phandle, &priv->sme_current.crypto, &req->crypto,
sizeof(struct cfg80211_crypto_settings),
@ -2302,10 +2448,8 @@ static void woal_save_auth_params(moal_private *priv,
priv->sme_current.key_len = req->key_len;
if (req->key && req->key_len && (req->key_len <= MAX_WEP_KEY_SIZE)) {
priv->sme_current.key = priv->conn_wep_key;
// coverity[misra_c_2012_rule_11_8_violation:SUPPRESS]
moal_memcpy_ext(priv->phandle, (t_u8 *)priv->sme_current.key,
req->key, req->key_len,
sizeof(priv->conn_wep_key));
moal_memcpy_ext(priv->phandle, priv->conn_wep_key, req->key,
req->key_len, sizeof(priv->conn_wep_key));
}
LEAVE();
}
@ -3143,7 +3287,7 @@ static mlan_status woal_host_mlme_fallback_to_prev_ap(moal_private *priv)
cfg80211_roamed(priv->netdev, &roam_info, GFP_KERNEL);
priv->cfg_disconnect = MFALSE;
priv->host_mlme = MTRUE;
priv->auth_flag |= HOST_MLME_ASSOC_DONE;
priv->auth_flag = 0;
moal_memcpy_ext(priv->phandle, priv->cfg_bssid,
assoc_info->bssid, MLAN_MAC_ADDR_LENGTH,
MLAN_MAC_ADDR_LENGTH);
@ -3440,6 +3584,10 @@ static void woal_assoc_timeout_event(moal_private *priv,
spin_unlock_irqrestore(&handle->evt_lock, flags);
queue_work(handle->evt_workqueue, &handle->evt_work);
}
/* The allocated evt is added to a queue and processed asynchronously,
* but there's no explicit kfree() in this function,making Coverity
* think it's a memory leak. But the evt is freed at evt work
*/
// coverity[leaked_storage:SUPPRESS]
}
@ -3684,8 +3832,10 @@ static int woal_cfg80211_associate(struct wiphy *wiphy, struct net_device *dev,
&&
(!moal_extflg_isset(priv->phandle, EXT_COUNTRY_IE_IGNORE))
#endif
)
) {
woal_reset_peer_country_info(priv);
woal_process_country_ie(priv, req->bss);
}
}
#ifdef STA_WEXT
@ -3719,10 +3869,8 @@ static int woal_cfg80211_associate(struct wiphy *wiphy, struct net_device *dev,
if (req->ie && req->ie_len) { /* Set the IE */
if (MLAN_STATUS_SUCCESS !=
// Casting is done to read the value
// coverity[misra_c_2012_rule_11_8_violation:SUPPRESS]
woal_cfg80211_assoc_ies_cfg(priv, (t_u8 *)req->ie,
req->ie_len, MOAL_IOCTL_WAIT)) {
woal_cfg80211_assoc_ies_cfg(priv, req->ie, req->ie_len,
MOAL_IOCTL_WAIT)) {
PRINTM(MINFO, "Fail to woal_cfg80211_assoc_ies_cfg\n");
}
}
@ -3812,6 +3960,7 @@ done:
" successfully\n",
priv->netdev->name, MAC2STR(priv->cfg_bssid));
spin_unlock_irqrestore(&priv->connect_lock, flags);
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 8, 0)
if (ssid_bssid->assoc_rsp.assoc_resp_len) {
/* Parse the HE Operation IE from Assoc Response and
* download the 6E PSD table as per the ex-AP Operation
@ -3825,10 +3974,15 @@ done:
ssid_bssid->assoc_rsp.assoc_resp_buf,
ssid_bssid->assoc_rsp.assoc_resp_len,
NULL);
else
else {
memset(priv->phandle->mode_psd_string, 0,
sizeof(priv->phandle->mode_psd_string));
memset(priv->phandle->mode_psd_ru_string, 0,
sizeof(priv->phandle
->mode_psd_ru_string));
}
}
#endif
} else {
PRINTM(MERROR,
"wlan: HostMlme %s Failed to connect to bssid " MACSTR
@ -3940,8 +4094,10 @@ int woal_cfg80211_assoc(moal_private *priv, void *sme, t_u8 wait_option,
&& (!moal_extflg_isset(priv->phandle,
EXT_COUNTRY_IE_IGNORE))
#endif
)
) {
woal_reset_peer_country_info(priv);
woal_process_country_ie(priv, pub);
}
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 9, 0)
cfg80211_put_bss(priv->wdev->wiphy, pub);
#else
@ -4441,28 +4597,34 @@ static mlan_status woal_cfg80211_dump_station_info(moal_private *priv,
return ret;
}
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(4, 0, 0)
sinfo->filled = MBIT(NL80211_STA_INFO_RX_BYTES) |
MBIT(NL80211_STA_INFO_TX_BYTES) |
MBIT(NL80211_STA_INFO_RX_PACKETS) |
MBIT(NL80211_STA_INFO_TX_PACKETS) |
MBIT(NL80211_STA_INFO_SIGNAL) |
MBIT(NL80211_STA_INFO_SIGNAL_AVG) |
MBIT(NL80211_STA_INFO_TX_BITRATE) |
MBIT(NL80211_STA_INFO_RX_BITRATE);
sinfo->filled = MBIT64(NL80211_STA_INFO_RX_BYTES) |
MBIT64(NL80211_STA_INFO_TX_BYTES) |
MBIT64(NL80211_STA_INFO_RX_PACKETS) |
MBIT64(NL80211_STA_INFO_TX_PACKETS) |
MBIT64(NL80211_STA_INFO_SIGNAL) |
MBIT64(NL80211_STA_INFO_SIGNAL_AVG) |
MBIT64(NL80211_STA_INFO_TX_BITRATE) |
MBIT64(NL80211_STA_INFO_RX_BITRATE) |
MBIT64(NL80211_STA_INFO_TX_RETRIES);
#else
sinfo->filled = STATION_INFO_RX_BYTES | STATION_INFO_TX_BYTES |
STATION_INFO_RX_PACKETS | STATION_INFO_TX_PACKETS |
STATION_INFO_SIGNAL | STATION_INFO_TX_BITRATE;
STATION_INFO_SIGNAL | STATION_INFO_TX_BITRATE |
STATION_INFO_TX_RETRIES;
#endif
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(4, 0, 0)
sinfo->filled |= MBIT(NL80211_STA_INFO_TX_FAILED);
sinfo->filled |= MBIT64(NL80211_STA_INFO_TX_FAILED);
#else
sinfo->filled |= STATION_INFO_TX_FAILED;
#endif
#endif
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(4, 19, 0)
sinfo->filled |= MBIT64(NL80211_STA_INFO_FCS_ERROR_COUNT);
#endif
/* Get signal information from the firmware */
memset(&signal, 0, sizeof(mlan_ds_get_signal));
if (MLAN_STATUS_SUCCESS !=
@ -4491,12 +4653,16 @@ static mlan_status woal_cfg80211_dump_station_info(moal_private *priv,
#endif
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)
sinfo->tx_failed = stats.failed;
sinfo->tx_retries = stats.retry;
#endif
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(4, 19, 0)
sinfo->fcs_err_count = stats.fcs_error;
#endif
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 0, 0)
/* Update BSS information */
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(4, 0, 0)
sinfo->filled |= MBIT(NL80211_STA_INFO_BSS_PARAM);
sinfo->filled |= MBIT64(NL80211_STA_INFO_BSS_PARAM);
#else
sinfo->filled |= STATION_INFO_BSS_PARAM;
#endif
@ -4678,7 +4844,7 @@ create_custom_regdomain(moal_private *priv,
}
chflags = custom_reg->cfp_tbl[idx].dynamic.flags;
band = (chan <= 14) ? IEEE80211_BAND_2GHZ : IEEE80211_BAND_5GHZ;
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 4, 0)
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 8, 0)
if (idx >= (custom_reg->num_bg_chan + custom_reg->num_a_chan))
band = IEEE80211_BAND_6GHZ;
#endif
@ -4693,7 +4859,7 @@ create_custom_regdomain(moal_private *priv,
}
if (band == IEEE80211_BAND_5GHZ
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 4, 0)
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 8, 0)
|| band == IEEE80211_BAND_6GHZ
#endif
) {
@ -4967,7 +5133,7 @@ void woal_regulatory_work_queue(struct work_struct *work)
priv->phandle->band = IEEE80211_BAND_5GHZ;
woal_send_domain_info_cmd_fw(priv, MOAL_IOCTL_WAIT);
}
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 4, 0)
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 8, 0)
if (priv->phandle->fw_bands & BAND_6G) {
priv->phandle->band = IEEE80211_BAND_6GHZ;
woal_send_domain_info_cmd_fw(priv, MOAL_IOCTL_WAIT);
@ -5121,9 +5287,9 @@ woal_cfg80211_reg_notifier(struct wiphy *wiphy,
if (priv->wdev && priv->wdev->wiphy &&
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(4, 0, 0)
!(wiphy->regulatory_flags & REGULATORY_WIPHY_SELF_MANAGED) &&
!(wiphy->regulatory_flags & REGULATORY_WIPHY_SELF_MANAGED)
#endif
(request->initiator != NL80211_REGDOM_SET_BY_COUNTRY_IE)) {
) {
band = priv->phandle->band;
priv->phandle->band = IEEE80211_BAND_2GHZ;
woal_send_domain_info_cmd_fw(priv, MOAL_IOCTL_WAIT);
@ -5131,7 +5297,7 @@ woal_cfg80211_reg_notifier(struct wiphy *wiphy,
priv->phandle->band = IEEE80211_BAND_5GHZ;
woal_send_domain_info_cmd_fw(priv, MOAL_IOCTL_WAIT);
}
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 4, 0)
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 8, 0)
if (priv->phandle->fw_bands & BAND_6G) {
priv->phandle->band = IEEE80211_BAND_6GHZ;
woal_send_domain_info_cmd_fw(priv, MOAL_IOCTL_WAIT);
@ -11110,7 +11276,7 @@ mlan_status woal_register_sta_cfg80211(struct net_device *dev, t_u8 bss_type)
priv->phandle->band = IEEE80211_BAND_5GHZ;
woal_send_domain_info_cmd_fw(priv, MOAL_IOCTL_WAIT);
}
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 4, 0)
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 8, 0)
if (priv->phandle->fw_bands & BAND_6G) {
priv->phandle->band = IEEE80211_BAND_6GHZ;
woal_send_domain_info_cmd_fw(priv, MOAL_IOCTL_WAIT);
@ -12041,6 +12207,8 @@ void woal_dnld_sta_6e_psd_table(moal_private *priv, t_u8 *resp_buf,
/* Memset the "mode_psd_string" */
memset(priv->phandle->mode_psd_string, 0,
sizeof(priv->phandle->mode_psd_string));
memset(priv->phandle->mode_psd_ru_string, 0,
sizeof(priv->phandle->mode_psd_ru_string));
/* Parse the HE operation IE */
if (resp_buf != NULL) {
@ -12074,12 +12242,15 @@ void woal_dnld_sta_6e_psd_table(moal_private *priv, t_u8 *resp_buf,
}
switch (reg_info) {
/* Indoor Mode */
/* Indoor Mode */
case AP_MODE_IND: {
/* Copy the initial Reg power string */
strncpy(priv->phandle->mode_psd_string,
"region_pwr_cfg_6G_PSD_",
strlen("region_pwr_cfg_6G_PSD_") + 1);
strncpy(priv->phandle->mode_psd_ru_string,
"subband_ru_power_cfg_6G_PSD_",
strlen("subband_ru_power_cfg_6G_PSD_") + 1);
/* Prepare the 6E operation mode/psd based string */
switch (priv->phandle->dfs_region) {
@ -12101,6 +12272,12 @@ void woal_dnld_sta_6e_psd_table(moal_private *priv, t_u8 *resp_buf,
strncat(priv->phandle->mode_psd_string,
mode_psd_6G[AP_MODE_IND].psd_dbm,
strlen(mode_psd_6G[AP_MODE_IND].psd_dbm));
strncat(priv->phandle->mode_psd_ru_string,
mode_psd_6G[AP_MODE_IND].op_mode,
strlen(mode_psd_6G[AP_MODE_IND].op_mode));
strncat(priv->phandle->mode_psd_ru_string,
mode_psd_6G[AP_MODE_IND].psd_dbm,
strlen(mode_psd_6G[AP_MODE_IND].psd_dbm));
break;
}
/* Standard Power Mode */
@ -12109,6 +12286,9 @@ void woal_dnld_sta_6e_psd_table(moal_private *priv, t_u8 *resp_buf,
strncpy(priv->phandle->mode_psd_string,
"region_pwr_cfg_6G_PSD_",
strlen("region_pwr_cfg_6G_PSD_") + 1);
strncpy(priv->phandle->mode_psd_ru_string,
"subband_ru_power_cfg_6G_PSD_",
strlen("subband_ru_power_cfg_6G_PSD_") + 1);
/* Prepare the 6E operation mode/psd based string */
switch (priv->phandle->dfs_region) {
@ -12130,6 +12310,12 @@ void woal_dnld_sta_6e_psd_table(moal_private *priv, t_u8 *resp_buf,
strncat(priv->phandle->mode_psd_string,
mode_psd_6G[AP_MODE_SP].psd_dbm,
strlen(mode_psd_6G[AP_MODE_SP].psd_dbm));
strncat(priv->phandle->mode_psd_ru_string,
mode_psd_6G[AP_MODE_SP].op_mode,
strlen(mode_psd_6G[AP_MODE_SP].op_mode));
strncat(priv->phandle->mode_psd_ru_string,
mode_psd_6G[AP_MODE_SP].psd_dbm,
strlen(mode_psd_6G[AP_MODE_SP].psd_dbm));
break;
}
/* Very Low Power Mode */
@ -12138,6 +12324,9 @@ void woal_dnld_sta_6e_psd_table(moal_private *priv, t_u8 *resp_buf,
strncpy(priv->phandle->mode_psd_string,
"region_pwr_cfg_6G_PSD_",
strlen("region_pwr_cfg_6G_PSD_") + 1);
strncpy(priv->phandle->mode_psd_ru_string,
"subband_ru_power_cfg_6G_PSD_",
strlen("subband_ru_power_cfg_6G_PSD_") + 1);
/* Prepare the 6E operation mode/psd based string */
switch (priv->phandle->dfs_region) {
@ -12159,6 +12348,12 @@ void woal_dnld_sta_6e_psd_table(moal_private *priv, t_u8 *resp_buf,
strncat(priv->phandle->mode_psd_string,
mode_psd_6G[AP_MODE_VLP].psd_dbm,
strlen(mode_psd_6G[AP_MODE_VLP].psd_dbm));
strncat(priv->phandle->mode_psd_ru_string,
mode_psd_6G[AP_MODE_VLP].op_mode,
strlen(mode_psd_6G[AP_MODE_VLP].op_mode));
strncat(priv->phandle->mode_psd_ru_string,
mode_psd_6G[AP_MODE_VLP].psd_dbm,
strlen(mode_psd_6G[AP_MODE_VLP].psd_dbm));
break;
}
default:
@ -12167,8 +12362,9 @@ void woal_dnld_sta_6e_psd_table(moal_private *priv, t_u8 *resp_buf,
}
/* Download the ex-AP mode specific PSD table */
PRINTM(MCMND, "DFS region = %d Opmode string = %s\n",
priv->phandle->dfs_region, priv->phandle->mode_psd_string);
PRINTM(MCMND, "DFS region = %d Opmode string = %s ru string = %s\n",
priv->phandle->dfs_region, priv->phandle->mode_psd_string,
priv->phandle->mode_psd_ru_string);
if (MLAN_STATUS_SUCCESS !=
woal_request_country_power_table(priv, country_code, MOAL_NO_WAIT,
1)) {
@ -12201,12 +12397,18 @@ mlan_status woal_dnld_default_6e_psd_table(moal_private *priv)
memset(priv->phandle->mode_psd_string, 0,
sizeof(priv->phandle->mode_psd_string));
memset(priv->phandle->mode_psd_ru_string, 0,
sizeof(priv->phandle->mode_psd_ru_string));
/* Copy the initial Reg power string */
strncpy(priv->phandle->mode_psd_string, "region_pwr_cfg_6G",
strlen("region_pwr_cfg_6G") + 1);
strncpy(priv->phandle->mode_psd_ru_string, "subband_ru_power_cfg_6G",
strlen("subband_ru_power_cfg_6G") + 1);
PRINTM(MINFO, "Opmode string = %s\n", priv->phandle->mode_psd_string);
PRINTM(MINFO, "Opmode string = %s ru string = %s\n",
priv->phandle->mode_psd_string,
priv->phandle->mode_psd_ru_string);
if (MLAN_STATUS_SUCCESS !=
woal_request_country_power_table(priv, country_code, MOAL_NO_WAIT,

View file

@ -1379,6 +1379,8 @@ void woal_dnld_uap_6e_psd_table(moal_private *priv, const t_u8 *beacon_buf,
((heoper_ie->option[1] & HE_OPER_CTRL_MASK) >> 3));
memset(priv->phandle->mode_psd_string, 0,
sizeof(priv->phandle->mode_psd_string));
memset(priv->phandle->mode_psd_ru_string, 0,
sizeof(priv->phandle->mode_psd_ru_string));
switch ((heoper_ie->option[1] & HE_OPER_CTRL_MASK) >> 3) {
/* Indoor Mode */
@ -1387,6 +1389,9 @@ void woal_dnld_uap_6e_psd_table(moal_private *priv, const t_u8 *beacon_buf,
strncpy(priv->phandle->mode_psd_string,
"region_pwr_cfg_6G_PSD_",
strlen("region_pwr_cfg_6G_PSD_") + 1);
strncpy(priv->phandle->mode_psd_ru_string,
"subband_ru_power_cfg_6G_PSD_",
strlen("subband_ru_power_cfg_6G_PSD_") + 1);
/* Prepare the 6E operation mode/psd based string */
switch (priv->phandle->dfs_region) {
@ -1414,6 +1419,12 @@ void woal_dnld_uap_6e_psd_table(moal_private *priv, const t_u8 *beacon_buf,
strncat(priv->phandle->mode_psd_string,
mode_psd_6G[UAP_MODE_IND].psd_dbm,
strlen(mode_psd_6G[UAP_MODE_IND].psd_dbm));
strncat(priv->phandle->mode_psd_ru_string,
mode_psd_6G[UAP_MODE_IND].op_mode,
strlen(mode_psd_6G[UAP_MODE_IND].op_mode));
strncat(priv->phandle->mode_psd_ru_string,
mode_psd_6G[UAP_MODE_IND].psd_dbm,
strlen(mode_psd_6G[UAP_MODE_IND].psd_dbm));
break;
}
/* Standard Power Mode */
@ -1422,6 +1433,9 @@ void woal_dnld_uap_6e_psd_table(moal_private *priv, const t_u8 *beacon_buf,
strncpy(priv->phandle->mode_psd_string,
"region_pwr_cfg_6G_PSD_",
strlen("region_pwr_cfg_6G_PSD_") + 1);
strncpy(priv->phandle->mode_psd_ru_string,
"subband_ru_power_cfg_6G_PSD_",
strlen("subband_ru_power_cfg_6G_PSD_") + 1);
/* Prepare the 6E operation mode/psd based string */
switch (priv->phandle->dfs_region) {
@ -1449,6 +1463,12 @@ void woal_dnld_uap_6e_psd_table(moal_private *priv, const t_u8 *beacon_buf,
strncat(priv->phandle->mode_psd_string,
mode_psd_6G[UAP_MODE_SP].psd_dbm,
strlen(mode_psd_6G[UAP_MODE_SP].psd_dbm));
strncat(priv->phandle->mode_psd_ru_string,
mode_psd_6G[UAP_MODE_SP].op_mode,
strlen(mode_psd_6G[UAP_MODE_SP].op_mode));
strncat(priv->phandle->mode_psd_ru_string,
mode_psd_6G[UAP_MODE_SP].psd_dbm,
strlen(mode_psd_6G[UAP_MODE_SP].psd_dbm));
break;
}
/* Very Low Power Mode */
@ -1457,6 +1477,9 @@ void woal_dnld_uap_6e_psd_table(moal_private *priv, const t_u8 *beacon_buf,
strncpy(priv->phandle->mode_psd_string,
"region_pwr_cfg_6G_PSD_",
strlen("region_pwr_cfg_6G_PSD_") + 1);
strncpy(priv->phandle->mode_psd_ru_string,
"subband_ru_power_cfg_6G_PSD_",
strlen("subband_ru_power_cfg_6G_PSD_") + 1);
/* Prepare the 6E operation mode/psd based string */
switch (priv->phandle->dfs_region) {
@ -1484,6 +1507,12 @@ void woal_dnld_uap_6e_psd_table(moal_private *priv, const t_u8 *beacon_buf,
strncat(priv->phandle->mode_psd_string,
mode_psd_6G[UAP_MODE_VLP].psd_dbm,
strlen(mode_psd_6G[UAP_MODE_VLP].psd_dbm));
strncat(priv->phandle->mode_psd_ru_string,
mode_psd_6G[UAP_MODE_VLP].op_mode,
strlen(mode_psd_6G[UAP_MODE_VLP].op_mode));
strncat(priv->phandle->mode_psd_ru_string,
mode_psd_6G[UAP_MODE_VLP].psd_dbm,
strlen(mode_psd_6G[UAP_MODE_VLP].psd_dbm));
break;
}
default:
@ -1495,9 +1524,11 @@ void woal_dnld_uap_6e_psd_table(moal_private *priv, const t_u8 *beacon_buf,
goto done;
}
/* Download the uAP mode specific PSD table */
PRINTM(MMSG, "DFS region = %d Opmode string = %s\n",
PRINTM(MMSG,
"DFS region = %d Opmode string = %s ru string = %s\n",
priv->phandle->dfs_region,
priv->phandle->mode_psd_string);
priv->phandle->mode_psd_string,
priv->phandle->mode_psd_ru_string);
if (MLAN_STATUS_SUCCESS !=
woal_request_country_power_table(priv, country_code,
MOAL_IOCTL_WAIT, 1)) {
@ -2183,9 +2214,12 @@ static int woal_cfg80211_beacon_config(moal_private *priv,
* as per the AP Operation mode */
if (sys_config->bandcfg.chanBand == BAND_6GHZ)
woal_dnld_uap_6e_psd_table(priv, ie, ie_len);
else
else {
memset(priv->phandle->mode_psd_string, 0,
sizeof(priv->phandle->mode_psd_string));
memset(priv->phandle->mode_psd_ru_string, 0,
sizeof(priv->phandle->mode_psd_ru_string));
}
#if CFG80211_VERSION_CODE > KERNEL_VERSION(5, 3, 0)
if (params->twt_responder == MFALSE) {
@ -3061,6 +3095,10 @@ int woal_cfg80211_del_virt_if(struct wiphy *wiphy, struct net_device *dev)
}
}
if (vir_priv && !vir_priv->bss_virtual) {
PRINTM(MERROR, "Block delete interface %s\n", dev->name);
return ret;
}
priv = (moal_private *)woal_get_priv_bss_type(handle,
MLAN_BSS_TYPE_WIFIDIRECT);
if (!priv)
@ -3856,16 +3894,17 @@ int woal_cfg80211_set_beacon(struct wiphy *wiphy, struct net_device *dev,
goto done;
}
}
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 8, 0)
/* Handling for uAP PSD table download for host triggered
* and FW triggered (AP+STA) ECSA cases */
if (params->tail && params->tail_len &&
priv->chan.chan->band == NL80211_BAND_6GHZ) {
// coverity[misra_c_2012_rule_11_8_violation:SUPPRESS]
DBG_HEXDUMP(MCMD_D, "6E ECSA Beacon",
(t_u8 *)params->tail, params->tail_len);
DBG_HEXDUMP(MCMD_D, "6E ECSA Beacon", params->tail,
params->tail_len);
woal_dnld_uap_6e_psd_table(priv, params->tail,
params->tail_len);
}
#endif
#endif
}
@ -3919,6 +3958,14 @@ int woal_cfg80211_del_beacon(struct wiphy *wiphy, struct net_device *dev)
woal_cancel_scan(priv, MOAL_IOCTL_WAIT);
#endif
memset(priv->dscp_map, 0xFF, sizeof(priv->dscp_map));
#ifdef UAP_CFG80211
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0)
if (priv->qos_map) {
kfree(priv->qos_map);
priv->qos_map = NULL;
}
#endif
#endif
woal_deauth_all_station(priv);
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 14, 0)
if (moal_extflg_isset(priv->phandle, EXT_DFS_OFFLOAD))
@ -3988,9 +4035,12 @@ int woal_cfg80211_del_beacon(struct wiphy *wiphy, struct net_device *dev)
}
woal_clear_all_mgmt_ies(priv, MOAL_NO_WAIT);
/* Clear the mode_psd_string for AP stop */
if (priv->phandle->fw_bands & BAND_6G)
if (priv->phandle->fw_bands & BAND_6G) {
memset(priv->phandle->mode_psd_string, 0,
sizeof(priv->phandle->mode_psd_string));
memset(priv->phandle->mode_psd_ru_string, 0,
sizeof(priv->phandle->mode_psd_ru_string));
}
#ifdef STA_SUPPORT
if (!woal_is_any_interface_active(priv->phandle)) {
pmpriv = woal_get_priv((moal_handle *)priv->phandle,
@ -4356,7 +4406,15 @@ int woal_uap_cfg80211_dump_station(struct wiphy *wiphy, struct net_device *dev,
(int)info->param.sta_list.info[idx].rssi);
#if CFG80211_VERSION_CODE >= KERNEL_VERSION(4, 0, 0)
sinfo->filled = BIT(NL80211_STA_INFO_INACTIVE_TIME) |
BIT(NL80211_STA_INFO_RX_BYTES) |
BIT(NL80211_STA_INFO_TX_BYTES) |
BIT(NL80211_STA_INFO_RX_PACKETS) |
BIT(NL80211_STA_INFO_TX_PACKETS) |
BIT(NL80211_STA_INFO_SIGNAL);
sinfo->rx_bytes = info->param.sta_list.info[idx].stats.rx_bytes;
sinfo->tx_bytes = info->param.sta_list.info[idx].stats.tx_bytes;
sinfo->rx_packets = info->param.sta_list.info[idx].stats.rx_packets;
sinfo->tx_packets = info->param.sta_list.info[idx].stats.tx_packets;
#else
sinfo->filled = STATION_INFO_INACTIVE_TIME | STATION_INFO_SIGNAL;
#endif

View file

@ -58,6 +58,11 @@ typedef struct {
/** Name of the USB driver */
static const char usbdriver_name[] = "usbxxx";
#ifdef USB_CUSTOMER_VIDPID
static struct usb_device_id *woal_usb_table_ext = NULL;
static usb_config_t customer_usb_config = {0x0};
#endif
/** This structure contains the device signature */
static struct usb_device_id woal_usb_table[] = {
/* Enter the device signature inside */
@ -703,6 +708,9 @@ static t_u16 woal_update_card_type(t_void *card)
{
struct usb_card_rec *cardp_usb = (struct usb_card_rec *)card;
t_u16 card_type = 0;
#ifdef USB_CUSTOMER_VIDPID
char device_name[MAX_DEVICE_NAME];
#endif
/* Update card type */
#ifdef USB8897
@ -713,12 +721,13 @@ static t_u16 woal_update_card_type(t_void *card)
card_type = CARD_TYPE_USB8897;
moal_memcpy_ext(NULL, driver_version, CARD_USB8897,
strlen(CARD_USB8897), strlen(driver_version));
moal_memcpy_ext(NULL,
driver_version + strlen(INTF_CARDTYPE) +
strlen(KERN_VERSION),
V15, strlen(V15),
strlen(driver_version) - strlen(INTF_CARDTYPE) -
strlen(KERN_VERSION));
moal_memcpy_ext(
NULL,
driver_version + strlen(INTF_CARDTYPE) +
strlen(KERN_VERSION),
V15, strlen(V15),
strnlen(driver_version, MLAN_MAX_VER_STR_LEN - 1) -
strlen(INTF_CARDTYPE) - strlen(KERN_VERSION));
}
#endif
#ifdef USB8997
@ -739,12 +748,13 @@ static t_u16 woal_update_card_type(t_void *card)
card_type = CARD_TYPE_USB8997;
moal_memcpy_ext(NULL, driver_version, CARD_USB8997,
strlen(CARD_USB8997), strlen(driver_version));
moal_memcpy_ext(NULL,
driver_version + strlen(INTF_CARDTYPE) +
strlen(KERN_VERSION),
V16, strlen(V16),
strlen(driver_version) - strlen(INTF_CARDTYPE) -
strlen(KERN_VERSION));
moal_memcpy_ext(
NULL,
driver_version + strlen(INTF_CARDTYPE) +
strlen(KERN_VERSION),
V16, strlen(V16),
strnlen(driver_version, MLAN_MAX_VER_STR_LEN - 1) -
strlen(INTF_CARDTYPE) - strlen(KERN_VERSION));
}
#endif
#ifdef USB8978
@ -755,12 +765,13 @@ static t_u16 woal_update_card_type(t_void *card)
card_type = CARD_TYPE_USB8978;
moal_memcpy_ext(NULL, driver_version, "USBIW416",
strlen("USBIW416"), strlen(driver_version));
moal_memcpy_ext(NULL,
driver_version + strlen(INTF_CARDTYPE) +
strlen(KERN_VERSION),
V16, strlen(V16),
strlen(driver_version) - strlen(INTF_CARDTYPE) -
strlen(KERN_VERSION));
moal_memcpy_ext(
NULL,
driver_version + strlen(INTF_CARDTYPE) +
strlen(KERN_VERSION),
V16, strlen(V16),
strnlen(driver_version, MLAN_MAX_VER_STR_LEN - 1) -
strlen(INTF_CARDTYPE) - strlen(KERN_VERSION));
}
#endif
#ifdef USB9098
@ -771,12 +782,13 @@ static t_u16 woal_update_card_type(t_void *card)
card_type = CARD_TYPE_USB9098;
moal_memcpy_ext(NULL, driver_version, CARD_USB9098,
strlen(CARD_USB9098), strlen(driver_version));
moal_memcpy_ext(NULL,
driver_version + strlen(INTF_CARDTYPE) +
strlen(KERN_VERSION),
V17, strlen(V17),
strlen(driver_version) - strlen(INTF_CARDTYPE) -
strlen(KERN_VERSION));
moal_memcpy_ext(
NULL,
driver_version + strlen(INTF_CARDTYPE) +
strlen(KERN_VERSION),
V17, strlen(V17),
strnlen(driver_version, MLAN_MAX_VER_STR_LEN - 1) -
strlen(INTF_CARDTYPE) - strlen(KERN_VERSION));
}
#endif
#ifdef USB9097
@ -787,12 +799,13 @@ static t_u16 woal_update_card_type(t_void *card)
card_type = CARD_TYPE_USB9097;
moal_memcpy_ext(NULL, driver_version, CARD_USB9097,
strlen(CARD_USB9097), strlen(driver_version));
moal_memcpy_ext(NULL,
driver_version + strlen(INTF_CARDTYPE) +
strlen(KERN_VERSION),
V17, strlen(V17),
strlen(driver_version) - strlen(INTF_CARDTYPE) -
strlen(KERN_VERSION));
moal_memcpy_ext(
NULL,
driver_version + strlen(INTF_CARDTYPE) +
strlen(KERN_VERSION),
V17, strlen(V17),
strnlen(driver_version, MLAN_MAX_VER_STR_LEN - 1) -
strlen(INTF_CARDTYPE) - strlen(KERN_VERSION));
}
#endif
#ifdef USBIW624
@ -803,12 +816,13 @@ static t_u16 woal_update_card_type(t_void *card)
card_type = CARD_TYPE_USBIW624;
moal_memcpy_ext(NULL, driver_version, CARD_USBIW624,
strlen(CARD_USBIW624), strlen(driver_version));
moal_memcpy_ext(NULL,
driver_version + strlen(INTF_CARDTYPE) +
strlen(KERN_VERSION),
V18, strlen(V18),
strlen(driver_version) - strlen(INTF_CARDTYPE) -
strlen(KERN_VERSION));
moal_memcpy_ext(
NULL,
driver_version + strlen(INTF_CARDTYPE) +
strlen(KERN_VERSION),
V18, strlen(V18),
strnlen(driver_version, MLAN_MAX_VER_STR_LEN - 1) -
strlen(INTF_CARDTYPE) - strlen(KERN_VERSION));
}
#endif
#ifdef USBIW610
@ -819,12 +833,68 @@ static t_u16 woal_update_card_type(t_void *card)
card_type = CARD_TYPE_USBIW610;
moal_memcpy_ext(NULL, driver_version, CARD_USBIW610,
strlen(CARD_USBIW610), strlen(driver_version));
moal_memcpy_ext(NULL,
driver_version + strlen(INTF_CARDTYPE) +
strlen(KERN_VERSION),
V18, strlen(V18),
strlen(driver_version) - strlen(INTF_CARDTYPE) -
strlen(KERN_VERSION));
moal_memcpy_ext(
NULL,
driver_version + strlen(INTF_CARDTYPE) +
strlen(KERN_VERSION),
V18, strlen(V18),
strnlen(driver_version, MLAN_MAX_VER_STR_LEN - 1) -
strlen(INTF_CARDTYPE) - strlen(KERN_VERSION));
}
#endif
#ifdef USB_CUSTOMER_VIDPID
if (check_usb_ext_table_info(
device_name, &card_type,
woal_cpu_to_le16(cardp_usb->udev->descriptor.idProduct)) ==
MLAN_STATUS_SUCCESS) {
moal_memcpy_ext(NULL, driver_version, device_name,
strlen(device_name), strlen(driver_version));
if (card_type == CARD_TYPE_USB8801) {
moal_memcpy_ext(NULL,
driver_version + strlen(INTF_CARDTYPE) +
strlen(KERN_VERSION),
V14, strlen(V14),
strlen(driver_version) -
strlen(INTF_CARDTYPE) -
strlen(KERN_VERSION));
} else if (card_type == CARD_TYPE_USB8897) {
moal_memcpy_ext(NULL,
driver_version + strlen(INTF_CARDTYPE) +
strlen(KERN_VERSION),
V15, strlen(V15),
strlen(driver_version) -
strlen(INTF_CARDTYPE) -
strlen(KERN_VERSION));
} else if (card_type == CARD_TYPE_USB8997 ||
card_type == CARD_TYPE_USB8978) {
moal_memcpy_ext(NULL,
driver_version + strlen(INTF_CARDTYPE) +
strlen(KERN_VERSION),
V16, strlen(V16),
strlen(driver_version) -
strlen(INTF_CARDTYPE) -
strlen(KERN_VERSION));
} else if (card_type == CARD_TYPE_USB9098 ||
card_type == CARD_TYPE_USB9097) {
moal_memcpy_ext(NULL,
driver_version + strlen(INTF_CARDTYPE) +
strlen(KERN_VERSION),
V17, strlen(V17),
strlen(driver_version) -
strlen(INTF_CARDTYPE) -
strlen(KERN_VERSION));
} else if (card_type == CARD_TYPE_USBIW624 ||
card_type == CARD_TYPE_USBIW610) {
moal_memcpy_ext(NULL,
driver_version + strlen(INTF_CARDTYPE) +
strlen(KERN_VERSION),
V18, strlen(V18),
strlen(driver_version) -
strlen(INTF_CARDTYPE) -
strlen(KERN_VERSION));
}
}
#endif
return card_type;
@ -847,6 +917,7 @@ static int woal_usb_probe(struct usb_interface *intf,
int i;
struct usb_card_rec *usb_cardp = NULL;
t_u16 card_type = 0;
struct usb_device_id *usb_table = woal_usb_table;
ENTER();
@ -863,12 +934,19 @@ static int woal_usb_probe(struct usb_interface *intf,
return -ENOMEM;
}
#ifdef USB_CUSTOMER_VIDPID
if (woal_usb_table_ext != NULL) {
PRINTM(MINFO, "Use usb table with customer vid pid\n");
usb_table = woal_usb_table_ext;
}
#endif
/* Check probe is for our device */
for (i = 0; woal_usb_table[i].idVendor; i++) {
for (i = 0; usb_table[i].idVendor; i++) {
if (woal_cpu_to_le16(udev->descriptor.idVendor) ==
(__force __le16)woal_usb_table[i].idVendor &&
(__force __le16)usb_table[i].idVendor &&
woal_cpu_to_le16(udev->descriptor.idProduct) ==
(__force __le16)woal_usb_table[i].idProduct) {
(__force __le16)usb_table[i].idProduct) {
PRINTM(MMSG, "VID/PID = %X/%X, Boot2 version = %X\n",
woal_cpu_to_le16(udev->descriptor.idVendor),
woal_cpu_to_le16(udev->descriptor.idProduct),
@ -930,6 +1008,18 @@ static int woal_usb_probe(struct usb_interface *intf,
usb_cardp->boot_state = USB_FW_READY;
break;
#ifdef USB_CUSTOMER_VIDPID
default:
if (check_usb_ext_table_info(
NULL, NULL,
woal_cpu_to_le16(
udev->descriptor
.idProduct)) ==
MLAN_STATUS_SUCCESS)
usb_cardp->boot_state = USB_FW_READY;
break;
#endif
}
/*To do, get card type*/
/* if
@ -944,7 +1034,7 @@ static int woal_usb_probe(struct usb_interface *intf,
}
}
if (woal_usb_table[i].idVendor) {
if (usb_table[i].idVendor) {
usb_cardp->udev = udev;
iface_desc = intf->cur_altsetting;
usb_cardp->intf = intf;
@ -1828,6 +1918,12 @@ mlan_status woal_usb_bus_register(void)
if (skip_fwdnld) {
woal_usb_driver.id_table = woal_usb_table_skip_fwdnld;
}
#ifdef USB_CUSTOMER_VIDPID
if (woal_usb_table_ext != NULL) {
woal_usb_driver.id_table = woal_usb_table_ext;
}
#endif
/*
* API registers the NXP USB driver
* to the USB system
@ -1848,8 +1944,17 @@ mlan_status woal_usb_bus_register(void)
void woal_usb_bus_unregister(void)
{
ENTER();
/* API unregisters the driver from USB subsystem */
usb_deregister(&woal_usb_driver);
#ifdef USB_CUSTOMER_VIDPID
if (woal_usb_table_ext != NULL) {
kfree(woal_usb_table_ext);
woal_usb_table_ext = NULL;
}
#endif
LEAVE();
return;
}
@ -2075,6 +2180,9 @@ static mlan_status woal_usb_get_fw_name(moal_handle *handle)
t_u32 boot_mode = 0;
#endif
struct usb_card_rec *cardp = (struct usb_card_rec *)handle->card;
#ifdef USBIW610
char *ext;
#endif
#if defined(USB9098)
moal_handle *ref_handle = NULL;
#endif
@ -2231,14 +2339,12 @@ static mlan_status woal_usb_get_fw_name(moal_handle *handle)
USBIW610_DEFAULT_WLAN_FW_NAME, FW_NAMW_MAX_LEN);
if (boot_mode != 0x03) {
/* remove extension .se */
if (strstr(handle->card_info->fw_name, ".se"))
memset(strstr(handle->card_info->fw_name,
".se"),
'\0', sizeof(".se"));
if (strstr(handle->card_info->fw_name_wlan, ".se"))
memset(strstr(handle->card_info->fw_name_wlan,
".se"),
'\0', sizeof(".se"));
ext = strstr(handle->card_info->fw_name, ".se");
if (ext)
*ext = '\0';
ext = strstr(handle->card_info->fw_name_wlan, ".se");
if (ext)
*ext = '\0';
}
}
#endif
@ -2250,6 +2356,395 @@ done:
return ret;
}
#ifdef USB_CUSTOMER_VIDPID
static int parse_config_line(char *line, usb_config_entry_t *entry,
t_u16 *current_entry_idx)
{
char *token, *value;
static usb_config_entry_t *current_entry = NULL;
/* Remove whitespace and newlines */
line = strim(line);
/* Skip empty lines and comments */
if (strlen(line) == 0 || line[0] == '#')
return 0;
/* Check for device section start (e.g., "USBIW610={") */
if (strstr(line, "={")) {
token = strsep(&line, "=");
if (token) {
if ((*current_entry_idx) >= MAX_CONFIG_ENTRIES) {
PRINTM(MERROR, "Only support max %d entries\n",
MAX_CONFIG_ENTRIES);
return -EINVAL;
}
current_entry = &entry[*current_entry_idx];
strncpy(current_entry->device_name, strim(token),
MAX_DEVICE_NAME - 1);
current_entry->device_name[MAX_DEVICE_NAME - 1] = '\0';
if (check_device_name_info(current_entry->device_name,
NULL) !=
MLAN_STATUS_SUCCESS) {
PRINTM(MERROR, "Not support devices\n");
return -EINVAL;
}
current_entry->vid_pid_count = 0; /* Initialize count */
(*current_entry_idx)++;
return 0;
}
}
/* Check for section end */
if (strstr(line, "}")) {
current_entry = NULL;
return 0;
}
/* Parse vid_pid entries within a section */
if (current_entry && strchr(line, '=')) {
token = strsep(&line, "=");
value = line;
if (!token || !value)
return -EINVAL;
token = strim(token);
value = strim(value);
/* Only process vid_pid_X entries */
if (strncmp(token, "vid_pid_", 8) == 0) {
char *vid_str, *pid_str;
int vid, pid;
int pair_idx;
/* Extract pair index from token (e.g., "vid_pid_0" ->
* 0) */
if (kstrtoint(token + 8, 10, &pair_idx) != 0)
return -EINVAL;
if (pair_idx >= MAX_VID_PID_PAIRS || pair_idx < 0) {
PRINTM(MERROR,
"VID/PID pair index %d exceeds maximum %d\n",
pair_idx, MAX_VID_PID_PAIRS - 1);
return -EINVAL;
}
/* Parse VID:PID format (e.g., "0x471:0x215") */
vid_str = strsep(&value, ":");
pid_str = value;
if (!vid_str || !pid_str) {
PRINTM(MERROR, "Invalid VID:PID format: %s\n",
line);
return -EINVAL;
}
if (kstrtoint(vid_str, 0, &vid) != 0 ||
kstrtoint(pid_str, 0, &pid) != 0) {
PRINTM(MERROR,
"Failed to parse VID:PID values: %s:%s\n",
vid_str, pid_str);
return -EINVAL;
}
if (vid == 0 || pid == 0) {
PRINTM(MERROR,
"Invalid VID or PID value, vid is 0x%04x, pid is 0x%04x\n",
vid, pid);
return -EINVAL;
}
current_entry->vid_pid_pairs[pair_idx].vid = (__u16)vid;
current_entry->vid_pid_pairs[pair_idx].pid = (__u16)pid;
/* Update the count to track the highest index + 1 */
if (pair_idx >= current_entry->vid_pid_count) {
current_entry->vid_pid_count = pair_idx + 1;
}
PRINTM(MINFO,
"Parsed VID/PID[%d]: 0x%04x:0x%04x for device %s\n",
pair_idx, vid, pid, current_entry->device_name);
}
}
return 0;
}
static int parse_usb_config_file(const char *config_path, usb_config_t *config)
{
struct file *file;
t_u8 line[MAX_LINE_LEN];
loff_t pos = 0;
int ret = 0;
t_u16 entry_idx = 0;
if (!config_path || !config) {
PRINTM(MERROR, "Invalid parameters\n");
return -EINVAL;
}
memset(config, 0, sizeof(usb_config_t));
/* Open the configuration file */
file = filp_open(config_path, O_RDONLY, 0);
if (IS_ERR(file)) {
PRINTM(MERROR, "Failed to open config file: %s\n", config_path);
ret = PTR_ERR(file);
goto cleanup;
}
PRINTM(MINFO, "Parsing USB config file: %s\n", config_path);
/* Read file line by line */
while (1) {
int i = 0;
char c;
/* Read one line */
memset(line, 0, MAX_LINE_LEN);
while (i < MAX_LINE_LEN - 1) {
ret = kernel_read(file, &c, 1, &pos);
if (ret <= 0)
break;
if (c == '\n') {
line[i] = '\0';
break;
}
line[i++] = c;
}
if (ret <= 0 && i == 0)
break; /* End of file */
line[i] = '\0';
/* Parse the line */
ret = parse_config_line(line, config->entries, &entry_idx);
if (ret < 0) {
PRINTM(MERROR, "Error parsing line: %s\n", line);
break;
}
}
if (ret >= 0) {
config->total_entries = entry_idx;
/* Count total valid VID/PID pairs */
int i, j;
config->total_vid_pid_pairs = 0;
for (i = 0; i < config->total_entries; i++) {
for (j = 0; j < config->entries[i].vid_pid_count; j++) {
if (config->entries[i].vid_pid_pairs[j].vid !=
0 &&
config->entries[i].vid_pid_pairs[j].pid !=
0) {
config->total_vid_pid_pairs++;
}
}
PRINTM(MINFO, "Device %s: found %d VID/PID pairs\n",
config->entries[i].device_name,
config->entries[i].vid_pid_count);
}
PRINTM(MINFO,
"Successfully parsed %d device entries with %d total VID/PID pairs\n",
config->total_entries, config->total_vid_pid_pairs);
ret = 0;
}
filp_close(file, NULL);
cleanup:
return ret;
}
static int extend_usb_table(struct usb_device_id *table, t_u32 table_size,
usb_config_t *config)
{
struct usb_device_id *new_table;
t_u32 new_size;
t_u32 i, j, new_idx;
if (!table || !table_size || !config) {
PRINTM(MERROR, "Invalid parameters for extending USB table\n");
return -EINVAL;
}
if (config->total_vid_pid_pairs >
((MAX_CONFIG_ENTRIES) * (MAX_VID_PID_PAIRS))) {
PRINTM(MERROR, "Only support max %d pairs of vid and pid\n",
((MAX_CONFIG_ENTRIES) * (MAX_VID_PID_PAIRS)));
return -EINVAL;
}
/* Calculate new table size */
new_size = table_size + config->total_vid_pid_pairs + 1; /* +1 for
terminating
entry */
PRINTM(MINFO,
"Extending USB table: original=%d, adding=%d, new_total=%d\n",
table_size, config->total_vid_pid_pairs, new_size);
/* Allocate new table */
new_table = kmalloc_array(new_size, sizeof(struct usb_device_id),
GFP_KERNEL);
if (!new_table) {
PRINTM(MERROR,
"Failed to allocate extended USB table (%zu bytes)\n",
new_size * sizeof(struct usb_device_id));
return -ENOMEM;
}
/* Copy original entries */
memcpy(new_table, table, table_size * sizeof(struct usb_device_id));
/* Add new entries from config */
new_idx = table_size;
for (i = 0; i < config->total_entries; i++) {
usb_config_entry_t *entry = &config->entries[i];
for (j = 0; j < entry->vid_pid_count; j++) {
if ((new_idx < new_size) &&
(entry->vid_pid_pairs[j].vid != 0) &&
(entry->vid_pid_pairs[j].pid != 0)) {
struct usb_device_id *usb_entry =
&new_table[new_idx];
memset(usb_entry, 0,
sizeof(struct usb_device_id));
usb_entry->match_flags =
USB_DEVICE_ID_MATCH_DEVICE;
usb_entry->idVendor =
entry->vid_pid_pairs[j].vid;
usb_entry->idProduct =
entry->vid_pid_pairs[j].pid;
usb_entry->driver_info =
(unsigned long)"NXP WLAN USB Adapter";
PRINTM(MINFO,
"Added USB device[%d]: VID=0x%04x, PID=0x%04x (%s)\n",
new_idx, entry->vid_pid_pairs[j].vid,
entry->vid_pid_pairs[j].pid,
entry->device_name);
new_idx++;
}
}
}
/* Add terminating entry */
memset(&new_table[new_idx], 0, sizeof(struct usb_device_id));
/* Update table pointer and size */
woal_usb_table_ext = new_table;
PRINTM(MINFO, "USB table successfully extended to %d entries\n",
new_size);
return 0;
}
int woal_usb_init_extended_table(const char *config_path)
{
usb_config_t *config = &customer_usb_config;
int ret;
t_u32 original_size = 0;
/* Count original table size */
struct usb_device_id *entry = woal_usb_table;
while (entry->idVendor != 0 || entry->idProduct != 0) {
original_size++;
entry++;
}
/* Parse configuration file */
ret = parse_usb_config_file(config_path, config);
if (ret < 0) {
PRINTM(MERROR, "Failed to parse USB config file: %d\n", ret);
return ret;
}
if (config->total_vid_pid_pairs == 0) {
PRINTM(MERROR, "No additional USB devices found in config\n");
return 0;
}
ret = extend_usb_table(woal_usb_table, original_size, config);
if (ret < 0) {
PRINTM(MERROR, "Failed to extend USB table: %d\n", ret);
return ret;
}
PRINTM(MINFO,
"Successfully extended USB table with %d additional devices\n",
config->total_vid_pid_pairs);
return 0;
}
mlan_status check_usb_ext_table_info(char *device_name, t_u16 *card_type,
t_u16 pid)
{
t_u16 i, j;
t_u16 get_card_type = 0;
if (customer_usb_config.total_entries != 0) {
for (j = 0; j < customer_usb_config.total_entries; j++) {
if (check_device_name_info(
customer_usb_config.entries[j].device_name,
&get_card_type) == MLAN_STATUS_SUCCESS) {
for (i = 0; customer_usb_config.entries[j]
.vid_pid_count &&
i < customer_usb_config.entries[j]
.vid_pid_count;
i++) {
if (pid ==
(__force __le16)(
customer_usb_config
.entries[j]
.vid_pid_pairs[i]
.pid)) {
if (device_name != NULL) {
moal_memcpy_ext(
NULL,
device_name,
customer_usb_config
.entries[j]
.device_name,
strlen(customer_usb_config
.entries[j]
.device_name),
MAX_DEVICE_NAME -
1);
device_name
[MAX_DEVICE_NAME -
1] = '\0';
}
if (card_type != NULL) {
*card_type =
get_card_type;
}
return MLAN_STATUS_SUCCESS;
}
}
}
}
}
return MLAN_STATUS_FAILURE;
}
#endif
static moal_if_ops usb_ops = {
.register_dev = woal_usb_register_dev,
.unregister_dev = woal_usb_unregister_dev,

View file

@ -4,7 +4,7 @@
* driver.
*
*
* Copyright 2008-2021, 2024 NXP
* Copyright 2008-2021, 2024-2025 NXP
*
* This software file (the File) is distributed by NXP
* under the terms of the GNU General Public License Version 2, June 1991
@ -264,6 +264,27 @@ struct usb_card_rec {
t_u8 second_mac;
};
#ifdef USB_CUSTOMER_VIDPID
#define MAX_CONFIG_ENTRIES 3
#define MAX_VID_PID_PAIRS 10
#define MAX_DEVICE_NAME 64
typedef struct {
char device_name[MAX_DEVICE_NAME];
t_u16 vid_pid_count; /* Actual number of VID/PID pairs found */
struct {
t_u16 vid;
t_u16 pid;
} vid_pid_pairs[MAX_VID_PID_PAIRS];
} usb_config_entry_t;
typedef struct {
usb_config_entry_t entries[MAX_CONFIG_ENTRIES];
t_u16 total_entries;
t_u16 total_vid_pid_pairs;
} usb_config_t;
#endif
void woal_kill_urbs(moal_handle *handle);
void woal_resubmit_urbs(moal_handle *handle);
@ -277,4 +298,10 @@ void woal_submit_rx_urb(moal_handle *handle, t_u8 ep);
void woal_usb_bus_unregister(void);
mlan_status woal_usb_bus_register(void);
void woal_usb_free(struct usb_card_rec *cardp);
#ifdef USB_CUSTOMER_VIDPID
extern int woal_usb_init_extended_table(const char *config_path);
mlan_status check_usb_ext_table_info(char *device_name, t_u16 *card_type,
t_u16 pid);
#endif
#endif /*_MOAL_USB_H */