Skip to content

Commit

Permalink
mac80211:fix rt2x00 build failure
Browse files Browse the repository at this point in the history
  • Loading branch information
DHDAXCW committed Nov 1, 2022
1 parent 49978ed commit b7359cf
Show file tree
Hide file tree
Showing 94 changed files with 1,620 additions and 655 deletions.
29 changes: 13 additions & 16 deletions package/kernel/mac80211/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ include $(INCLUDE_DIR)/kernel.mk

PKG_NAME:=mac80211

PKG_VERSION:=5.10.68-1
PKG_VERSION:=5.10.85-1
PKG_RELEASE:=1
PKG_SOURCE_URL:=@KERNEL/linux/kernel/projects/backports/stable/v5.10.68/
PKG_HASH:=bba161b0084590c677a84b80993709e388a3c478f29ed0c475d4fce1b9162968
PKG_SOURCE_URL:=@KERNEL/linux/kernel/projects/backports/stable/v5.10.85/
PKG_HASH:=0b5f2d5acf572c448f102a186aaccd8b77bda182ac5166c7b2e3217870162784

PKG_SOURCE:=backports-$(PKG_VERSION).tar.xz
PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/backports-$(PKG_VERSION)
Expand Down Expand Up @@ -98,7 +98,7 @@ PKG_CONFIG_DEPENDS += \
define KernelPackage/cfg80211
$(call KernelPackage/mac80211/Default)
TITLE:=cfg80211 - wireless configuration API
DEPENDS+= +iw +iwinfo +wireless-regdb
DEPENDS+= +iw +wireless-regdb
ABI_VERSION:=$(PKG_VERSION)-$(PKG_RELEASE)
FILES:= \
$(PKG_BUILD_DIR)/compat/compat.ko \
Expand Down Expand Up @@ -127,7 +127,7 @@ define KernelPackage/mac80211
$(call KernelPackage/mac80211/Default)
TITLE:=Linux 802.11 Wireless Networking Stack
# +kmod-crypto-cmac is a runtime only dependency of net/mac80211/aes_cmac.c
DEPENDS+= +kmod-cfg80211 +kmod-crypto-cmac +kmod-crypto-ccm +kmod-crypto-gcm +hostapd-common
DEPENDS+= +kmod-cfg80211 +hostapd-common
KCONFIG:=\
CONFIG_AVERAGE=y
FILES:= $(PKG_BUILD_DIR)/net/mac80211/mac80211.ko
Expand Down Expand Up @@ -434,9 +434,15 @@ config-$(call config_package,rsi91x-sdio) += RSI_SDIO

config-$(CONFIG_LEDS_TRIGGERS) += MAC80211_LEDS

C_DEFINES=

ifeq ($(BUILD_VARIANT),smallbuffers)
C_DEFINES+= -DCONFIG_ATH10K_SMALLBUFFERS
endif

MAKE_OPTS:= -C "$(PKG_BUILD_DIR)" \
$(KERNEL_MAKE_FLAGS) \
EXTRA_CFLAGS="-I$(PKG_BUILD_DIR)/include $(IREMAP_CFLAGS)" \
EXTRA_CFLAGS="-I$(PKG_BUILD_DIR)/include $(IREMAP_CFLAGS) $(C_DEFINES)" \
KLIB_BUILD="$(LINUX_DIR)" \
MODPROBE=true \
KLIB=$(TARGET_MODULES_DIR) \
Expand Down Expand Up @@ -501,29 +507,19 @@ define Build/Patch
$(call PatchDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/build,build/)
$(call PatchDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/subsys,subsys/)
$(call PatchDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/ath,ath/)
$(call PatchDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/ath5k,ath5k/)
$(call PatchDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/ath9k,ath9k/)
$(call PatchDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/ath10k,ath10k/)
$(call PatchDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/ath11k,ath11k/)
$(call PatchDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/rt2x00,rt2x00/)
$(call PatchDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/mwl,mwl/)
$(call PatchDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/brcm,brcm/)
$(call PatchDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/rtl,rtl/)
$(if $(QUILT),touch $(PKG_BUILD_DIR)/.quilt_used)
endef

