aic8800: add support for usb cards

This commit is contained in:
aiamadeus 2025-02-18 22:26:02 +08:00
parent 4a126e07b7
commit 55c1cfedcc
12 changed files with 218 additions and 258 deletions

View File

@ -1,6 +1,6 @@
# SPDX-License-Identifier: GPL-2.0+
#
# Copyright (c) 2023-2024 AnYun
# Copyright (c) 2023-2025 AnYun
#
include $(TOPDIR)/rules.mk
@ -14,15 +14,22 @@ PKG_SOURCE_URL:=https://github.com/radxa-pkg/aic8800.git
PKG_SOURCE_VERSION:=8ad987876a6220fffb40a755e0454250ce2c5fdd
PKG_MIRROR_HASH:=4a22e28a4341eb7516f03ea7e6c1c0523013e1aaf72c17428eb3749c8f553856
ifeq ($(BUILD_VARIANT),sdio)
MAKE_PATH:=src/SDIO/driver_fw/driver/aic8800
PATCH_DIR:=$(CURDIR)/patches-sdio
else
MAKE_PATH:=src/USB/driver_fw/drivers/aic8800
PATCH_DIR:=$(CURDIR)/patches-usb
endif
PKG_EXTMOD_SUBDIRS:=$(MAKE_PATH)
include $(INCLUDE_DIR)/kernel.mk
include $(INCLUDE_DIR)/package.mk
define KernelPackage/aic8800
define KernelPackage/aic8800s
SUBMENU:=Wireless Drivers
TITLE:=SKI WB800D80S wireless support
TITLE:=AIC8800 SDIO wireless support
DEPENDS:=+kmod-mac80211 +kmod-mmc \
+@DRIVER_11N_SUPPORT +@DRIVER_11AC_SUPPORT
FILES:= \
@ -30,6 +37,21 @@ define KernelPackage/aic8800
$(PKG_BUILD_DIR)/$(MAKE_PATH)/aic8800_fdrv/aic8800_fdrv.ko
AUTOLOAD:=$(call AutoProbe,aic8800_bsp aic8800_fdrv)
MODPARAMS.aic8800_fdrv:=he_on=n
VARIANT:=sdio
endef
define KernelPackage/aic8800u
SUBMENU:=Wireless Drivers
TITLE:=AIC8800 USB wireless support
DEPENDS:=+kmod-mac80211 +kmod-usb-core @USB_SUPPORT \
+@DRIVER_11N_SUPPORT +@DRIVER_11AC_SUPPORT
FILES:= \
$(PKG_BUILD_DIR)/$(MAKE_PATH)/aic_load_fw/aic_load_fw.ko \
$(PKG_BUILD_DIR)/$(MAKE_PATH)/aic8800_fdrv/aic8800_fdrv.ko
AUTOLOAD:=$(call AutoProbe,aic_load_fw aic8800_fdrv)
MODPARAMS.aic8800_fdrv:=he_on=n
CONFLICTS:=kmod-aic8800s
VARIANT:=usb
endef
NOSTDINC_FLAGS := \
@ -52,9 +74,15 @@ define Build/Compile
modules
endef
define KernelPackage/aic8800/install
define KernelPackage/aic8800s/install
$(INSTALL_DIR) $(1)/lib/firmware/aic8800
$(CP) $(PKG_BUILD_DIR)/src/SDIO/driver_fw/fw/aic8800D80/* $(1)/lib/firmware/aic8800
endef
$(eval $(call KernelPackage,aic8800))
define KernelPackage/aic8800u/install
$(INSTALL_DIR) $(1)/lib/firmware
$(CP) $(PKG_BUILD_DIR)/src/USB/driver_fw/fw/* $(1)/lib/firmware
endef
$(eval $(call KernelPackage,aic8800s))
$(eval $(call KernelPackage,aic8800u))

View File

@ -7,7 +7,7 @@
-#if (LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION3)
+#if (LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION3) && !defined(BUILD_OPENWRT)
cfg80211_ch_switch_notify(vif->ndev, &csa->chandef, 0, 0);
#elif (LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION) || defined(BUILD_OPENWRT)
#elif (LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION)
cfg80211_ch_switch_notify(vif->ndev, &csa->chandef, 0);
@@ -5561,7 +5561,7 @@ int rwnx_cfg80211_channel_switch (struct
goto end;
@ -16,5 +16,5 @@
-#if LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION4
+#if LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION4 && !defined(BUILD_OPENWRT)
cfg80211_ch_switch_started_notify(dev, &csa->chandef, 0, params->count, false, 0);
#elif LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION2 || defined(BUILD_OPENWRT)
#elif LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION2
cfg80211_ch_switch_started_notify(dev, &csa->chandef, 0, params->count, false);

View File

@ -0,0 +1,105 @@
--- a/src/USB/driver_fw/drivers/aic8800/aic8800_fdrv/rwnx_main.c
+++ b/src/USB/driver_fw/drivers/aic8800/aic8800_fdrv/rwnx_main.c
@@ -3194,7 +3194,7 @@ static struct rwnx_vif *rwnx_interface_a
vif->ap.generation = 0;
vif->ap.mesh_pm = NL80211_MESH_POWER_ACTIVE;
vif->ap.next_mesh_pm = NL80211_MESH_POWER_ACTIVE;
- // no break
+ fallthrough;
case NL80211_IFTYPE_AP:
INIT_LIST_HEAD(&vif->ap.sta_list);
memset(&vif->ap.bcn, 0, sizeof(vif->ap.bcn));
@@ -3649,7 +3649,7 @@ static int rwnx_cfg80211_change_iface(st
INIT_LIST_HEAD(&vif->ap.proxy_list);
vif->ap.create_path = false;
vif->ap.generation = 0;
- // no break
+ fallthrough;
case NL80211_IFTYPE_AP:
case NL80211_IFTYPE_P2P_GO:
INIT_LIST_HEAD(&vif->ap.sta_list);
@@ -5795,6 +5795,7 @@ static int rwnx_cfg80211_mgmt_tx(struct
switch (RWNX_VIF_TYPE(rwnx_vif)) {
case NL80211_IFTYPE_AP_VLAN:
rwnx_vif = rwnx_vif->ap_vlan.master;
+ fallthrough;
case NL80211_IFTYPE_AP:
case NL80211_IFTYPE_P2P_GO:
case NL80211_IFTYPE_MESH_POINT:
@@ -6456,6 +6457,7 @@ static int rwnx_fill_station_info(struct
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0)
case FORMATMOD_HE_MU:
sinfo->rxrate.he_ru_alloc = rx_vect1->he.ru_size;
+ fallthrough;
case FORMATMOD_HE_SU:
case FORMATMOD_HE_ER:
sinfo->rxrate.flags = RATE_INFO_FLAGS_HE_MCS;
--- a/src/USB/driver_fw/drivers/aic8800/aic8800_fdrv/rwnx_msg_tx.c
+++ b/src/USB/driver_fw/drivers/aic8800/aic8800_fdrv/rwnx_msg_tx.c
@@ -614,7 +614,7 @@ int rwnx_send_add_if(struct rwnx_hw *rwn
//case NL80211_IFTYPE_P2P_DEVICE:
case NL80211_IFTYPE_P2P_CLIENT:
add_if_req_param->p2p = true;
- // no break
+ fallthrough;
#endif /* CONFIG_RWNX_FULLMAC */
case NL80211_IFTYPE_STATION:
add_if_req_param->type = MM_STA;
@@ -627,7 +627,7 @@ int rwnx_send_add_if(struct rwnx_hw *rwn
#ifdef CONFIG_RWNX_FULLMAC
case NL80211_IFTYPE_P2P_GO:
add_if_req_param->p2p = true;
- // no break
+ fallthrough;
#endif /* CONFIG_RWNX_FULLMAC */
case NL80211_IFTYPE_AP:
add_if_req_param->type = MM_AP;
--- a/src/USB/driver_fw/drivers/aic8800/aic8800_fdrv/rwnx_tdls.c
+++ b/src/USB/driver_fw/drivers/aic8800/aic8800_fdrv/rwnx_tdls.c
@@ -261,17 +261,24 @@ rwnx_add_wmm_info_ie(struct sk_buff *skb
static u8 rwnx_ac_from_wmm(int ac)
{
switch (ac) {
- default:
- WARN_ON_ONCE(1);
case 0:
return AC_BE;
+ break;
case 1:
return AC_BK;
+ break;
case 2:
return AC_VI;
+ break;
case 3:
return AC_VO;
+ break;
+ default:
+ WARN_ON_ONCE(1);
+ break;
}
+
+ return 0;
}
static void
--- a/src/USB/driver_fw/drivers/aic8800/aic8800_fdrv/rwnx_tx.c
+++ b/src/USB/driver_fw/drivers/aic8800/aic8800_fdrv/rwnx_tx.c
@@ -328,6 +328,7 @@ u16 rwnx_select_txq(struct rwnx_vif *rwn
/* AP_VLAN interface is not used for a 4A STA,
fallback searching sta amongs all AP's clients */
rwnx_vif = rwnx_vif->ap_vlan.master;
+ fallthrough;
case NL80211_IFTYPE_AP:
case NL80211_IFTYPE_P2P_GO:
{
--- a/src/USB/driver_fw/drivers/aic8800/aic8800_fdrv/rwnx_txq.c
+++ b/src/USB/driver_fw/drivers/aic8800/aic8800_fdrv/rwnx_txq.c
@@ -638,6 +638,7 @@ void rwnx_txq_vif_for_each_sta(struct rw
}
case NL80211_IFTYPE_AP_VLAN:
rwnx_vif = rwnx_vif->ap_vlan.master;
+ fallthrough;
case NL80211_IFTYPE_AP:
case NL80211_IFTYPE_MESH_POINT:
case NL80211_IFTYPE_P2P_GO:

View File

@ -0,0 +1,36 @@
--- a/src/USB/driver_fw/drivers/aic8800/aic8800_fdrv/rwnx_main.c
+++ b/src/USB/driver_fw/drivers/aic8800/aic8800_fdrv/rwnx_main.c
@@ -1072,7 +1072,7 @@ static void rwnx_csa_finish(struct work_
} else
rwnx_txq_vif_stop(vif, RWNX_TXQ_STOP_CHAN, rwnx_hw);
spin_unlock_bh(&rwnx_hw->cb_lock);
-#if (LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION3)
+#if (LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION3) && !defined(BUILD_OPENWRT)
cfg80211_ch_switch_notify(vif->ndev, &csa->chandef, 0, 0);
#elif (LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION)
cfg80211_ch_switch_notify(vif->ndev, &csa->chandef, 0);
@@ -6045,7 +6045,7 @@ int rwnx_cfg80211_channel_switch(struct
goto end;
} else {
INIT_WORK(&csa->work, rwnx_csa_finish);
-#if LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION4
+#if LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION4 && !defined(BUILD_OPENWRT)
cfg80211_ch_switch_started_notify(dev, &csa->chandef, 0, params->count, false, 0);
#elif LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION2
cfg80211_ch_switch_started_notify(dev, &csa->chandef, 0, params->count, false);
--- a/src/USB/driver_fw/drivers/aic8800/aic8800_fdrv/rwnx_rx.c
+++ b/src/USB/driver_fw/drivers/aic8800/aic8800_fdrv/rwnx_rx.c
@@ -464,8 +464,13 @@ static bool rwnx_rx_data_skb(struct rwnx
if (amsdu) {
int count;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0) || defined(BUILD_OPENWRT)
+ ieee80211_amsdu_to_8023s(skb, &list, rwnx_vif->ndev->dev_addr,
+ RWNX_VIF_TYPE(rwnx_vif), 0, NULL, NULL, false);
+#else
ieee80211_amsdu_to_8023s(skb, &list, rwnx_vif->ndev->dev_addr,
RWNX_VIF_TYPE(rwnx_vif), 0, NULL, NULL);
+#endif
count = skb_queue_len(&list);
if (count > ARRAY_SIZE(rwnx_hw->stats.amsdus_rx))

View File

@ -0,0 +1,22 @@
--- a/src/USB/driver_fw/drivers/aic8800/aic8800_fdrv/rwnx_main.c
+++ b/src/USB/driver_fw/drivers/aic8800/aic8800_fdrv/rwnx_main.c
@@ -525,7 +525,7 @@ extern uint8_t p2p_working;
struct semaphore aicwf_deinit_sem;
atomic_t aicwf_deinit_atomic;
-int aicwf_dbg_level = LOGERROR|LOGINFO;
+int aicwf_dbg_level = LOGDATA;
module_param(aicwf_dbg_level, int, 0660);
int testmode = 0;
--- a/src/USB/driver_fw/drivers/aic8800/aic_load_fw/aic_bluetooth_main.c
+++ b/src/USB/driver_fw/drivers/aic8800/aic_load_fw/aic_bluetooth_main.c
@@ -20,7 +20,7 @@ int adap_test = 0;
char paringid[100];
int n_para = 1;
int ble_scan_wakeup_reboot_time = 1000;
-int aicwf_dbg_level = LOGERROR|LOGINFO|LOGDEBUG|LOGTRACE;
+int aicwf_dbg_level = LOGDATA;
int flash_erase_len = 0x400000;
uint32_t ad_data_filter_mask = 0;
uint32_t gpio_num = 2;//default select gpiob2 for fw_wakeup_host

View File

@ -0,0 +1,20 @@
--- a/src/USB/driver_fw/drivers/aic8800/aic_load_fw/aicbluetooth.c
+++ b/src/USB/driver_fw/drivers/aic8800/aic_load_fw/aicbluetooth.c
@@ -8,6 +8,7 @@
#ifdef CONFIG_USE_FW_REQUEST
#include <linux/firmware.h>
#endif
+#include <linux/string.h>
//Parser state
#define INIT 0
@@ -1227,7 +1228,8 @@ int aicbt_patch_info_unpack(struct aicbt
patch_info->info_len = head_t->len;
if(patch_info->info_len == 0)
return 0;
- memcpy(&patch_info->adid_addrinf, head_t->data, patch_info->info_len * sizeof(uint32_t) * 2);
+ unsafe_memcpy(&patch_info->adid_addrinf, head_t->data,
+ patch_info->info_len * sizeof(uint32_t) * 2, /* justification */);
}
return 0;
}

View File

@ -1,92 +0,0 @@
--- a/src/SDIO/driver_fw/driver/aic8800/aic8800_fdrv/rwnx_compat.h
+++ b/src/SDIO/driver_fw/driver/aic8800/aic8800_fdrv/rwnx_compat.h
@@ -52,7 +52,7 @@
#endif
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 60)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 15, 60) || defined(BUILD_OPENWRT)
#define IEEE80211_MAX_AMPDU_BUF IEEE80211_MAX_AMPDU_BUF_HE
#define IEEE80211_HE_PHY_CAP6_TRIG_MU_BEAMFORMER_FB IEEE80211_HE_PHY_CAP6_TRIG_MU_BEAMFORMING_PARTIAL_BW_FB
#define IEEE80211_HE_PHY_CAP6_TRIG_SU_BEAMFORMER_FB IEEE80211_HE_PHY_CAP6_TRIG_SU_BEAMFORMING_FB
--- a/src/SDIO/driver_fw/driver/aic8800/aic8800_fdrv/rwnx_main.c
+++ b/src/SDIO/driver_fw/driver/aic8800/aic8800_fdrv/rwnx_main.c
@@ -3063,7 +3063,7 @@ static struct rwnx_vif *rwnx_interface_a
} else
vif->use_4addr = false;
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 11, 0)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 11, 0) || defined(BUILD_OPENWRT)
if (cfg80211_register_netdevice(ndev))
#else
if (register_netdevice(ndev))
@@ -3336,7 +3336,7 @@ static int rwnx_cfg80211_del_iface(struc
if (dev->reg_state == NETREG_REGISTERED) {
/* Will call rwnx_close if interface is UP */
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 11, 0)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 11, 0) || defined(BUILD_OPENWRT)
cfg80211_unregister_netdevice(dev);
#else
unregister_netdevice(dev);
--- a/src/SDIO/driver_fw/driver/aic8800/aic8800_fdrv/rwnx_mod_params.c
+++ b/src/SDIO/driver_fw/driver/aic8800/aic8800_fdrv/rwnx_mod_params.c
@@ -1312,7 +1312,7 @@ static void rwnx_set_he_capa(struct rwnx
if (rwnx_hw->mod_params->stbc_on)
he_cap->he_cap_elem.phy_cap_info[2] |= IEEE80211_HE_PHY_CAP2_STBC_RX_UNDER_80MHZ;
- #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 13, 0)
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 13, 0) || defined(BUILD_OPENWRT)
he_cap->he_cap_elem.phy_cap_info[3] |= IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_RX_16_QAM |
IEEE80211_HE_PHY_CAP3_DCM_MAX_RX_NSS_1 |
IEEE80211_HE_PHY_CAP3_RX_PARTIAL_BW_SU_IN_20MHZ_MU;
@@ -1330,7 +1330,7 @@ static void rwnx_set_he_capa(struct rwnx
}
he_cap->he_cap_elem.phy_cap_info[5] |= IEEE80211_HE_PHY_CAP5_NG16_SU_FEEDBACK |
IEEE80211_HE_PHY_CAP5_NG16_MU_FEEDBACK;
- #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 13, 0)
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 13, 0) || defined(BUILD_OPENWRT)
he_cap->he_cap_elem.phy_cap_info[6] |= IEEE80211_HE_PHY_CAP6_CODEBOOK_SIZE_42_SU |
IEEE80211_HE_PHY_CAP6_CODEBOOK_SIZE_75_MU |
IEEE80211_HE_PHY_CAP6_TRIG_SU_BEAMFORMING_FB |
@@ -1429,7 +1429,7 @@ static void rwnx_set_he_capa(struct rwnx
#endif
if (rwnx_hw->mod_params->stbc_on)
he_cap->he_cap_elem.phy_cap_info[2] |= IEEE80211_HE_PHY_CAP2_STBC_RX_UNDER_80MHZ;
- #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 13, 0)
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 13, 0) || defined(BUILD_OPENWRT)
he_cap->he_cap_elem.phy_cap_info[3] |= IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_RX_16_QAM |
IEEE80211_HE_PHY_CAP3_DCM_MAX_RX_NSS_1 |
IEEE80211_HE_PHY_CAP3_RX_PARTIAL_BW_SU_IN_20MHZ_MU;
@@ -1446,7 +1446,7 @@ static void rwnx_set_he_capa(struct rwnx
}
he_cap->he_cap_elem.phy_cap_info[5] |= IEEE80211_HE_PHY_CAP5_NG16_SU_FEEDBACK |
IEEE80211_HE_PHY_CAP5_NG16_MU_FEEDBACK;
- #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 13, 0)
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 13, 0) || defined(BUILD_OPENWRT)
he_cap->he_cap_elem.phy_cap_info[6] |= IEEE80211_HE_PHY_CAP6_CODEBOOK_SIZE_42_SU |
IEEE80211_HE_PHY_CAP6_CODEBOOK_SIZE_75_MU |
IEEE80211_HE_PHY_CAP6_TRIG_SU_BEAMFORMING_FB |
@@ -1732,7 +1732,7 @@ void rwnx_custregd(struct rwnx_hw *rwnx_
wiphy->regulatory_flags |= REGULATORY_WIPHY_SELF_MANAGED;
rtnl_lock();
- #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 12, 0)
+ #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 12, 0) || defined(BUILD_OPENWRT)
if (regulatory_set_wiphy_regd_sync(wiphy, getRegdomainFromRwnxDB(wiphy, default_ccode))){
wiphy_err(wiphy, "Failed to set custom regdomain\n");
}
--- a/src/SDIO/driver_fw/driver/aic8800/aic8800_fdrv/rwnx_radar.c
+++ b/src/SDIO/driver_fw/driver/aic8800/aic8800_fdrv/rwnx_radar.c
@@ -1282,7 +1282,11 @@ static void rwnx_radar_detected(struct r
chan_def = rwnx_hw->chanctx_table[rwnx_hw->cur_chanctx].chan_def;
rwnx_radar_cancel_cac(&rwnx_hw->radar);
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 17, 0) || defined(BUILD_OPENWRT)
+ __cfg80211_radar_event(rwnx_hw->wiphy, &chan_def, true, GFP_KERNEL);
+#else
cfg80211_radar_event(rwnx_hw->wiphy, &chan_def, GFP_KERNEL);
+#endif
#endif /* CONFIG_RWNX_FULLMAC */
}

