mac80211: fix receiving mesh packets in forwarding=0 networks
[openwrt/openwrt.git] / package / kernel / mac80211 / Makefile
1 #
2 # Copyright (C) 2007-2015 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 include $(TOPDIR)/rules.mk
9 include $(INCLUDE_DIR)/kernel.mk
10
11 PKG_NAME:=mac80211
12
13 PKG_VERSION:=6.1-rc8
14 PKG_RELEASE:=3
15 # PKG_SOURCE_URL:=@KERNEL/linux/kernel/projects/backports/stable/v5.15.58/
16 PKG_SOURCE_URL:=http://mirror2.openwrt.org/sources/
17 PKG_HASH:=7f3d96c2573183cd79d6a3ebe5e1b7b73c19d1326d443c85b69c4181f14e6e2b
18
19 PKG_SOURCE:=backports-$(PKG_VERSION).tar.xz
20 PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/backports-$(PKG_VERSION)
21 PKG_BUILD_PARALLEL:=1
22
23 PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
24
25 PKG_DRIVERS = \
26 mac80211-hwsim \
27 mt7601u \
28 rsi91x rsi91x-usb rsi91x-sdio\
29 wlcore wl12xx wl18xx
30
31 PKG_CONFIG_DEPENDS:= \
32 CONFIG_PACKAGE_kmod-mac80211 \
33 CONFIG_PACKAGE_CFG80211_TESTMODE \
34 CONFIG_PACKAGE_MAC80211_DEBUGFS \
35 CONFIG_PACKAGE_MAC80211_MESH \
36 CONFIG_PACKAGE_MAC80211_TRACING \
37 CONFIG_PACKAGE_IWLWIFI_DEBUG \
38 CONFIG_PACKAGE_IWLWIFI_DEBUGFS \
39 CONFIG_PACKAGE_RTLWIFI_DEBUG \
40
41 include $(INCLUDE_DIR)/package.mk
42
43 WMENU:=Wireless Drivers
44
45 define KernelPackage/mac80211/Default
46 SUBMENU:=$(WMENU)
47 URL:=https://wireless.wiki.kernel.org/
48 MAINTAINER:=Felix Fietkau <nbd@nbd.name>
49 endef
50
51 config_package=$(if $(CONFIG_PACKAGE_kmod-$(1)),m)
52
53 config-y:= \
54 WLAN \
55 CFG80211_CERTIFICATION_ONUS \
56 MAC80211_RC_MINSTREL \
57 MAC80211_RC_MINSTREL_HT \
58 MAC80211_RC_MINSTREL_VHT \
59 MAC80211_RC_DEFAULT_MINSTREL \
60 WLAN_VENDOR_ADMTEK \
61 WLAN_VENDOR_ATH \
62 WLAN_VENDOR_ATMEL \
63 WLAN_VENDOR_BROADCOM \
64 WLAN_VENDOR_CISCO \
65 WLAN_VENDOR_INTEL \
66 WLAN_VENDOR_INTERSIL \
67 WLAN_VENDOR_MARVELL \
68 WLAN_VENDOR_MEDIATEK \
69 WLAN_VENDOR_RALINK \
70 WLAN_VENDOR_REALTEK \
71 WLAN_VENDOR_RSI \
72 WLAN_VENDOR_ST \
73 WLAN_VENDOR_TI \
74 WLAN_VENDOR_ZYDAS \
75
76 config-$(call config_package,cfg80211) += CFG80211
77 config-$(CONFIG_PACKAGE_CFG80211_TESTMODE) += NL80211_TESTMODE
78
79 config-$(call config_package,mac80211) += MAC80211
80 config-$(CONFIG_PACKAGE_MAC80211_MESH) += MAC80211_MESH
81
82 include ath.mk
83 include broadcom.mk
84 include intel.mk
85 include marvell.mk
86 include ralink.mk
87 include realtek.mk
88
89 PKG_CONFIG_DEPENDS += \
90 $(patsubst %,CONFIG_PACKAGE_kmod-%,$(PKG_DRIVERS))
91
92 define KernelPackage/cfg80211
93 $(call KernelPackage/mac80211/Default)
94 TITLE:=cfg80211 - wireless configuration API
95 DEPENDS+= +iw +iwinfo +wireless-regdb +USE_RFKILL:kmod-rfkill
96 ABI_VERSION:=$(PKG_VERSION)-$(PKG_RELEASE)
97 FILES:= \
98 $(PKG_BUILD_DIR)/compat/compat.ko \
99 $(PKG_BUILD_DIR)/net/wireless/cfg80211.ko
100 endef
101
102 define KernelPackage/cfg80211/description
103 cfg80211 is the Linux wireless LAN (802.11) configuration API.
104 endef
105
106 define KernelPackage/cfg80211/config
107 if PACKAGE_kmod-cfg80211
108
109 config PACKAGE_CFG80211_TESTMODE
110 bool "Enable testmode command support"
111 default n
112 help
113 This is typically used for tests and calibration during
114 manufacturing, or vendor specific debugging features
115
116 endif
117 endef
118
119
120 define KernelPackage/mac80211
121 $(call KernelPackage/mac80211/Default)
122 TITLE:=Linux 802.11 Wireless Networking Stack
123 # +kmod-crypto-cmac is a runtime only dependency of net/mac80211/aes_cmac.c
124 DEPENDS+= +kmod-cfg80211 +kmod-crypto-cmac +kmod-crypto-ccm +kmod-crypto-gcm +hostapd-common
125 KCONFIG:=\
126 CONFIG_AVERAGE=y
127 FILES:= $(PKG_BUILD_DIR)/net/mac80211/mac80211.ko
128 ABI_VERSION:=$(PKG_VERSION)-$(PKG_RELEASE)
129 MENU:=1
130 endef
131
132 define KernelPackage/mac80211/config
133 if PACKAGE_kmod-mac80211
134
135 config PACKAGE_MAC80211_DEBUGFS
136 bool "Export mac80211 internals in DebugFS"
137 select KERNEL_DEBUG_FS
138 default y
139 help
140 Select this to see extensive information about
141 the internal state of mac80211 in debugfs.
142
143 config PACKAGE_MAC80211_TRACING
144 bool "Enable tracing (mac80211 and supported drivers)"
145 select KERNEL_FTRACE
146 select KERNEL_ENABLE_DEFAULT_TRACERS
147 default n
148 help
149 Select this to enable tracing of mac80211 and
150 related wifi drivers (using trace-cmd).
151
152 config PACKAGE_MAC80211_MESH
153 bool "Enable 802.11s mesh support"
154 default y
155
156 endif
157 endef
158
159 define KernelPackage/mac80211/description
160 Generic IEEE 802.11 Networking Stack (mac80211)
161 endef
162
163 define KernelPackage/mac80211-hwsim
164 $(call KernelPackage/mac80211/Default)
165 TITLE:=mac80211 HW simulation device
166 DEPENDS+= +kmod-mac80211 +@DRIVER_11AX_SUPPORT +@DRIVER_11AC_SUPPORT
167 FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/mac80211_hwsim.ko
168 AUTOLOAD:=$(call AutoProbe,mac80211_hwsim)
169 endef
170
171
172 define KernelPackage/mt7601u
173 $(call KernelPackage/mac80211/Default)
174 TITLE:=MT7601U-based USB dongles Wireless Driver
175 DEPENDS+= +kmod-mac80211 @USB_SUPPORT +kmod-usb-core +mt7601u-firmware
176 FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/mediatek/mt7601u/mt7601u.ko
177 AUTOLOAD:=$(call AutoProbe,mt7601u)
178 endef
179
180 define KernelPackage/rsi91x
181 $(call KernelPackage/mac80211/Default)
182 TITLE:=Redpine Signals Inc 91x WLAN driver support
183 DEPENDS+= +kmod-mac80211 +rs9113-firmware
184 FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rsi/rsi_91x.ko
185 endef
186
187 define KernelPackage/rsi91x-usb
188 $(call KernelPackage/mac80211/Default)
189 TITLE:=Redpine Signals USB bus support
190 DEPENDS+=@USB_SUPPORT +kmod-usb-core +kmod-mac80211 +kmod-rsi91x +rs9113-firmware
191 FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rsi/rsi_usb.ko
192 AUTOLOAD:=$(call AutoProbe,rsi_usb)
193 endef
194
195 define KernelPackage/rsi91x-sdio
196 $(call KernelPackage/mac80211/Default)
197 TITLE:=Redpine Signals SDIO bus support
198 DEPENDS+= +kmod-mac80211 +kmod-mmc +kmod-rsi91x +rs9113-firmware
199 FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/rsi/rsi_sdio.ko
200 AUTOLOAD:=$(call AutoProbe,rsi_sdio)
201 endef
202
203
204 define KernelPackage/wlcore
205 $(call KernelPackage/mac80211/Default)
206 TITLE:=TI common driver part
207 DEPENDS+= +kmod-mmc +kmod-mac80211
208 FILES:= \
209 $(PKG_BUILD_DIR)/drivers/net/wireless/ti/wlcore/wlcore.ko \
210 $(PKG_BUILD_DIR)/drivers/net/wireless/ti/wlcore/wlcore_sdio.ko
211 AUTOLOAD:=$(call AutoProbe,wlcore wlcore_sdio)
212 endef
213
214 define KernelPackage/wlcore/description
215 This module contains some common parts needed by TI Wireless drivers.
216 endef
217
218 define KernelPackage/wl12xx
219 $(call KernelPackage/mac80211/Default)
220 TITLE:=Driver for TI WL12xx
221 URL:=https://wireless.wiki.kernel.org/en/users/drivers/wl12xx
222 DEPENDS+= +kmod-wlcore +wl12xx-firmware
223 FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ti/wl12xx/wl12xx.ko
224 AUTOLOAD:=$(call AutoProbe,wl12xx)
225 endef
226
227 define KernelPackage/wl12xx/description
228 Kernel modules for TI WL12xx
229 endef
230
231 define KernelPackage/wl18xx
232 $(call KernelPackage/mac80211/Default)
233 TITLE:=Driver for TI WL18xx
234 URL:=https://wireless.wiki.kernel.org/en/users/drivers/wl18xx
235 DEPENDS+= +kmod-wlcore +wl18xx-firmware
236 FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ti/wl18xx/wl18xx.ko
237 AUTOLOAD:=$(call AutoProbe,wl18xx)
238 endef
239
240 define KernelPackage/wl18xx/description
241 Kernel modules for TI WL18xx
242 endef
243
244
245 ifdef CONFIG_PACKAGE_MAC80211_DEBUGFS
246 config-y += \
247 CFG80211_DEBUGFS \
248 MAC80211_DEBUGFS
249 endif
250
251 ifdef CONFIG_PACKAGE_MAC80211_TRACING
252 config-y += \
253 IWLWIFI_DEVICE_TRACING
254 endif
255
256 config-$(call config_package,mac80211-hwsim) += MAC80211_HWSIM
257 config-$(call config_package,mt7601u) += MT7601U
258 config-y += WL_MEDIATEK
259
260 config-$(call config_package,wlcore) += WLCORE WLCORE_SDIO
261 config-$(call config_package,wl12xx) += WL12XX
262 config-$(call config_package,wl18xx) += WL18XX
263 config-y += WL_TI WILINK_PLATFORM_DATA
264 config-$(call config_package,rsi91x) += RSI_91X
265 config-$(call config_package,rsi91x-usb) += RSI_USB
266 config-$(call config_package,rsi91x-sdio) += RSI_SDIO
267
268 config-$(CONFIG_LEDS_TRIGGERS) += MAC80211_LEDS
269
270 C_DEFINES=
271
272 ifeq ($(BUILD_VARIANT),smallbuffers)
273 C_DEFINES+= -DCONFIG_ATH10K_SMALLBUFFERS
274 endif
275
276 MAKE_OPTS:= \
277 $(subst -C $(LINUX_DIR),-C "$(PKG_BUILD_DIR)",$(KERNEL_MAKEOPTS)) \
278 EXTRA_CFLAGS="-I$(PKG_BUILD_DIR)/include $(IREMAP_CFLAGS) $(C_DEFINES)" \
279 KLIB_BUILD="$(LINUX_DIR)" \
280 MODPROBE=true \
281 KLIB=$(TARGET_MODULES_DIR) \
282 KERNEL_SUBLEVEL=$(lastword $(subst ., ,$(KERNEL_PATCHVER))) \
283 KBUILD_LDFLAGS_MODULE_PREREQ=
284
285 define ConfigVars
286 $(subst $(space),,$(foreach opt,$(config-$(1)),CPTCFG_$(opt)=$(1)
287 ))
288 endef
289
290 define mac80211_config
291 $(call ConfigVars,m)$(call ConfigVars,y)
292 endef
293 $(eval $(call shexport,mac80211_config))
294
295 define Build/Prepare
296 rm -rf $(PKG_BUILD_DIR)
297 mkdir -p $(PKG_BUILD_DIR)
298 $(PKG_UNPACK)
299 $(Build/Patch)
300 rm -rf \
301 $(PKG_BUILD_DIR)/include/linux/ssb \
302 $(PKG_BUILD_DIR)/include/linux/bcma \
303 $(PKG_BUILD_DIR)/include/net/bluetooth
304
305 rm -f \
306 $(PKG_BUILD_DIR)/include/linux/cordic.h \
307 $(PKG_BUILD_DIR)/include/linux/crc8.h \
308 $(PKG_BUILD_DIR)/include/linux/eeprom_93cx6.h \
309 $(PKG_BUILD_DIR)/include/linux/wl12xx.h \
310 $(PKG_BUILD_DIR)/include/linux/mhi.h \
311 $(PKG_BUILD_DIR)/include/net/ieee80211.h \
312 $(PKG_BUILD_DIR)/backport-include/linux/bcm47xx_nvram.h
313
314 echo 'compat-wireless-$(PKG_VERSION)-$(PKG_RELEASE)-$(REVISION)' > $(PKG_BUILD_DIR)/compat_version
315 endef
316
317 ifneq ($(CONFIG_PACKAGE_kmod-cfg80211),)
318 define Build/Compile/kmod
319 rm -rf $(PKG_BUILD_DIR)/modules
320 +$(MAKE) $(PKG_JOBS) $(MAKE_OPTS) modules
321 endef
322 endif
323
324 #do not Build/Configure for EXTERNAL KERNEL
325 ifeq ($(strip $(CONFIG_EXTERNAL_KERNEL_TREE)),"")
326 ifeq ($(strip $(CONFIG_KERNEL_GIT_CLONE_URI)),"")
327 define Build/Configure
328 cmp $(PKG_BUILD_DIR)/include/linux/ath9k_platform.h $(LINUX_DIR)/include/linux/ath9k_platform.h
329 cmp $(PKG_BUILD_DIR)/include/linux/ath5k_platform.h $(LINUX_DIR)/include/linux/ath5k_platform.h
330 cmp $(PKG_BUILD_DIR)/include/linux/rt2x00_platform.h $(LINUX_DIR)/include/linux/rt2x00_platform.h
331 endef
332 endif
333 endif
334
335 define Build/Patch
336 $(if $(QUILT),rm -rf $(PKG_BUILD_DIR)/patches; mkdir -p $(PKG_BUILD_DIR)/patches)
337 $(call PatchDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/build,build/)
338 $(call PatchDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/subsys,subsys/)
339 $(call PatchDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/ath,ath/)
340 $(call PatchDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/ath5k,ath5k/)
341 $(call PatchDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/ath9k,ath9k/)
342 $(call PatchDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/ath10k,ath10k/)
343 $(call PatchDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/ath11k,ath11k/)
344 $(call PatchDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/rt2x00,rt2x00/)
345 $(call PatchDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/mwl,mwl/)
346 $(call PatchDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/brcm,brcm/)
347 $(call PatchDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/rtl,rtl/)
348 $(if $(QUILT),touch $(PKG_BUILD_DIR)/.quilt_used)
349 endef
350
351 define Quilt/Refresh/Package
352 $(call Quilt/RefreshDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/build,build/)
353 $(call Quilt/RefreshDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/subsys,subsys/)
354 $(call Quilt/RefreshDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/ath,ath/)
355 $(call Quilt/RefreshDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/ath5k,ath5k/)
356 $(call Quilt/RefreshDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/ath9k,ath9k/)
357 $(call Quilt/RefreshDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/ath10k,ath10k/)
358 $(call Quilt/RefreshDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/ath11k,ath11k/)
359 $(call Quilt/RefreshDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/rt2x00,rt2x00/)
360 $(call Quilt/RefreshDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/mwl,mwl/)
361 $(call Quilt/RefreshDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/brcm,brcm/)
362 $(call Quilt/RefreshDir,$(PKG_BUILD_DIR),$(PATCH_DIR)/rtl,rtl/)
363 endef
364
365 define Build/Compile
366 $(SH_FUNC) var2file "$(call shvar,mac80211_config)" $(PKG_BUILD_DIR)/.config
367 $(MAKE) $(MAKE_OPTS) allnoconfig
368 $(call Build/Compile/kmod)
369 endef
370
371 define Build/InstallDev
372 mkdir -p \
373 $(1)/usr/include/mac80211 \
374 $(1)/usr/include/mac80211-backport \
375 $(1)/usr/include/mac80211/ath \
376 $(1)/usr/include/net/mac80211
377 $(CP) $(PKG_BUILD_DIR)/net/mac80211/*.h $(PKG_BUILD_DIR)/include/* $(1)/usr/include/mac80211/
378 $(CP) $(PKG_BUILD_DIR)/backport-include/* $(1)/usr/include/mac80211-backport/
379 $(CP) $(PKG_BUILD_DIR)/net/mac80211/rate.h $(1)/usr/include/net/mac80211/
380 $(CP) $(PKG_BUILD_DIR)/drivers/net/wireless/ath/*.h $(1)/usr/include/mac80211/ath/
381 rm -f $(1)/usr/include/mac80211-backport/linux/module.h
382 endef
383
384
385 define KernelPackage/cfg80211/install
386 $(INSTALL_DIR) $(1)/lib/wifi $(1)/lib/netifd/wireless
387 $(INSTALL_DATA) ./files/lib/wifi/mac80211.sh $(1)/lib/wifi
388 $(INSTALL_BIN) ./files/lib/netifd/wireless/mac80211.sh $(1)/lib/netifd/wireless
389 $(INSTALL_DIR) $(1)/etc/hotplug.d/ieee80211
390 $(INSTALL_DATA) ./files/mac80211.hotplug $(1)/etc/hotplug.d/ieee80211/10-wifi-detect
391 endef
392
393 $(eval $(foreach drv,$(PKG_DRIVERS),$(call KernelPackage,$(drv))))
394 $(eval $(call KernelPackage,cfg80211))
395 $(eval $(call KernelPackage,mac80211))