define Quilt/Refresh/Package
$(call Quilt/RefreshDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/build,build/)
$(call Quilt/RefreshDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/subsys,subsys/)
$(call Quilt/RefreshDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/ath,ath/)
$(call Quilt/RefreshDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/ath5k,ath5k/)
$(call Quilt/RefreshDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/ath9k,ath9k/)
$(call Quilt/RefreshDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/ath10k,ath10k/)
$(call Quilt/RefreshDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/ath11k,ath11k/)
$(call Quilt/RefreshDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/rt2x00,rt2x00/)
$(call Quilt/RefreshDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/mwl,mwl/)
$(call Quilt/RefreshDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/brcm,brcm/)
$(call Quilt/RefreshDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/rtl,rtl/)
endef

define Build/Compile
Expand All @@ -549,6 +545,7 @@ endef
define KernelPackage/cfg80211/install
$(INSTALL_DIR) $(1)/lib/wifi $(1)/lib/netifd/wireless
$(INSTALL_DATA) ./files/lib/wifi/mac80211.sh $(1)/lib/wifi
$(INSTALL_DATA) ./files/lib/netifd/mac80211.sh $(1)/lib/netifd
$(INSTALL_BIN) ./files/lib/netifd/wireless/mac80211.sh $(1)/lib/netifd/wireless
$(INSTALL_DIR) $(1)/etc/hotplug.d/ieee80211
$(INSTALL_DATA) ./files/mac80211.hotplug $(1)/etc/hotplug.d/ieee80211/10-wifi-detect
Expand Down
21 changes: 14 additions & 7 deletions package/kernel/mac80211/ath.mk
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
PKG_DRIVERS += \
ath ath5k ath6kl ath6kl-sdio ath6kl-usb ath9k ath9k-common ath9k-htc ath10k \
ath ath5k ath6kl ath6kl-sdio ath6kl-usb ath9k ath9k-common ath9k-htc ath10k ath10k-smallbuffers \
carl9170 owl-loader ar5523 wil6210

PKG_CONFIG_DEPENDS += \
Expand Down Expand Up @@ -34,7 +34,7 @@ ifdef CONFIG_PACKAGE_MAC80211_TRACING
WIL6210_TRACING
endif

config-$(call config_package,ath) += ATH_CARDS ATH_COMMON
config-$(call config_package,ath) += ATH_CARDS ATH_COMMON ATH_REG_DYNAMIC_USER_REG_HINTS
config-$(CONFIG_PACKAGE_ATH_DEBUG) += ATH_DEBUG ATH10K_DEBUG ATH9K_STATION_STATISTICS
config-$(CONFIG_PACKAGE_ATH_DFS) += ATH9K_DFS_CERTIFIED ATH10K_DFS_CERTIFIED
config-$(CONFIG_PACKAGE_ATH_SPECTRAL) += ATH9K_COMMON_SPECTRAL ATH10K_SPECTRAL
Expand All @@ -45,7 +45,7 @@ config-$(call config_package,owl-loader) += ATH9K_PCI_NO_EEPROM
config-$(CONFIG_TARGET_ath79) += ATH9K_AHB
config-$(CONFIG_TARGET_ipq40xx) += ATH10K_AHB
config-$(CONFIG_PCI) += ATH9K_PCI
config-$(CONFIG_ATH_USER_REGD) += ATH_USER_REGD ATH_REG_DYNAMIC_USER_REG_HINTS
config-$(CONFIG_ATH_USER_REGD) += ATH_USER_REGD
config-$(CONFIG_ATH9K_HWRNG) += ATH9K_HWRNG
config-$(CONFIG_ATH9K_SUPPORT_PCOEM) += ATH9K_PCOEM
config-$(CONFIG_ATH9K_TX99) += ATH9K_TX99
Expand All @@ -55,6 +55,7 @@ config-$(CONFIG_ATH10K_THERMAL) += ATH10K_THERMAL

config-$(call config_package,ath9k-htc) += ATH9K_HTC
config-$(call config_package,ath10k) += ATH10K ATH10K_PCI
config-$(call config_package,ath10k-smallbuffers) += ATH10K ATH10K_PCI ATH10K_SMALLBUFFERS

