diff --git a/Makefile b/Makefile index dded5d4..4ba84c8 100644 --- a/Makefile +++ b/Makefile @@ -175,7 +175,7 @@ APPDIR= $(shell if test -d "mapp"; then echo mapp; fi) ############################################################################# ccflags-y += -I$(KERNELDIR)/include - ccflags-y += -DMLAN_RELEASE_VERSION='"537"' + ccflags-y += -DMLAN_RELEASE_VERSION='"537.p2"' ccflags-y += -DFPNUM='"92"' diff --git a/README b/README index 88160c1..e98ef7e 100644 --- a/README +++ b/README @@ -11,7 +11,7 @@ Goto source code directory. make [clean] build The driver and utility binaries can be found in bin_wlan directory. - The driver source code is compatible with hosts running Linux kernel versions ranging from 2.6.32 to 6.13.1. + The driver source code is compatible with hosts running Linux kernel versions ranging from 2.6.32 to 6.14.0. 2) FOR DRIVER INSTALL diff --git a/mlan/mlan_cmdevt.c b/mlan/mlan_cmdevt.c index b7faef0..55c3f2f 100644 --- a/mlan/mlan_cmdevt.c +++ b/mlan/mlan_cmdevt.c @@ -6759,6 +6759,10 @@ mlan_status wlan_ret_get_hw_spec(pmlan_private pmpriv, HostCmd_DS_COMMAND *resp, pmadapter->fw_bands |= BAND_AN; if (!(pmadapter->fw_bands & BAND_G) && (pmadapter->fw_bands & BAND_GN)) pmadapter->fw_bands &= ~BAND_GN; + if (!(pmadapter->fw_bands & BAND_A) && (pmadapter->fw_bands & BAND_AAC)) + pmadapter->fw_bands &= ~BAND_AAC; + if (!(pmadapter->fw_bands & BAND_G) && (pmadapter->fw_bands & BAND_GAC)) + pmadapter->fw_bands &= ~BAND_GAC; pmadapter->config_bands = pmadapter->fw_bands; for (i = 0; i < pmadapter->priv_num; i++) { diff --git a/mlan/mlan_init.c b/mlan/mlan_init.c index 29e288a..42bc395 100644 --- a/mlan/mlan_init.c +++ b/mlan/mlan_init.c @@ -1644,7 +1644,10 @@ static void wlan_update_hw_spec(pmlan_adapter pmadapter) pmadapter->fw_bands |= BAND_AN; if (!(pmadapter->fw_bands & BAND_G) && (pmadapter->fw_bands & BAND_GN)) pmadapter->fw_bands &= ~BAND_GN; - + if (!(pmadapter->fw_bands & BAND_A) && (pmadapter->fw_bands & BAND_AAC)) + pmadapter->fw_bands &= ~BAND_AAC; + if (!(pmadapter->fw_bands & BAND_G) && (pmadapter->fw_bands & BAND_GAC)) + pmadapter->fw_bands &= ~BAND_GAC; pmadapter->config_bands = pmadapter->fw_bands; for (i = 0; i < pmadapter->priv_num; i++) { if (pmadapter->priv[i]) { diff --git a/mlan/mlan_join.c b/mlan/mlan_join.c index c5fe996..2166b81 100644 --- a/mlan/mlan_join.c +++ b/mlan/mlan_join.c @@ -1814,6 +1814,7 @@ mlan_status wlan_ret_802_11_associate(mlan_private *pmpriv, MLAN_MAC_ADDR_LENGTH)) wlan_reset_connect_state(pmpriv, MTRUE); else { + // fallback to previous AP memcpy_ext( pmpriv->adapter, &pmpriv->curr_bss_params.attemp_bssid, @@ -1825,6 +1826,21 @@ mlan_status wlan_ret_802_11_associate(mlan_private *pmpriv, pmpriv, MLAN_EVENT_ID_DRV_ASSOC_FAILURE_REPORT, MNULL); + // update Assoc resp/req buf, if Assoc Rsp + // failure. + pmpriv->assoc_rsp_size = + pmpriv->prior_assoc_rsp_size; + memcpy_ext(pmadapter, pmpriv->assoc_rsp_buf, + pmpriv->prior_assoc_rsp, + pmpriv->assoc_rsp_size, + ASSOC_RSP_BUF_SIZE); + pmpriv->assoc_req_size = + pmpriv->prior_assoc_req_size; + memcpy_ext(pmadapter, pmpriv->assoc_req_buf, + pmpriv->prior_assoc_req, + pmpriv->assoc_req_size, + ASSOC_RSP_BUF_SIZE); + // coverity[no_effect:SUPPRESS] memset(pmpriv->adapter, pmpriv->curr_bss_params.prev_bssid, 0, diff --git a/mlinux/moal_cfg80211.c b/mlinux/moal_cfg80211.c index c7b1dc9..3394502 100644 --- a/mlinux/moal_cfg80211.c +++ b/mlinux/moal_cfg80211.c @@ -4284,11 +4284,12 @@ static t_u16 woal_filter_beacon_ies(moal_private *priv, const t_u8 *ie, case WAPI_IE: break; case EXTENSION: - /* skip 11ax, 6G if bands are not enabled */ - if (!(priv->phandle->fw_bands & BAND_GAX) || + /* skip 2G-HE, 5G-HE, 6G if bands are not enabled */ + if (!(priv->phandle->fw_bands & BAND_GAX) && !(priv->phandle->fw_bands & BAND_AAX) #if CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 8, 0) - || !(priv->phandle->fw_bands & BAND_6G) + && (!(priv->phandle->fw_bands & BAND_6G)) + #endif ) break; diff --git a/mlinux/moal_cfg80211_util.c b/mlinux/moal_cfg80211_util.c index 9f14c07..e120805 100644 --- a/mlinux/moal_cfg80211_util.c +++ b/mlinux/moal_cfg80211_util.c @@ -7110,7 +7110,8 @@ done: * @param substr_len length of the received substring * @return Numeric value or 0 */ -t_u16 extractNumericVal(char *str, t_u32 str_len, char *substr, t_u8 substr_len) +static t_u16 extractNumericVal(char *str, t_u32 str_len, char *substr, + t_u8 substr_len) { char result[6]; // result holds argument value which can be of max size // of t_u16 (65535) @@ -7146,7 +7147,7 @@ t_u16 extractNumericVal(char *str, t_u32 str_len, char *substr, t_u8 substr_len) * @param len length of the received ascii data buffer * @return string buffer or NULL */ -void asciiToString(t_u8 *raw_data, t_u32 len, char *str, t_u32 *str_len) +static void asciiToString(t_u8 *raw_data, t_u32 len, char *str, t_u32 *str_len) { t_u32 i, j; diff --git a/mlinux/moal_ioctl.c b/mlinux/moal_ioctl.c index 12f82f3..39d7288 100644 --- a/mlinux/moal_ioctl.c +++ b/mlinux/moal_ioctl.c @@ -2764,6 +2764,85 @@ done: return status; } +/** + * @brief function to send raw data packet from monitor mode interface + * + * @param dev A pointer to net_device structure + * @param req A pointer to ifreq structure + * @return 0 --success, otherwise fail + */ +int woal_send_mon_if_packet(struct net_device *dev, struct ifreq *req) +{ + moal_private *priv = (moal_private *)netdev_priv(dev); + t_u32 packet_len = 0; + int ret = 0; + pmlan_buffer pmbuf = NULL; + mlan_status status; + + ENTER(); + + if (!priv || !priv->phandle) { + PRINTM(MERROR, "priv or handle is NULL\n"); + ret = -EFAULT; + goto done; + } + + /* Sanity check */ + if (req->ifr_data == NULL) { + PRINTM(MERROR, "woal_send_mon_if_packet() corrupt data\n"); + ret = -EFAULT; + goto done; + } + + moal_memcpy_ext(NULL, &packet_len, req->ifr_data, sizeof(packet_len), + sizeof(packet_len)); +#define PACKET_HEADER_LEN 8 +#define FRAME_LEN 2 +#define MV_ETH_FRAME_LEN 1514 + if (packet_len > MV_ETH_FRAME_LEN) { + PRINTM(MERROR, "Invalid packet length %d\n", packet_len); + ret = -EFAULT; + goto done; + } + pmbuf = woal_alloc_mlan_buffer( + priv->phandle, (int)(MLAN_MIN_DATA_HEADER_LEN + + (int)packet_len + PACKET_HEADER_LEN)); + if (!pmbuf) { + PRINTM(MERROR, "Fail to allocate mlan_buffer\n"); + ret = -ENOMEM; + goto done; + } + pmbuf->data_offset = MLAN_MIN_DATA_HEADER_LEN; + + moal_memcpy_ext(NULL, pmbuf->pbuf + pmbuf->data_offset, + (void *)((t_u8 *)(req->ifr_data) + sizeof(packet_len)), + PACKET_HEADER_LEN + packet_len, + PACKET_HEADER_LEN + packet_len); + + pmbuf->data_len = PACKET_HEADER_LEN + packet_len; + pmbuf->buf_type = MLAN_BUF_TYPE_RAW_DATA; + pmbuf->bss_index = priv->bss_index; + + status = mlan_send_packet(priv->phandle->pmlan_adapter, pmbuf); + switch (status) { + case MLAN_STATUS_PENDING: + atomic_inc(&priv->phandle->tx_pending); + queue_work(priv->phandle->workqueue, &priv->phandle->main_work); + break; + case MLAN_STATUS_SUCCESS: + woal_free_mlan_buffer(priv->phandle, pmbuf); + break; + case MLAN_STATUS_FAILURE: + default: + woal_free_mlan_buffer(priv->phandle, pmbuf); + ret = -EFAULT; + break; + } +done: + LEAVE(); + return ret; +} + /** * @brief send raw data packet ioctl function * diff --git a/mlinux/moal_main.c b/mlinux/moal_main.c index f36229c..bbb90a9 100644 --- a/mlinux/moal_main.c +++ b/mlinux/moal_main.c @@ -3325,6 +3325,7 @@ static t_u32 woal_process_init_cfg(moal_handle *handle, const t_u8 *data, __LINE__); goto done; } + strncpy(bss_mac_name, intf_s + 1, j); bss_mac_name[j] = '\0'; for (i = 0; i < handle->priv_num; i++) { if (!handle->priv[i]) @@ -5371,6 +5372,9 @@ static void woal_mon_set_multicast_list(struct net_device *ndev) LEAVE(); } +#define PKT_HEADER_SIZE 12 // sizeof(pkt_header) +#define FRAME_HEADER_LEN PKT_HEADER_SIZE + 2 // sizeof(t_u16) + /** * @brief This function handles packet transmission for monitor interface * @@ -5383,18 +5387,18 @@ static netdev_tx_t woal_mon_hard_start_xmit(struct sk_buff *skb, struct net_device *ndev) { int len_rthdr; - int qos_len = 0; - int dot11_hdr_len = 24; - int snap_len = 6; - unsigned char *pdata; + t_u8 four_addr_pkt = 0; unsigned short fc; - unsigned char src_mac_addr[6]; - unsigned char dst_mac_addr[6]; struct ieee80211_hdr *dot11_hdr; struct ieee80211_radiotap_header *prthdr = (struct ieee80211_radiotap_header *)skb->data; monitor_iface *mon_if = netdev_priv(ndev); - + struct ifreq req; + t_u8 zero_mac[6] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; + t_u32 packet_len = 0; + t_u16 *frmlen = NULL; + pkt_header *hdr = NULL; + req.ifr_data = NULL; ENTER(); if (mon_if == NULL || mon_if->base_ndev == NULL) { @@ -5418,7 +5422,7 @@ static netdev_tx_t woal_mon_hard_start_xmit(struct sk_buff *skb, len_rthdr = ieee80211_get_radiotap_len(skb->data); /* does the skb contain enough to deliver on the alleged length? */ - if (unlikely((int)skb->len < len_rthdr)) { + if (unlikely((int)skb->len < (len_rthdr + IEEE80211_HEADER_SIZE))) { PRINTM(MERROR, "Invalid data length," "skb->len: %d\n", @@ -5431,37 +5435,71 @@ static netdev_tx_t woal_mon_hard_start_xmit(struct sk_buff *skb, dot11_hdr = (struct ieee80211_hdr *)skb->data; fc = le16_to_cpu(dot11_hdr->frame_control); - if ((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA) { + + if (((fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_DATA) && + ((fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_MGMT)) { + PRINTM(MERROR, + "%s: Tx is not supported for this frame type, frame_control= 0%04X", + __func__, fc); + goto fail; /* skb too short for claimed rt header extent */ + } + + packet_len = (FRAME_HEADER_LEN + skb->len + ETH_ALEN); + if ((fc & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA && + ((dot11_hdr->frame_control & (__force __le16)0x0300) == + (__force __le16)0x0300)) { /* Check if this ia a Wireless Distribution System (WDS) frame * which has 4 MAC addresses */ - if (dot11_hdr->frame_control & (__force __le16)0x0080) - qos_len = 2; - if ((dot11_hdr->frame_control & (__force __le16)0x0300) == - (__force __le16)0x0300) - dot11_hdr_len += 6; - - moal_memcpy_ext(NULL, dst_mac_addr, dot11_hdr->addr1, - sizeof(dst_mac_addr), sizeof(dst_mac_addr)); - moal_memcpy_ext(NULL, src_mac_addr, dot11_hdr->addr2, - sizeof(src_mac_addr), sizeof(src_mac_addr)); - - /* Skip the 802.11 header, QoS (if any) and SNAP, but leave - * spaces for for two MAC addresses - */ - skb_pull(skb, dot11_hdr_len + qos_len + snap_len - - sizeof(src_mac_addr) * 2); - pdata = (unsigned char *)skb->data; - moal_memcpy_ext(NULL, pdata, dst_mac_addr, sizeof(dst_mac_addr), - (t_u32)skb->len); - moal_memcpy_ext(NULL, pdata + sizeof(dst_mac_addr), - src_mac_addr, sizeof(src_mac_addr), - (t_u32)skb->len - sizeof(dst_mac_addr)); - - LEAVE(); - return woal_hard_start_xmit(skb, mon_if->base_ndev); + packet_len -= ETH_ALEN; + four_addr_pkt = 1; } + req.ifr_data = kmalloc(packet_len, GFP_KERNEL); + if (req.ifr_data == NULL) + goto fail; + + hdr = (pkt_header *)req.ifr_data; + hdr->TxPktType = MRVL_PKT_TYPE_MGMT_FRAME; + hdr->TxControl = 0; + frmlen = (t_u16 *)(req.ifr_data + PKT_HEADER_SIZE); + + if (!four_addr_pkt) { + hdr->pkt_len = ((int)skb->len + sizeof(t_u16) + ETH_ALEN); + *frmlen = skb->len + ETH_ALEN; + moal_memcpy_ext(NULL, (t_u8 *)(req.ifr_data + FRAME_HEADER_LEN), + (t_u8 *)skb->data, + (packet_len - FRAME_HEADER_LEN), + IEEE80211_HEADER_SIZE); + + moal_memcpy_ext( + NULL, + (t_u8 *)(req.ifr_data + + (FRAME_HEADER_LEN + IEEE80211_HEADER_SIZE)), + (t_u8 *)zero_mac, + (packet_len - + (FRAME_HEADER_LEN + IEEE80211_HEADER_SIZE)), + ETH_ALEN); + + moal_memcpy_ext( + NULL, + (t_u8 *)(req.ifr_data + FRAME_HEADER_LEN + + IEEE80211_HEADER_SIZE + ETH_ALEN), + (t_u8 *)skb->data + IEEE80211_HEADER_SIZE, + (packet_len - + (FRAME_HEADER_LEN + IEEE80211_HEADER_SIZE + ETH_ALEN)), + skb->len - IEEE80211_HEADER_SIZE); + } else { + hdr->pkt_len = ((int)skb->len + sizeof(t_u16)); + *frmlen = skb->len; + moal_memcpy_ext(NULL, (t_u8 *)(req.ifr_data + FRAME_HEADER_LEN), + (t_u8 *)skb->data, + (packet_len - FRAME_HEADER_LEN), skb->len); + } + + woal_send_mon_if_packet(mon_if->base_ndev, &req); + if (req.ifr_data != NULL) + kfree(req.ifr_data); fail: dev_kfree_skb(skb); LEAVE(); @@ -13790,10 +13828,19 @@ moal_handle *woal_add_card(void *card, struct device *dev, moal_if_ops *if_ops, #define NAPI_BUDGET 64 if (moal_extflg_isset(handle, EXT_NAPI)) { +#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 14, 0) + handle->pnapi_dev = alloc_netdev_dummy(0); +#else init_dummy_netdev(&handle->napi_dev); +#endif #if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0) - netif_napi_add(&handle->napi_dev, &handle->napi_rx, - woal_netdev_poll_rx); + netif_napi_add( +#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 14, 0) + handle->pnapi_dev, +#else + &handle->napi_dev, +#endif + &handle->napi_rx, woal_netdev_poll_rx); #else netif_napi_add(&handle->napi_dev, &handle->napi_rx, woal_netdev_poll_rx, NAPI_BUDGET); diff --git a/mlinux/moal_main.h b/mlinux/moal_main.h index 0f7442f..4c21aa2 100644 --- a/mlinux/moal_main.h +++ b/mlinux/moal_main.h @@ -3269,7 +3269,11 @@ struct _moal_handle { #endif mlan_ds_misc_keep_alive keep_alive[MAX_KEEP_ALIVE_ID]; mlan_ds_misc_keep_alive_rx keep_alive_rx[MAX_KEEP_ALIVE_RX_ID]; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 14, 0) + struct net_device *pnapi_dev; +#else struct net_device napi_dev; +#endif struct napi_struct napi_rx; /* bus interface operations */ moal_if_ops ops; @@ -4286,7 +4290,7 @@ mlan_status woal_reset_intf(moal_private *priv, t_u8 wait_option, int all_intf); #define MGMT_MASK_BEACON_WPS_P2P 0x8000 #define MLAN_CUSTOM_IE_DELETE_MASK 0x0 #define MLAN_CUSTOM_IE_NEW_MASK 0x8000 - +#define MRVL_PKT_TYPE_MGMT_FRAME 0xE5 /** common ioctl for uap, station */ int woal_custom_ie_ioctl(struct net_device *dev, struct ifreq *req); #ifdef UAP_SUPPORT @@ -4296,6 +4300,7 @@ int woal_priv_get_nonglobal_operclass_by_bw_channel(moal_private *priv, t_u8 *oper_class); #endif int woal_send_host_packet(struct net_device *dev, struct ifreq *req); +int woal_send_mon_if_packet(struct net_device *dev, struct ifreq *req); /** Private command ID to pass mgmt frame */ #define WOAL_MGMT_FRAME_TX_IOCTL (SIOCDEVPRIVATE + 12) /** common ioctl for TDLS */ diff --git a/mlinux/moal_sta_cfg80211.c b/mlinux/moal_sta_cfg80211.c index 3945eff..68f4d33 100644 --- a/mlinux/moal_sta_cfg80211.c +++ b/mlinux/moal_sta_cfg80211.c @@ -200,6 +200,9 @@ static int woal_cfg80211_set_cqm_rssi_config(struct wiphy *wiphy, static int woal_cfg80211_get_tx_power(struct wiphy *wiphy, #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) struct wireless_dev *wdev, +#endif +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 14, 0) + unsigned int link_id, #endif int *dbm); @@ -2626,7 +2629,12 @@ static int woal_cfg80211_authenticate(struct wiphy *wiphy, PRINTM(MMSG, "bssid not found in scan list\n"); kfree(ssid_bssid); LEAVE(); - return -EFAULT; + /* Supplicannt has provision to retry Auth, + * if error is returned as ENOENT. + * it does Auth scan on specific channel + * to sync cfg80211 and DRV scan table entry + */ + return -ENOENT; } } kfree(ssid_bssid); @@ -3107,6 +3115,8 @@ void woal_host_mlme_process_assoc_timeout(moal_private *priv, kfree(assoc_info); #endif /* Send Assoc Failure with Timeout to CFG80211 */ + priv->host_mlme = MFALSE; + priv->auth_flag = 0; #if (CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 0, 0) || \ (defined(ANDROID_SDK_VERSION) && ANDROID_SDK_VERSION >= 33 && \ CFG80211_VERSION_CODE >= KERNEL_VERSION(5, 15, 74))) @@ -3565,8 +3575,6 @@ static int woal_cfg80211_associate(struct wiphy *wiphy, struct net_device *dev, woal_bss_start(priv, MOAL_IOCTL_WAIT_TIMEOUT, ssid_bssid)) { PRINTM(MERROR, "HostMlme %s: bss_start Fails\n", priv->netdev->name); - priv->host_mlme = MFALSE; - priv->auth_flag = 0; ret = -EFAULT; } @@ -3646,13 +3654,13 @@ done: // kernel woal_save_assoc_params(priv, req, ssid_bssid); ret = 0; + priv->host_mlme = MFALSE; + priv->auth_flag = 0; } else { ssid_bssid->assoc_rsp.assoc_resp_len = 0; ret = 0; woal_assoc_timeout_event(priv, req); } - priv->host_mlme = MFALSE; - priv->auth_flag = 0; spin_unlock_irqrestore(&priv->connect_lock, flags); } /*Association Response should also be send when ret is non-zero. @@ -6811,6 +6819,9 @@ static int woal_cfg80211_set_power_mgmt(struct wiphy *wiphy, static int woal_cfg80211_get_tx_power(struct wiphy *wiphy, #if CFG80211_VERSION_CODE >= KERNEL_VERSION(3, 8, 0) struct wireless_dev *wdev, +#if CFG80211_VERSION_CODE >= KERNEL_VERSION(6, 14, 0) + unsigned int link_id, +#endif #endif int *dbm) {