View File

@ -1,159 +0,0 @@
--- a/src/SDIO/driver_fw/driver/aic8800/aic8800_fdrv/rwnx_main.c
+++ b/src/SDIO/driver_fw/driver/aic8800/aic8800_fdrv/rwnx_main.c
@@ -783,7 +783,7 @@ static void rwnx_csa_finish(struct work_
spin_unlock_bh(&rwnx_hw->cb_lock);
#if (LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION3)
cfg80211_ch_switch_notify(vif->ndev, &csa->chandef, 0, 0);
-#elif (LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION)
+#elif (LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION) || defined(BUILD_OPENWRT)
cfg80211_ch_switch_notify(vif->ndev, &csa->chandef, 0);
#else
cfg80211_ch_switch_notify(vif->ndev, &csa->chandef);
@@ -3605,7 +3605,7 @@ bool key_flag = false;
* when adding a group key.
*/
static int rwnx_cfg80211_add_key(struct wiphy *wiphy, struct net_device *netdev,
-#if (LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION2)
+#if (LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION2) || defined(BUILD_OPENWRT)
int link_id,
#endif
u8 key_index, bool pairwise, const u8 *mac_addr,
@@ -3702,7 +3702,7 @@ bool key_flag = false;
*
*/
static int rwnx_cfg80211_get_key(struct wiphy *wiphy, struct net_device *netdev,
-#if (LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION2)
+#if (LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION2) || defined(BUILD_OPENWRT)
int link_id,
#endif
u8 key_index, bool pairwise, const u8 *mac_addr,
@@ -3720,7 +3720,7 @@ static int rwnx_cfg80211_get_key(struct
* and @key_index, return -ENOENT if the key doesn't exist.
*/
static int rwnx_cfg80211_del_key(struct wiphy *wiphy, struct net_device *netdev,
-#if (LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION2)
+#if (LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION2) || defined(BUILD_OPENWRT)
int link_id,
#endif
u8 key_index, bool pairwise, const u8 *mac_addr)
@@ -3759,7 +3759,7 @@ static int rwnx_cfg80211_del_key(struct
*/
static int rwnx_cfg80211_set_default_key(struct wiphy *wiphy,
struct net_device *netdev,
-#if (LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION2)
+#if (LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION2) || defined(BUILD_OPENWRT)
int link_id,
#endif
u8 key_index, bool unicast, bool multicast)
@@ -3774,7 +3774,7 @@ static int rwnx_cfg80211_set_default_key
*/
static int rwnx_cfg80211_set_default_mgmt_key(struct wiphy *wiphy,
struct net_device *netdev,
-#if (LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION2)
+#if (LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION2) || defined(BUILD_OPENWRT)
int link_id,
#endif
u8 key_index)
@@ -3861,7 +3861,7 @@ static int rwnx_cfg80211_connect(struct
key_params.seq_len = 0;
key_params.cipher = sme->crypto.cipher_group;
rwnx_cfg80211_add_key(wiphy, dev,
-#if (LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION2)
+#if (LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION2) || defined(BUILD_OPENWRT)
0,
#endif
sme->key_idx, false, NULL, &key_params);
@@ -4128,7 +4128,7 @@ static int rwnx_cfg80211_add_station(str
sta->vif_idx = rwnx_vif->vif_index;
sta->vlan_idx = sta->vif_idx;
sta->qos = (params->sta_flags_set & BIT(NL80211_STA_FLAG_WME)) != 0;
-#if LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION
+#if LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION || defined(BUILD_OPENWRT)
sta->ht = params->link_sta_params.ht_capa ? 1 : 0;
sta->vht = params->link_sta_params.vht_capa ? 1 : 0;
#else
@@ -4534,7 +4534,7 @@ static int rwnx_cfg80211_change_station(
sta->vif_idx = rwnx_vif->vif_index;
sta->vlan_idx = sta->vif_idx;
sta->qos = (params->sta_flags_set & BIT(NL80211_STA_FLAG_WME)) != 0;
-#if LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION
+#if LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION || defined(BUILD_OPENWRT)
sta->ht = params->link_sta_params.ht_capa ? 1 : 0;
sta->vht = params->link_sta_params.vht_capa ? 1 : 0;
#else
@@ -4781,7 +4781,7 @@ static int rwnx_cfg80211_change_beacon(s
/**
* * @stop_ap: Stop being an AP, including stopping beaconing.
*/
-#if (LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION)
+#if (LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION) || defined(BUILD_OPENWRT)
static int rwnx_cfg80211_stop_ap(struct wiphy *wiphy, struct net_device *dev, unsigned int link_id)
#else
static int rwnx_cfg80211_stop_ap(struct wiphy *wiphy, struct net_device *dev)
@@ -5266,7 +5266,7 @@ static int rwnx_cfg80211_dump_survey(str
*/
static int rwnx_cfg80211_get_channel(struct wiphy *wiphy,
struct wireless_dev *wdev,
-#if LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION
+#if LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION || defined(BUILD_OPENWRT)
unsigned int link_id,
#endif
struct cfg80211_chan_def *chandef)
@@ -5563,7 +5563,7 @@ int rwnx_cfg80211_channel_switch (struct
INIT_WORK(&csa->work, rwnx_csa_finish);
#if LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION4
cfg80211_ch_switch_started_notify(dev, &csa->chandef, 0, params->count, false, 0);
-#elif LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION2
+#elif LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION2 || defined(BUILD_OPENWRT)
cfg80211_ch_switch_started_notify(dev, &csa->chandef, 0, params->count, false);
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(5, 11, 0)
cfg80211_ch_switch_started_notify(dev, &csa->chandef, params->count, params->block_tx);
--- a/src/SDIO/driver_fw/driver/aic8800/aic8800_fdrv/rwnx_msg_rx.c
+++ b/src/SDIO/driver_fw/driver/aic8800/aic8800_fdrv/rwnx_msg_rx.c
@@ -851,7 +851,7 @@ static inline int rwnx_rx_sm_connect_ind
do {
bss = cfg80211_get_bss(wdev->wiphy, NULL, rwnx_vif->sta.bssid,
-#if LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION
+#if LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION || defined(BUILD_OPENWRT)
wdev->u.client.ssid, wdev->u.client.ssid_len,
#else
wdev->ssid, wdev->ssid_len,
@@ -881,7 +881,7 @@ static inline int rwnx_rx_sm_connect_ind
#else
WLAN_CAPABILITY_ESS,
#endif
-#if LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION
+#if LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION || defined(BUILD_OPENWRT)
(int)wdev->u.client.ssid_len,
wdev->u.client.ssid,
#else
@@ -902,7 +902,7 @@ static inline int rwnx_rx_sm_connect_ind
rwnx_vif->sta.bssid[0], rwnx_vif->sta.bssid[1], rwnx_vif->sta.bssid[2],
rwnx_vif->sta.bssid[3], rwnx_vif->sta.bssid[4], rwnx_vif->sta.bssid[5]);
-#if LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION
+#if LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION || defined(BUILD_OPENWRT)
wdev->u.client.ssid_len = (int)rwnx_vif->sta.ssid_len;
memcpy(wdev->u.client.ssid, rwnx_vif->sta.ssid, wdev->u.client.ssid_len);
#else
@@ -942,7 +942,7 @@ static inline int rwnx_rx_sm_connect_ind
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
struct cfg80211_roam_info info;
memset(&info, 0, sizeof(info));
-#if LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION
+#if LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION || defined(BUILD_OPENWRT)
if (rwnx_vif->ch_index < NX_CHAN_CTXT_CNT)
info.links[0].channel = rwnx_hw->chanctx_table[rwnx_vif->ch_index].chan_def.chan;
info.links[0].bssid = (const u8 *)ind->bssid.array;
--- a/src/SDIO/driver_fw/driver/aic8800/aic8800_fdrv/rwnx_msg_tx.c
+++ b/src/SDIO/driver_fw/driver/aic8800/aic8800_fdrv/rwnx_msg_tx.c
@@ -2076,7 +2076,7 @@ int rwnx_send_me_sta_add(struct rwnx_hw
{
struct me_sta_add_req *req;
-#if LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION
+#if LINUX_VERSION_CODE >= HIGH_KERNEL_VERSION || defined(BUILD_OPENWRT)
struct link_station_parameters *link_sta_params = &params->link_sta_params;
#else
struct station_parameters *link_sta_params = params;