config-$(call config_package,ath5k) += ATH5K
ifdef CONFIG_TARGET_ath25
Expand Down Expand Up @@ -260,6 +261,7 @@ define KernelPackage/ath10k
$(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath10k/ath10k_core.ko \
$(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath10k/ath10k_pci.ko
AUTOLOAD:=$(call AutoProbe,ath10k_pci)
VARIANT:=regular
endef

define KernelPackage/ath10k/description
Expand All @@ -273,13 +275,18 @@ define KernelPackage/ath10k/config
config ATH10K_LEDS
bool "Enable LED support"
default y
depends on PACKAGE_kmod-ath10k
depends on PACKAGE_kmod-ath10k || PACKAGE_kmod-ath10k-smallbuffers

config ATH10K_THERMAL
bool "Enable thermal sensors and throttling support"
default y
depends on PACKAGE_kmod-ath10k
depends on PACKAGE_kmod-ath10k || PACKAGE_kmod-ath10k-smallbuffers

endef

define KernelPackage/ath10k-smallbuffers
$(call KernelPackage/ath10k)
TITLE+= (small buffers for low-RAM devices)
VARIANT:=smallbuffers
endef

define KernelPackage/carl9170
Expand Down Expand Up @@ -310,7 +317,7 @@ endef
define KernelPackage/ar5523
$(call KernelPackage/mac80211/Default)
TITLE:=Driver for Atheros AR5523 USB sticks
DEPENDS:=@USB_SUPPORT +kmod-mac80211 +kmod-ath +kmod-usb-core +kmod-input-core
DEPENDS:=@USB_SUPPORT +kmod-mac80211 +kmod-ath +kmod-usb-core +kmod-input-core
FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ath/ar5523/ar5523.ko
AUTOLOAD:=$(call AutoProbe,ar5523)
endef
Expand Down
4 changes: 2 additions & 2 deletions package/kernel/mac80211/broadcom.mk
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ config PACKAGE_B43_USE_BCMA
default "16,28,29,30" if TARGET_bcm47xx_mips74k
default "5,6,7,8,9,10,11,13,15,16,28,29,30"
help
This is a comma separated list of core revision numbers.
This is a comma seperated list of core revision numbers.

Example (keep files for rev5 only):
5
Expand All @@ -224,7 +224,7 @@ config PACKAGE_B43_USE_BCMA
default "N,HT" if TARGET_bcm47xx_mips74k
default "G,N,LP,HT"
help
This is a comma separated list of PHY types:
This is a comma seperated list of PHY types:
A => A-PHY
AG => Dual A-PHY G-PHY
G => G-PHY
Expand Down
36 changes: 36 additions & 0 deletions package/kernel/mac80211/files/lib/netifd/mac80211.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
mac80211_phy_to_path() {
local phy="$1"

[ -x /usr/bin/readlink -a -h /sys/class/ieee80211/${phy} ] || return

local path="$(readlink -f /sys/class/ieee80211/${phy}/device)"
[ -n "$path" ] || return

path="${path##/sys/devices/}"
case "$path" in
platform*/pci*) path="${path##platform/}";;
esac

local p
local seq=""
for p in $(ls /sys/class/ieee80211/$phy/device/ieee80211); do
[ "$p" = "$phy" ] && {
echo "$path${seq:++$seq}"
break
}

seq=$((${seq:-0} + 1))
done
}

mac80211_path_to_phy() {
local path="$1"

local p
for p in $(ls /sys/class/ieee80211); do
local cur="$(mac80211_phy_to_path "$p")"
case "$cur" in
*$path) echo "$p"; return;;
esac
done
}
35 changes: 28 additions & 7 deletions package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/sh
. /lib/netifd/netifd-wireless.sh
. /lib/netifd/hostapd.sh
. /lib/netifd/mac80211.sh

init_wireless_driver "$@"

Expand Down Expand Up @@ -52,6 +53,8 @@ drv_mac80211_init_device_config() {
he_spr_sr_control \
he_twt_required
config_add_int \
beamformer_antennas \
beamformee_antennas \
vht_max_a_mpdu_len_exp \
vht_max_mpdu \
vht_link_adapt \
Expand Down Expand Up @@ -293,6 +296,8 @@ mac80211_hostapd_setup_base() {
mu_beamformee:1 \
vht_txop_ps:1 \
htc_vht:1 \
beamformee_antennas:4 \
beamformer_antennas:4 \
rx_antenna_pattern:1 \
tx_antenna_pattern:1 \
vht_max_a_mpdu_len_exp:7 \
Expand Down Expand Up @@ -333,6 +338,18 @@ mac80211_hostapd_setup_base() {
RX-STBC-123:0x700:0x300:1 \
RX-STBC-1234:0x700:0x400:1 \

[ "$(($vht_cap & 0x800))" -gt 0 -a "$su_beamformer" -gt 0 ] && {
cap_ant="$(( ( ($vht_cap >> 16) & 3 ) + 1 ))"
[ "$cap_ant" -gt "$beamformer_antennas" ] && cap_ant="$beamformer_antennas"
[ "$cap_ant" -gt 1 ] && vht_capab="$vht_capab[SOUNDING-DIMENSION-$cap_ant]"
}

[ "$(($vht_cap & 0x1000))" -gt 0 -a "$su_beamformee" -gt 0 ] && {
cap_ant="$(( ( ($vht_cap >> 13) & 3 ) + 1 ))"
[ "$cap_ant" -gt "$beamformee_antennas" ] && cap_ant="$beamformee_antennas"
[ "$cap_ant" -gt 1 ] && vht_capab="$vht_capab[BF-ANTENNA-$cap_ant]"
}

# supported Channel widths
vht160_hw=0
[ "$(($vht_cap & 12))" -eq 4 -a 1 -le "$vht160" ] && \
Expand Down Expand Up @@ -546,7 +563,7 @@ mac80211_generate_mac() {
find_phy() {
[ -n "$phy" -a -d /sys/class/ieee80211/$phy ] && return 0
[ -n "$path" ] && {
phy="$(iwinfo nl80211 phyname "path=$path")"
phy="$(mac80211_path_to_phy "$path")"
[ -n "$phy" ] && return 0
}
[ -n "$macaddr" ] && {
Expand Down Expand Up @@ -603,7 +620,8 @@ mac80211_iw_interface_add() {
}
[ "$rc" = 233 ] && {
iw dev "$ifname" del >/dev/null 2>&1
#iw dev "$ifname" del >/dev/null 2>&1
ip link set dev "$ifname" down 2>/dev/null
[ "$?" = 0 ] && {
sleep 1
Expand Down Expand Up @@ -726,12 +744,13 @@ mac80211_setup_supplicant() {
[ "$enable" = 0 ] && {
ubus call wpa_supplicant.${phy} config_remove "{\"iface\":\"$ifname\"}"
ip link set dev "$ifname" down
iw dev "$ifname" del
#iw dev "$ifname" del
return 0
}
wpa_supplicant_prepare_interface "$ifname" nl80211 || {
iw dev "$ifname" del
#iw dev "$ifname" del
ip link set dev "$ifname" down
return 1
}
if [ "$mode" = "sta" ]; then
Expand Down Expand Up @@ -763,7 +782,8 @@ mac80211_setup_supplicant_noctl() {
local enable=$1
local spobj="$(ubus -S list | grep wpa_supplicant.${ifname})"
wpa_supplicant_prepare_interface "$ifname" nl80211 || {
iw dev "$ifname" del
#iw dev "$ifname" del
ip link set dev "$ifname" down
return 1
}
Expand Down Expand Up @@ -860,6 +880,7 @@ mac80211_setup_adhoc() {
mcval=
[ -n "$mcast_rate" ] && wpa_supplicant_add_rate mcval "$mcast_rate"
iw dev "$ifname" set type ibss
iw dev "$ifname" ibss join "$ssid" $freq $iw_htmode fixed-freq $bssid \
beacon-interval $beacon_int \
${brstr:+basic-rates $brstr} \
Expand Down Expand Up @@ -982,7 +1003,7 @@ mac80211_vap_cleanup() {
for wdev in $vaps; do
[ "$service" != "none" ] && ubus call ${service} config_remove "{\"iface\":\"$wdev\"}"
ip link set dev "$wdev" down 2>/dev/null
iw dev "$wdev" del
#iw dev "$wdev" del
done
}
Expand Down Expand Up @@ -1043,7 +1064,7 @@ drv_mac80211_setup() {
done
if [ "$found" = "0" ]; then
ip link set dev "$wdev" down
iw dev "$wdev" del
#iw dev "$wdev" del
fi
done
Expand Down
Loading

0 comments on commit b7359cf

Please sign in to comment.