Compare commits

..

69 Commits

Author SHA1 Message Date
John Crispin
769e8c5c0b ath11k: enforce 512mb profile
This almost doubles the number of possible assocs.

Fixes: WIFI-6013
Signed-off-by: John Crispin <john@phrozen.org>
2021-12-03 07:47:53 +01:00
John Crispin
04c3325710 ipq807x: bssid was not stable on wf-194c4/8
The ART does not have valid macs in it, use the
ath11k-macs fixup to work around this.

Fixes: WIFI-6012
Signed-off-by: John Crispin <john@phrozen.org>
2021-12-02 15:05:41 +01:00
John Crispin
7c1fd79ceb ucentral-schema: update to latest HEAD
6d321d6 make sure, that on 40/80 mhz only available channel may be selected

Fixes: WIFI-5998
Signed-off-by: John Crispin <john@phrozen.org>
2021-12-01 09:28:59 +01:00
John Crispin
1e950be127 ipq807x: Make it possible to flash r2.4 on eap102 with older bootloaders
Fixes: WIFI-5997
Signed-off-by: John Crispin <john@phrozen.org>
2021-12-01 07:32:05 +01:00
John Crispin
5fc7ac166a ipq807x: explicitly set the lable_mac_addr on WF194c
Some older units did not have a stable serial number when connecting
to the GW. Fix this by explicitly setting the label_mac, this allows
the uci-defaults script to correctly pick up the right MAC.

Fixes: WIFI-5834
Signed-off-by: John Crispin <john@phrozen.org>
2021-11-30 07:57:19 +01:00
John Crispin
87be030169 ipq807x: add support for wallytech DR6018-v4
Fixes: WIFI-5846
Signed-off-by: John Crispin <john@phrozen.org>
2021-11-29 15:32:30 +01:00
John Crispin
b0688f097b ucentral-schema: remove bogus roaming settings inside the captive portal example
Fixes: WIFI-5835
Signed-off-by: John Crispin <john@phrozen.org>
2021-11-29 08:04:07 +01:00
John Crispin
ae77be4e5c profiles: add x86_64 profile
Fixes: WIFI-5841
Signed-off-by: John Crispin <john@phrozen.org>
2021-11-25 17:47:24 +01:00
John Crispin
efac512c90 ucentral-wifi: update to latest HEAD
f8e62bd fix 40/80mhz scan support on 5G

Fixes: WIFI-5625
Signed-off-by: John Crispin <john@phrozen.org>
2021-11-25 17:47:24 +01:00
John Crispin
bcde3ee6d7 ucentral-schema: update to latest HEAD
73889be open-flow: fix controller property description
72ba0b4 renderer: enable drop_unknown_ports in Open vSwitch
252b628 renderer: fix OpenFlow bridge mode

Fixes: WIFI-5766
Signed-off-by: John Crispin <john@phrozen.org>
2021-11-25 17:47:24 +01:00
John Crispin
7b0ef7f265 hostapd: backport ujail/hostapd fix
This is currently breaking interactive cli support.

Fixes: WIFI-5814
Signed-off-by: John Crispin <john@phrozen.org>
2021-11-24 11:49:39 +01:00
John Crispin
670f9fee14 mac80211: fix mu-mimo vht capabilities
Fixes: WIFI-5823
Signed-off-by: John Crispin <john@phrozen.org>
2021-11-22 14:54:20 +01:00
John Crispin
4c7ee4bf6d ipq807x: fix compile error due to badly rebased patch
Signed-off-by: John Crispin <john@phrozen.org>
2021-11-18 18:50:54 +01:00
John Crispin
90868338c7 ipq807x: add hfcl ion4x support
Fixes: WIFI-5797
Signed-off-by: John Crispin <john@phrozen.org>
2021-11-18 18:15:12 +01:00
John Crispin
7a20f558e1 .github/workflows: fix hfcl_ion4 file name
Fixes: WIFI-5794
Signed-off-by: John Crispin <john@phrozen.org>
2021-11-18 14:52:50 +01:00
John Crispin
9b8c1f8449 ucentral-schema: update to latest HEAD
c3efa25 set a default channel_list for 5G radios

Fixes: WIFI-5782
Signed-off-by: John Crispin <john@phrozen.org>
2021-11-18 14:52:50 +01:00
John Crispin
002880c3fa ratelimit: increase the wait timeout
The timeout of 75s was a little to shart and would sometimes cause
5G interfaces to not enable ratelimit correctly. Increasing the
timeout to 120s makes the flow more reliable.

Fixes: WIFI-5701
Signed-off-by: John Crispin <john@phrozen.org>
2021-11-18 14:52:50 +01:00
John Crispin
3de5c91e6c maverick/ucentral-schema: add WDS broadband profile
Fixes: WIFI-5778
Signed-off-by: John Crispin <john@phrozen.org>
2021-11-18 14:52:50 +01:00
John Crispin
679e20af39 profiles: fix memory profile on ex227/447
Fixes: WIFI-5785
Signed-off-by: John Crispin <john@phrozen.org>
2021-11-18 14:52:50 +01:00
John Crispin
191081e46f mac80211-ax: update regdb patches
Fixes: WIFI-5795
Signed-off-by: John Crispin <john@phrozen.org>
2021-11-18 14:52:45 +01:00
John Crispin
8f7a66f1ac ath11k-wifi: update BDF files
Use latest regdb from upstream.

Fixes: WIFI-5795
Signed-off-by: John Crispin <john@phrozen.org>
2021-11-18 14:52:39 +01:00
Sharadanand Karanjkar
c93b14ca7a hostapd: Added control for multiple_bssid and ema
Re-enabling "multiple_bssid" and "ema".

Fixes: WIFI-5732
Signed-off-by: Sharadanand Karanjkar <sk@simonwunderlich.de>
2021-11-18 14:28:24 +01:00
John Crispin
16176a1cc3 ucentral-wifi: update to latest HEAD
3d9216a Add dfs channel list to capabilities

Fixes: WIFI-5723
Signed-off-by: John Crispin <john@phrozen.org>
2021-11-18 14:28:22 +01:00
John Crispin
a4806f740d hostapd: track ratelimit config and reload wifi when state changes
Fixes: WIFI-5701
Signed-off-by: John Crispin <john@phrozen.org>
2021-11-11 13:41:11 +01:00
John Crispin
35740f321d ucentral-schema: fix wifi reload when using rate-limit
a78cad2 track if a ssid has rate-limiting enabled

Fixes: WIFI-5701
Signed-off-by: John Crispin <john@phrozen.org>
2021-11-11 13:40:43 +01:00
John Crispin
74c148e905 ucentral-schema: update to latest HEAD
5c3c572 airtime-fairness: add ATF to the data model

Fixes: WIFI-5703
Signed-off-by: John Crispin <john@phrozen.org>
2021-11-11 13:37:29 +01:00
John Crispin
a77d881147 atfpolicy: add package
Add a Airtime Scheduler that adjusts an UEs ATF weight based on its
WMM/TID usage.

Fixes: WIFI-5703
Signed-off-by: John Crispin <john@phrozen.org>
2021-11-11 02:22:02 +01:00
John Crispin
065539bbb3 ucentral-schema: update to latest HEAD
dd9708d openflow: add port property

Fixes: WIFI-5700
Signed-off-by: John Crispin <john@phrozen.org>
2021-11-10 17:06:35 +01:00
John Crispin
e2d90a7b06 procd: update to latest HEAD
fixes build on wifi-5 due to missing dependencies in last update

Signed-off-by: John Crispin <john@phrozen.org>
2021-11-10 10:42:17 +01:00
John Crispin
8bb9816e2b ipq807x: fix setting mac on cig wf-194c/4
Fixes: WIFI-3967
Signed-off-by: John Crispin <john@phrozen.org>
2021-11-09 17:34:16 +01:00
John Crispin
9673329c07 ucentral-schema: update to latest HEAD
c4e889c filter out _none, _4, _6 interfaces from state

Signed-off-by: John Crispin <john@phrozen.org>
2021-11-09 17:24:21 +01:00
John Crispin
2571ae5210 rpcd: add backport
Signed-off-by: John Crispin <john@phrozen.org>
2021-11-09 17:24:21 +01:00
John Crispin
8caffe46b4 procd: update to latest HEAD
Fixes: WIFI-5443
Signed-off-by: John Crispin <john@phrozen.org>
2021-11-09 15:39:10 +01:00
John Crispin
25641d5199 libubox: update to latest HEAD
Fixes: WIFI-5443
Signed-off-by: John Crispin <john@phrozen.org>
2021-11-09 15:39:10 +01:00
John Crispin
2b3cc2a5cf ucentral: add a dual-stack example config
Signed-off-by: John Crispin <john@phrozen.org>
2021-11-09 15:36:11 +01:00
John Crispin
12cc29265c ucentral-schema: update to latest HEAD
5a4cacb ipv6: default ipv6_prefix to 64 on downstream interfaces

Signed-off-by: John Crispin <john@phrozen.org>
2021-11-09 15:35:51 +01:00
Sharadanand Karanjkar
34a6f06bd9 hostapd: Added control for co-location enable and disable in config.
Re-enabling support for enabling configuring rnr_beacon and he_co_locate flag in hostapd config files.

Signed-off-by: Sharadanand Karanjkar <sk@simonwunderlich.de>
2021-11-09 15:35:51 +01:00
John Crispin
c343d5e629 docker: install clang-12 to speedup the build jobs
Signed-off-by: John Crispin <john@phrozen.org>
2021-11-09 13:10:09 +01:00
John Crispin
501907eeda ucentral-schema: update to latest HEAD
4caf81b renderer: setting the dns server was broken on static upstream interfaces

Signed-off-by: John Crispin <john@phrozen.org>
2021-11-09 12:54:39 +01:00
John Crispin
ba406fe01b hostapd: add radius based wispr/bandwidth control
Fixes: WIFI-4888
Signed-off-by: John Crispin <john@phrozen.org>
2021-11-09 12:50:31 +01:00
John Crispin
d61d5cd35e ucentral-client: update to latest HEAD
This adds a connection watchdog.

Signed-off-by: John Crispin <john@phrozen.org>
2021-11-08 09:15:42 +01:00
Paul Spooren
68d544c9af scripts: gen_config allow explicit warning message
Instead of generically mentioning a missing dependency the host
dependency can also be explained by defining a `warning`.

Warning messages are collected and printed at the end.

Signed-off-by: Paul Spooren <mail@aparcar.org>
2021-11-08 09:15:42 +01:00
Paul Spooren
5d86871253 profiles: qosify add explicit host dependency warning
If the host dependency is missing be explicit about the increasd build
time of more than an hour.

Signed-off-by: Paul Spooren <mail@aparcar.org>
2021-11-08 09:15:42 +01:00
John Crispin
460785cbe3 maverick: keep firstcontact and ucentral-client running while in maverick
Fixes: WIFI-5439
Signed-off-by: John Crispin <john@phrozen.org>
2021-11-05 14:46:32 +01:00
Paul Spooren
1cace058c5 profiles: swich ucentral ap's to qosify profile
Instead of installing the package directly use the qosify profile which
automatically handles the host dependency clang/llvm.

Signed-off-by: Paul Spooren <mail@aparcar.org>
2021-11-05 14:46:32 +01:00
Paul Spooren
5aaf734732 profiles: add qosify profile to use host toolchain
In case clang/llvm is available as a host dependency, modify the
configuration to use it. In case it is not available build clang/llvm
(takes ~30min).

Signed-off-by: Paul Spooren <mail@aparcar.org>
2021-11-05 14:46:32 +01:00
Paul Spooren
9d3768a68d scripts: gen_config add host_dependencies option
In case a package/image requres specific host dependencies it is
possible to define entries in the `host_dependencies` array. Each entry
is an object containing at least `name` and `which`. The `which` array
contains tools to be checked in the current `PATH`.

Optionally the two options `success_diffconfig` and
`fallback_diffconfig` can be set. The former is optionally added in case
the tool is found. The latter is added if the dependency is not
available.

If the dependecy is not available and no `fallback_diffconfig` is set,
the config generation is considered impossible and stopped.

Signed-off-by: Paul Spooren <mail@aparcar.org>
2021-11-05 10:47:41 +01:00
John Crispin
975aae507b llvm/clang: add support to build llvm/clang
Signed-off-by: John Crispin <john@phrozen.org>
2021-11-05 10:47:41 +01:00
John Crispin
cc0576886a ucentral-schema: update to latest HEAD
Signed-off-by: John Crispin <john@phrozen.org>
2021-11-04 16:33:04 +01:00
John Crispin
9c36b155f6 ucentral-schema: update to latest HEAD
dbb2aaf fix dns only classifiers and add missing class-selectors
4d2c297 qos: split class selector into its own yml
728c6f4 qos: add bulk detection support to data-model/renderer
f5a4651 wmm: fix qos_map_set generation
b958719 update qos/fqdn matching

Signed-off-by: John Crispin <john@phrozen.org>
2021-11-04 15:19:56 +01:00
John Crispin
28ac14ccc4 udnssnoop: add dns reply snooping package
Signed-off-by: John Crispin <john@phrozen.org>
2021-11-04 15:18:59 +01:00
John Crispin
e18e7fc8f6 hostapd: update qos_map_set code inside the script-foo
Signed-off-by: John Crispin <john@phrozen.org>
2021-11-04 15:18:59 +01:00
John Crispin
04d78d3334 qosify: update to latest HEAD
Signed-off-by: John Crispin <john@phrozen.org>
2021-11-04 15:18:59 +01:00
John Crispin
a9fd11ed8a ucentral-schema: update to latest HEAD
75c0a39 renderer: add wired interfaces to OVS bridge
5e42737 generate-reader.uc: rename ip to uc-ip

Signed-off-by: John Crispin <john@phrozen.org>
2021-11-02 17:39:49 +01:00
Stijn Tintel
839f43c010 openflow: sync pending change from openwrt-packages
c0daf3aaf openvswitch: bring up member ports

Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
2021-11-02 17:35:28 +01:00
John Crispin
f599a42618 ucentral-client: update to latest HEAD
eabfeaa dynamically start event daemon when we need it

Signed-off-by: John Crispin <john@phrozen.org>
2021-11-02 17:30:46 +01:00
John Crispin
8bc7bee3bc ucentral-schema: update to latest HEAD
434f749 renderer: filter out HE160 and HE80+80

Signed-off-by: John Crispin <john@phrozen.org>
2021-11-01 16:04:35 +01:00
John Crispin
53004cc39c ubus: update to latest HEAD
Signed-off-by: John Crispin <john@phrozen.org>
2021-11-01 12:07:27 +01:00
John Crispin
9a1c8cff9f ucentral-schema: update to latest HEAD
9f8f80e renderer: fix wifi uci config in dual stack mode

Fixes: WIFI-5400
Signed-off-by: John Crispin <john@phrozen.org>
2021-11-01 11:49:50 +01:00
John Crispin
2d0e2bccbf netifd: remove NE dhcp hack
Fixes: WIFI-4949
Signed-off-by: John Crispin <john@phrozen.org>
2021-11-01 11:33:09 +01:00
John Crispin
70c2c36e0f qosify: update to latest version
This improves bulk traffic detection.

Signed-off-by: John Crispin <john@phrozen.org>
2021-11-01 11:32:13 +01:00
John Crispin
11ed0b089c ipq807x: update BPF backport
The patch broke kernel build with lockdep enabled

Signed-off-by: John Crispin <john@phrozen.org>
2021-11-01 11:30:55 +01:00
John Crispin
29058df59b luci-mod-ucentral: the continue button was grey when trying to flash an image
Fixes: WIFI-5072
Signed-off-by: John Crispin <john@phrozen.org>
2021-11-01 07:58:30 +01:00
John Crispin
e840bab8cc ucentral-schema: update to latest HEAD
17fefd3 pass-point: domain_name should be a ',' and not ':' seperated list

Fixes: WIFI-4869
Signed-off-by: John Crispin <john@phrozen.org>
2021-11-01 07:11:26 +01:00
John Crispin
e3e3c9ea72 qosify: disable automatic bulk detection until it is in the data-model
Signed-off-by: John Crispin <john@phrozen.org>
2021-10-30 08:39:47 +02:00
John Crispin
a3125e6ab2 ipq807x: fix vlan offload support in v5.10 eBPF backport
Signed-off-by: John Crispin <john@phrozen.org>
2021-10-30 08:39:39 +02:00
John Crispin
63e8b90656 qosify: update to latest bpf-headers ABI
Signed-off-by: John Crispin <john@phrozen.org>
2021-10-29 19:49:34 +02:00
John Crispin
70f231d948 bpf-headers: more ABI fixes
Signed-off-by: John Crispin <john@phrozen.org>
2021-10-29 19:48:56 +02:00
John Crispin
2983d9ca2b ath11k-wifi: add trailing '\' in Makefile
This caused image to pop up builds with no BDF in the image.

Fixes: 1a305421 (ipq807x: add support for wallystech dr6018)
Signed-off-by: John Crispin <john@phrozen.org>
2021-10-29 08:36:21 +02:00
96 changed files with 4992 additions and 338 deletions

View File

@@ -11,7 +11,7 @@ jobs:
strategy:
fail-fast: false
matrix:
target: ['cig_wf188n', 'cig_wf194c', 'cig_wf194c4', 'cig_wf160d', 'edgecore_eap101', 'edgecore_eap102', 'edgecore_ecs4100-12ph', 'edgecore_ecw5211', 'edgecore_ecw5410', 'edgecore_oap100', 'edgecore_ssw2ac2600', 'edgecore_spw2ac1200', 'edgecore_spw2ac1200-lan-poe', 'hfcl_ion4.yml', 'indio_um-305ac', 'linksys_ea6350-v4', 'linksys_e8450-ubi', 'linksys_ea8300', 'tp-link_ec420-g1', 'tplink_ex227', 'tplink_ex228', 'tplink_ex447', 'wallys_dr40x9' ]
target: ['cig_wf188n', 'cig_wf194c', 'cig_wf194c4', 'cig_wf160d', 'edgecore_eap101', 'edgecore_eap102', 'edgecore_ecs4100-12ph', 'edgecore_ecw5211', 'edgecore_ecw5410', 'edgecore_oap100', 'edgecore_ssw2ac2600', 'edgecore_spw2ac1200', 'edgecore_spw2ac1200-lan-poe', 'hfcl_ion4', 'indio_um-305ac', 'linksys_ea6350-v4', 'linksys_e8450-ubi', 'linksys_ea8300', 'tp-link_ec420-g1', 'tplink_ex227', 'tplink_ex228', 'tplink_ex447', 'wallys_dr40x9', 'wallys_dr6018', 'wallys_dr6018_v4' ]
steps:
- uses: actions/checkout@v2

View File

@@ -1,7 +1,7 @@
From 2af08d2e85ee946de5f53bbd0ddf239de9b78f6d Mon Sep 17 00:00:00 2001
From bb797fc82f8ade2a1c0b7a68dd7c920eae2f531f Mon Sep 17 00:00:00 2001
From: John Crispin <john@phrozen.org>
Date: Tue, 18 May 2021 10:46:43 +0200
Subject: [PATCH 12/27] libubox: update to latest HEAD
Subject: [PATCH 01/74] libubox: update to latest HEAD
Signed-off-by: John Crispin <john@phrozen.org>
---
@@ -9,7 +9,7 @@ Signed-off-by: John Crispin <john@phrozen.org>
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/package/libs/libubox/Makefile b/package/libs/libubox/Makefile
index d2c07783e1..33aa73eef7 100644
index d2c07783e1..3b01930d6c 100644
--- a/package/libs/libubox/Makefile
+++ b/package/libs/libubox/Makefile
@@ -5,9 +5,9 @@ PKG_RELEASE=2
@@ -19,9 +19,9 @@ index d2c07783e1..33aa73eef7 100644
-PKG_MIRROR_HASH:=7dd1db1e0074a9c7c722db654cce3111b3bd3cff0bfd791c4497cb0f6c22d3ca
-PKG_SOURCE_DATE:=2021-05-16
-PKG_SOURCE_VERSION:=b14c4688612c05c78ce984d7bde633bce8703b1e
+PKG_MIRROR_HASH:=1cdb91ac0ee925f133ee9f70eac131a99def312fe7cf0aed44df84eb1762e30b
+PKG_MIRROR_HASH:=82d84fb97e725b0a18ceac639cae0c17d922754bb648ff58c62069d92798a6cd
+PKG_SOURCE_DATE:=2021-08-19
+PKG_SOURCE_VERSION:=d716ac4bc4236031d4c3cc1ed362b502e20e3787
+PKG_SOURCE_VERSION:=c86a894ec63d83ecf2c373bbf9dc8fba9713d942
PKG_ABI_VERSION:=$(call abi_version_str,$(PKG_SOURCE_DATE))
CMAKE_INSTALL:=1

View File

@@ -1,16 +1,14 @@
From c9e9ca475bc2eb90beb23a2c67c39389f8cb2527 Mon Sep 17 00:00:00 2001
From 1496ca5ceb941ba725311c6c0366193092035f32 Mon Sep 17 00:00:00 2001
From: John Crispin <john@phrozen.org>
Date: Thu, 27 May 2021 13:24:47 +0200
Subject: [PATCH 01/58] netifd: update to latest HEAD
Subject: [PATCH 01/60] netifd: update to latest HEAD
Signed-off-by: John Crispin <john@phrozen.org>
---
package/network/config/netifd/Makefile | 8 ++--
.../netifd/patches/002-fix-dhcp-issue.patch | 17 +++++++++
.../config/netifd/patches/100-script.patch | 21 +++++++++++
.../config/netifd/patches/hairpin.patch | 37 +++++++++++++++++++
4 files changed, 78 insertions(+), 5 deletions(-)
create mode 100644 package/network/config/netifd/patches/002-fix-dhcp-issue.patch
3 files changed, 61 insertions(+), 5 deletions(-)
create mode 100644 package/network/config/netifd/patches/100-script.patch
create mode 100644 package/network/config/netifd/patches/hairpin.patch
@@ -38,29 +36,6 @@ index 4b5f110da2..d41bddfd56 100644
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/cmake.mk
diff --git a/package/network/config/netifd/patches/002-fix-dhcp-issue.patch b/package/network/config/netifd/patches/002-fix-dhcp-issue.patch
new file mode 100644
index 0000000000..6f1d2e708e
--- /dev/null
+++ b/package/network/config/netifd/patches/002-fix-dhcp-issue.patch
@@ -0,0 +1,17 @@
+Index: netifd-2019-08-05-5e02f944/interface.c
+===================================================================
+--- netifd-2019-08-05-5e02f944.orig/interface.c
++++ netifd-2019-08-05-5e02f944/interface.c
+@@ -424,7 +424,11 @@ interface_main_dev_cb(struct device_user
+ interface_set_link_state(iface, false);
+ break;
+ case DEV_EVENT_TOPO_CHANGE:
+- interface_proto_event(iface->proto, PROTO_CMD_RENEW, false);
++ /* This renews the dhcp lease when the bridge adds/deletes a
++ * new interface. It causes some dhcp servers to fail in
++ * case where there are many interfaces being added to the
++ * bridge frequently. Disabling this for now. */
++ /* interface_proto_event(iface->proto, PROTO_CMD_RENEW, false); */
+ return;
+ default:
+ break;
diff --git a/package/network/config/netifd/patches/100-script.patch b/package/network/config/netifd/patches/100-script.patch
new file mode 100644
index 0000000000..e7ba83f4bb

View File

@@ -1,7 +1,7 @@
From 6718e9786f18dd1380e5977d224d13a5ff3df619 Mon Sep 17 00:00:00 2001
From 3feca6da7b0571cf17afc9f0e40d0ede9059c271 Mon Sep 17 00:00:00 2001
From: John Crispin <john@phrozen.org>
Date: Sat, 4 Sep 2021 05:47:27 +0200
Subject: [PATCH 02/58] mac80211: update to latest HEAD
Subject: [PATCH 01/72] mac80211: update to latest HEAD
Signed-off-by: John Crispin <john@phrozen.org>
---
@@ -9,7 +9,7 @@ Signed-off-by: John Crispin <john@phrozen.org>
package/kernel/mac80211/ath.mk | 5 +-
package/kernel/mac80211/broadcom.mk | 4 +-
.../mac80211/files/lib/netifd/mac80211.sh | 36 -
.../files/lib/netifd/wireless/mac80211.sh | 186 ++-
.../files/lib/netifd/wireless/mac80211.sh | 214 ++-
.../mac80211/files/lib/wifi/mac80211.sh | 110 +-
.../patches/ath/120-owl-loader-compat.patch | 53 -
.../patches/ath/402-ath_regd_optional.patch | 2 +-
@@ -75,7 +75,7 @@ Signed-off-by: John Crispin <john@phrozen.org>
...eck-per-vif-offload_flags-in-Tx-path.patch | 26 +
.../500-mac80211_configure_antenna_gain.patch | 16 +-
...the-dst-buffer-to-of_get_mac_address.patch | 237 +++
70 files changed, 2752 insertions(+), 1160 deletions(-)
70 files changed, 2777 insertions(+), 1163 deletions(-)
delete mode 100644 package/kernel/mac80211/files/lib/netifd/mac80211.sh
delete mode 100644 package/kernel/mac80211/patches/ath/120-owl-loader-compat.patch
rename package/kernel/mac80211/patches/{ath => ath10k}/080-ath10k_thermal_config.patch (97%)
@@ -286,7 +286,7 @@ index 92e5c0e395..0000000000
- done
-}
diff --git a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
index 9a9c35fb5f..a25e4ff9b2 100644
index 9a9c35fb5f..97c567031e 100644
--- a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
+++ b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh
@@ -1,7 +1,6 @@
@@ -310,7 +310,7 @@ index 9a9c35fb5f..a25e4ff9b2 100644
config_add_boolean noscan ht_coex acs_exclude_dfs
config_add_array ht_capab
config_add_array channels
@@ -44,11 +43,24 @@ drv_mac80211_init_device_config() {
@@ -44,11 +43,26 @@ drv_mac80211_init_device_config() {
su_beamformee \
mu_beamformer \
mu_beamformee \
@@ -326,6 +326,8 @@ index 9a9c35fb5f..a25e4ff9b2 100644
+ 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 \
@@ -337,7 +339,7 @@ index 9a9c35fb5f..a25e4ff9b2 100644
config_add_boolean \
ldpc \
greenfield \
@@ -96,6 +108,23 @@ mac80211_add_capabilities() {
@@ -96,6 +110,23 @@ mac80211_add_capabilities() {
export -n -- "$__var=$__out"
}
@@ -361,7 +363,7 @@ index 9a9c35fb5f..a25e4ff9b2 100644
mac80211_hostapd_setup_base() {
local phy="$1"
@@ -119,6 +148,9 @@ mac80211_hostapd_setup_base() {
@@ -119,6 +150,9 @@ mac80211_hostapd_setup_base() {
[ "$noscan" -gt 0 ] && hostapd_noscan=1
[ "$tx_burst" = 0 ] && tx_burst=
@@ -371,7 +373,7 @@ index 9a9c35fb5f..a25e4ff9b2 100644
ieee80211n=1
ht_capab=
case "$htmode" in
@@ -126,7 +158,7 @@ mac80211_hostapd_setup_base() {
@@ -126,7 +160,7 @@ mac80211_hostapd_setup_base() {
HT40*|VHT40|VHT80|VHT160|HE40|HE80|HE160)
case "$hwmode" in
a)
@@ -380,7 +382,7 @@ index 9a9c35fb5f..a25e4ff9b2 100644
1) ht_capab="[HT40+]";;
0) ht_capab="[HT40-]";;
esac
@@ -200,7 +232,7 @@ mac80211_hostapd_setup_base() {
@@ -200,7 +234,7 @@ mac80211_hostapd_setup_base() {
case "$htmode" in
VHT20|HE20) enable_ac=1;;
VHT40|HE40)
@@ -389,7 +391,7 @@ index 9a9c35fb5f..a25e4ff9b2 100644
1) idx=$(($channel + 2));;
0) idx=$(($channel - 2));;
esac
@@ -208,7 +240,7 @@ mac80211_hostapd_setup_base() {
@@ -208,7 +242,7 @@ mac80211_hostapd_setup_base() {
vht_center_seg0=$idx
;;
VHT80|HE80)
@@ -398,7 +400,7 @@ index 9a9c35fb5f..a25e4ff9b2 100644
1) idx=$(($channel + 6));;
2) idx=$(($channel + 2));;
3) idx=$(($channel - 2));;
@@ -219,15 +251,35 @@ mac80211_hostapd_setup_base() {
@@ -219,15 +253,35 @@ mac80211_hostapd_setup_base() {
vht_center_seg0=$idx
;;
VHT160|HE160)
@@ -438,7 +440,35 @@ index 9a9c35fb5f..a25e4ff9b2 100644
[ "$hwmode" = "a" ] || enable_ac=0
if [ "$enable_ac" != "0" ]; then
@@ -337,16 +389,62 @@ mac80211_hostapd_setup_base() {
@@ -242,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 \
@@ -282,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" ] && \
@@ -337,16 +405,62 @@ mac80211_hostapd_setup_base() {
esac
if [ "$enable_ax" != "0" ]; then
@@ -504,9 +534,23 @@ index 9a9c35fb5f..a25e4ff9b2 100644
fi
hostapd_prepare_device_config "$hostapd_conf_file" nl80211
@@ -426,7 +524,11 @@ mac80211_generate_mac() {
local oIFS="$IFS"; IFS=":"; set -- $ref; IFS="$oIFS"
@@ -401,6 +515,7 @@ mac80211_get_addr() {
mac80211_generate_mac() {
local phy="$1"
+ local multiple_bssid="$2"
local id="${macidx:-0}"
local ref="$(cat /sys/class/ieee80211/${phy}/macaddress)"
@@ -424,9 +539,16 @@ mac80211_generate_mac() {
local mask6=$6
local oIFS="$IFS"; IFS=":"; set -- $ref; IFS="$oIFS"
-
+ [ "$multiple_bssid" -eq 1 ] && {
+ printf "02:%s:%s:%s:%s:%02x" $b1 $2 $3 $4 $5 $macidx
+ return
+ }
macidx=$(($id + 1))
- [ "$((0x$mask1))" -gt 0 ] && {
+
@@ -517,7 +561,7 @@ index 9a9c35fb5f..a25e4ff9b2 100644
b1="0x$1"
[ "$id" -gt 0 ] && \
b1=$(($b1 ^ ((($id - !($b1 & 2)) << 2)) | 0x2))
@@ -434,7 +536,7 @@ mac80211_generate_mac() {
@@ -434,7 +556,7 @@ mac80211_generate_mac() {
return
}
@@ -526,7 +570,7 @@ index 9a9c35fb5f..a25e4ff9b2 100644
printf "%s:%s:%s:%s:%s:%02x" $1 $2 $3 $4 $5 $(( 0x$6 ^ $id ))
return
}
@@ -449,7 +551,7 @@ mac80211_generate_mac() {
@@ -449,7 +571,7 @@ mac80211_generate_mac() {
find_phy() {
[ -n "$phy" -a -d /sys/class/ieee80211/$phy ] && return 0
[ -n "$path" ] && {
@@ -535,7 +579,7 @@ index 9a9c35fb5f..a25e4ff9b2 100644
[ -n "$phy" ] && return 0
}
[ -n "$macaddr" ] && {
@@ -528,7 +630,7 @@ mac80211_iw_interface_add() {
@@ -528,11 +650,12 @@ mac80211_iw_interface_add() {
rc="$?"
}
@@ -544,7 +588,21 @@ index 9a9c35fb5f..a25e4ff9b2 100644
return $rc
}
@@ -689,14 +791,8 @@ mac80211_prepare_iw_htmode() {
mac80211_prepare_vif() {
+ local multiple_bssid=$1
json_select config
json_get_vars ifname mode ssid wds powersave macaddr enable wpa_psk_file vlan_file
@@ -546,7 +669,7 @@ mac80211_prepare_vif() {
json_select ..
[ -n "$macaddr" ] || {
- macaddr="$(mac80211_generate_mac $phy)"
+ macaddr="$(mac80211_generate_mac $phy $multiple_bssid)"
macidx="$(($macidx + 1))"
}
@@ -689,14 +812,8 @@ mac80211_prepare_iw_htmode() {
case "$htmode" in
VHT20|HT20) iw_htmode=HT20;;
HT40*|VHT40|VHT160)
@@ -561,7 +619,7 @@ index 9a9c35fb5f..a25e4ff9b2 100644
case "$htmode" in
HT40+) iw_htmode="HT40+";;
HT40-) iw_htmode="HT40-";;
@@ -709,6 +805,12 @@ mac80211_prepare_iw_htmode() {
@@ -709,6 +826,12 @@ mac80211_prepare_iw_htmode() {
;;
esac
;;
@@ -574,7 +632,7 @@ index 9a9c35fb5f..a25e4ff9b2 100644
esac
[ "$auto_channel" -gt 0 ] && iw_htmode="HT40+"
;;
@@ -818,7 +920,6 @@ mac80211_setup_vif() {
@@ -818,7 +941,6 @@ mac80211_setup_vif() {
mesh)
wireless_vif_parse_encryption
[ -z "$htmode" ] && htmode="NOHT";
@@ -582,7 +640,7 @@ index 9a9c35fb5f..a25e4ff9b2 100644
if [ "$wpa" -gt 0 -o "$auto_channel" -gt 0 ] || chan_is_dfs "$phy" "$channel"; then
mac80211_setup_supplicant $vif_enable || failed=1
else
@@ -832,7 +933,6 @@ mac80211_setup_vif() {
@@ -832,7 +954,6 @@ mac80211_setup_vif() {
adhoc)
wireless_vif_parse_encryption
if [ "$wpa" -gt 0 -o "$auto_channel" -gt 0 ]; then
@@ -590,7 +648,7 @@ index 9a9c35fb5f..a25e4ff9b2 100644
mac80211_setup_supplicant_noctl $vif_enable || failed=1
else
mac80211_setup_adhoc $vif_enable
@@ -849,10 +949,30 @@ mac80211_setup_vif() {
@@ -849,10 +970,30 @@ mac80211_setup_vif() {
get_freq() {
local phy="$1"
@@ -623,17 +681,18 @@ index 9a9c35fb5f..a25e4ff9b2 100644
chan_is_dfs() {
local phy="$1"
local chan="$2"
@@ -896,7 +1016,8 @@ drv_mac80211_setup() {
@@ -896,7 +1037,9 @@ drv_mac80211_setup() {
country chanbw distance \
txpower antenna_gain \
rxantenna txantenna \
- frag rts beacon_int:100 htmode
+ frag rts beacon_int:100 htmode \
+ multiple_bssid:0 \
+ num_global_macaddr
json_get_values basic_rate_list basic_rate
json_get_values scan_list scan_list
json_select ..
@@ -933,7 +1054,7 @@ drv_mac80211_setup() {
@@ -933,7 +1076,7 @@ drv_mac80211_setup() {
done
# convert channel to frequency
@@ -642,7 +701,7 @@ index 9a9c35fb5f..a25e4ff9b2 100644
[ -n "$country" ] && {
iw reg get | grep -q "^country $country:" || {
@@ -958,6 +1079,7 @@ drv_mac80211_setup() {
@@ -958,6 +1101,7 @@ drv_mac80211_setup() {
set_default txantenna 0xffffffff
set_default distance 0
set_default antenna_gain 0
@@ -650,6 +709,15 @@ index 9a9c35fb5f..a25e4ff9b2 100644
[ "$txantenna" = "all" ] && txantenna=0xffffffff
[ "$rxantenna" = "all" ] && rxantenna=0xffffffff
@@ -989,7 +1133,7 @@ drv_mac80211_setup() {
mac80211_prepare_iw_htmode
for_each_interface "sta adhoc mesh monitor" mac80211_prepare_vif
NEWAPLIST=
- for_each_interface "ap" mac80211_prepare_vif
+ for_each_interface "ap" mac80211_prepare_vif ${multiple_bssid}
NEW_MD5=$(test -e "${hostapd_conf_file}" && md5sum ${hostapd_conf_file})
OLD_MD5=$(uci -q -P /var/state get wireless._${phy}.md5)
if [ "${NEWAPLIST}" != "${OLDAPLIST}" ]; then
diff --git a/package/kernel/mac80211/files/lib/wifi/mac80211.sh b/package/kernel/mac80211/files/lib/wifi/mac80211.sh
index 3e99f06693..6aa46b0c74 100644
--- a/package/kernel/mac80211/files/lib/wifi/mac80211.sh

View File

@@ -1,14 +1,14 @@
From beaf8ac8acf93bc617d3ed141c750fe1d4f2b047 Mon Sep 17 00:00:00 2001
From 6e3370a4c785c2c245b77832960f1dbed2736192 Mon Sep 17 00:00:00 2001
From: John Crispin <john@phrozen.org>
Date: Sat, 4 Sep 2021 05:48:27 +0200
Subject: [PATCH 01/56] hostapd: update to latest HEAD
Subject: [PATCH 01/70] hostapd: update to latest HEAD
Signed-off-by: John Crispin <john@phrozen.org>
---
package/network/services/hostapd/Makefile | 15 +-
.../hostapd/files/hostapd-basic.config | 2 +-
.../hostapd/files/hostapd-full.config | 4 +-
.../network/services/hostapd/files/hostapd.sh | 181 +++++++++---
.../network/services/hostapd/files/hostapd.sh | 188 +++++++++---
...-fix-frequency-setup-with-HE-enabled.patch | 196 -------------
...> 001-wolfssl-init-RNG-with-ECC-key.patch} | 11 +-
...-init-order-disable-pri-sec-channel-.patch | 126 --------
@@ -73,7 +73,7 @@ Signed-off-by: John Crispin <john@phrozen.org>
.../services/hostapd/src/src/ap/ubus.c | 214 +++++++++++++-
.../services/hostapd/src/src/ap/ubus.h | 16 +
.../hostapd/src/src/utils/build_features.h | 2 -
68 files changed, 1336 insertions(+), 2347 deletions(-)
68 files changed, 1343 insertions(+), 2347 deletions(-)
delete mode 100644 package/network/services/hostapd/patches/001-HE-VHT-fix-frequency-setup-with-HE-enabled.patch
rename package/network/services/hostapd/patches/{802-wolfssl-init-RNG-with-ECC-key.patch => 001-wolfssl-init-RNG-with-ECC-key.patch} (76%)
delete mode 100644 package/network/services/hostapd/patches/002-mesh-fix-channel-init-order-disable-pri-sec-channel-.patch
@@ -181,7 +181,7 @@ index df272e443a..61b6daf861 100644
# EAP-SAKE for the integrated EAP server
#CONFIG_EAP_SAKE=y
diff --git a/package/network/services/hostapd/files/hostapd.sh b/package/network/services/hostapd/files/hostapd.sh
index aa72e09eba..0265c0518a 100644
index aa72e09eba..fe6af98f4d 100644
--- a/package/network/services/hostapd/files/hostapd.sh
+++ b/package/network/services/hostapd/files/hostapd.sh
@@ -48,13 +48,17 @@ hostapd_append_wpa_key_mgmt() {
@@ -276,7 +276,7 @@ index aa72e09eba..0265c0518a 100644
config_add_string 'owe_transition_bssid:macaddr' 'owe_transition_ssid:string'
@@ -319,23 +336,33 @@ hostapd_common_add_bss_config() {
@@ -319,23 +336,35 @@ hostapd_common_add_bss_config() {
config_add_int iw_ipaddr_type_availability iw_gas_address3
config_add_string iw_hessid iw_network_auth_type iw_qos_map_set
config_add_array iw_roaming_consortium iw_domain_name iw_anqp_3gpp_cell_net iw_nai_realm
@@ -310,10 +310,12 @@ index aa72e09eba..0265c0518a 100644
+
+ config_add_int eap_server
+ config_add_string eap_user_file ca_cert server_cert private_key private_key_passwd server_id
+
+ config_add_boolean ratelimit
}
hostapd_set_vlan_file() {
@@ -387,7 +414,7 @@ append_iw_anqp_3gpp_cell_net() {
@@ -387,7 +416,7 @@ append_iw_anqp_3gpp_cell_net() {
if [ -z "$iw_anqp_3gpp_cell_net_conf" ]; then
iw_anqp_3gpp_cell_net_conf="$1"
else
@@ -322,7 +324,7 @@ index aa72e09eba..0265c0518a 100644
fi
}
@@ -399,10 +426,22 @@ append_iw_nai_realm() {
@@ -399,10 +428,22 @@ append_iw_nai_realm() {
[ -n "$1" ] && append bss_conf "nai_realm=$1" "$N"
}
@@ -345,7 +347,7 @@ index aa72e09eba..0265c0518a 100644
append_osu_provider_service_desc() {
append bss_conf "osu_service_desc=$1" "$N"
}
@@ -450,6 +489,7 @@ append_osu_provider() {
@@ -450,6 +491,7 @@ append_osu_provider() {
append bss_conf "osu_method_list=$osu_method_list" "$N"
config_list_foreach "$1" osu_service_desc append_osu_provider_service_desc
@@ -353,7 +355,7 @@ index aa72e09eba..0265c0518a 100644
config_list_foreach "$1" osu_icon append_osu_icon
append bss_conf "$N"
@@ -459,6 +499,14 @@ append_hs20_conn_capab() {
@@ -459,6 +501,14 @@ append_hs20_conn_capab() {
[ -n "$1" ] && append bss_conf "hs20_conn_capab=$1" "$N"
}
@@ -368,7 +370,7 @@ index aa72e09eba..0265c0518a 100644
append_airtime_sta_weight() {
[ -n "$1" ] && append bss_conf "airtime_sta_weight=$1" "$N"
}
@@ -482,10 +530,12 @@ hostapd_set_bss_options() {
@@ -482,10 +532,12 @@ hostapd_set_bss_options() {
macfilter ssid utf8_ssid wmm uapsd hidden short_preamble rsn_preauth \
iapp_interface eapol_version dynamic_vlan ieee80211w nasid \
acct_server acct_secret acct_port acct_interval \
@@ -383,7 +385,7 @@ index aa72e09eba..0265c0518a 100644
set_default isolate 0
set_default maxassoc 0
@@ -506,6 +556,7 @@ hostapd_set_bss_options() {
@@ -506,6 +558,7 @@ hostapd_set_bss_options() {
set_default multi_ap 0
set_default airtime_bss_weight 0
set_default airtime_bss_limit 0
@@ -391,7 +393,7 @@ index aa72e09eba..0265c0518a 100644
append bss_conf "ctrl_interface=/var/run/hostapd"
if [ "$isolate" -gt 0 ]; then
@@ -532,6 +583,7 @@ hostapd_set_bss_options() {
@@ -532,6 +585,7 @@ hostapd_set_bss_options() {
append bss_conf "uapsd_advertisement_enabled=$uapsd" "$N"
append bss_conf "utf8_ssid=$utf8_ssid" "$N"
append bss_conf "multi_ap=$multi_ap" "$N"
@@ -399,7 +401,7 @@ index aa72e09eba..0265c0518a 100644
[ "$tdls_prohibit" -gt 0 ] && append bss_conf "tdls_prohibit=$tdls_prohibit" "$N"
@@ -550,19 +602,21 @@ hostapd_set_bss_options() {
@@ -550,19 +604,21 @@ hostapd_set_bss_options() {
append bss_conf "acct_server_shared_secret=$acct_secret" "$N"
[ -n "$acct_interval" ] && \
append bss_conf "radius_acct_interim_interval=$acct_interval" "$N"
@@ -423,7 +425,7 @@ index aa72e09eba..0265c0518a 100644
local vlan_possible=""
@@ -599,12 +653,12 @@ hostapd_set_bss_options() {
@@ -599,12 +655,12 @@ hostapd_set_bss_options() {
vlan_possible=1
wps_possible=1
;;
@@ -438,7 +440,7 @@ index aa72e09eba..0265c0518a 100644
# radius can provide VLAN ID for clients
vlan_possible=1
@@ -616,18 +670,22 @@ hostapd_set_bss_options() {
@@ -616,18 +672,22 @@ hostapd_set_bss_options() {
set_default auth_port 1812
set_default dae_port 3799
@@ -465,7 +467,7 @@ index aa72e09eba..0265c0518a 100644
[ -n "$ownip" ] && append bss_conf "own_ip_addr=$ownip" "$N"
[ -n "$radius_client_addr" ] && append bss_conf "radius_client_addr=$radius_client_addr" "$N"
@@ -699,7 +757,8 @@ hostapd_set_bss_options() {
@@ -699,7 +759,8 @@ hostapd_set_bss_options() {
}
append bss_conf "ssid=$ssid" "$N"
@@ -475,7 +477,7 @@ index aa72e09eba..0265c0518a 100644
[ -n "$iapp_interface" ] && {
local ifname
network_get_device ifname "$iapp_interface" || ifname="$iapp_interface"
@@ -740,7 +799,7 @@ hostapd_set_bss_options() {
@@ -740,7 +801,7 @@ hostapd_set_bss_options() {
append bss_conf "ftm_responder=1" "$N"
[ "$stationary_ap" -eq "1" ] && append bss_conf "stationary_ap=1" "$N"
[ -n "$lci" ] && append bss_conf "lci=$lci" "$N"
@@ -484,7 +486,7 @@ index aa72e09eba..0265c0518a 100644
}
fi
@@ -764,6 +823,7 @@ hostapd_set_bss_options() {
@@ -764,6 +825,7 @@ hostapd_set_bss_options() {
;;
esac
@@ -492,7 +494,7 @@ index aa72e09eba..0265c0518a 100644
append bss_conf "mobility_domain=$mobility_domain" "$N"
append bss_conf "ft_psk_generate_local=$ft_psk_generate_local" "$N"
append bss_conf "ft_over_ds=$ft_over_ds" "$N"
@@ -778,6 +838,13 @@ hostapd_set_bss_options() {
@@ -778,6 +840,13 @@ hostapd_set_bss_options() {
set_default r0_key_lifetime 10000
set_default pmk_r1_push 0
@@ -506,7 +508,7 @@ index aa72e09eba..0265c0518a 100644
[ -n "$r1_key_holder" ] && append bss_conf "r1_key_holder=$r1_key_holder" "$N"
append bss_conf "r0_key_lifetime=$r0_key_lifetime" "$N"
append bss_conf "pmk_r1_push=$pmk_r1_push" "$N"
@@ -822,7 +889,16 @@ hostapd_set_bss_options() {
@@ -822,7 +891,16 @@ hostapd_set_bss_options() {
json_get_vars ieee80211w_mgmt_cipher ieee80211w_max_timeout ieee80211w_retry_timeout
append bss_conf "ieee80211w=$ieee80211w" "$N"
[ "$ieee80211w" -gt "0" ] && {
@@ -524,7 +526,7 @@ index aa72e09eba..0265c0518a 100644
[ -n "$ieee80211w_max_timeout" ] && \
append bss_conf "assoc_sa_query_max_timeout=$ieee80211w_max_timeout" "$N"
[ -n "$ieee80211w_retry_timeout" ] && \
@@ -863,13 +939,17 @@ hostapd_set_bss_options() {
@@ -863,13 +941,17 @@ hostapd_set_bss_options() {
}
[ -n "$vlan_possible" -a -n "$dynamic_vlan" ] && {
@@ -544,7 +546,7 @@ index aa72e09eba..0265c0518a 100644
[ -n "$vlan_tagged_interface" ] && \
append bss_conf "vlan_tagged_interface=$vlan_tagged_interface" "$N"
[ -n "$vlan_file" ] && {
@@ -882,6 +962,7 @@ hostapd_set_bss_options() {
@@ -882,6 +964,7 @@ hostapd_set_bss_options() {
json_get_vars iw_hessid iw_venue_group iw_venue_type iw_network_auth_type
json_get_vars iw_roaming_consortium iw_domain_name iw_anqp_3gpp_cell_net iw_nai_realm
json_get_vars iw_anqp_elem iw_qos_map_set iw_ipaddr_type_availability iw_gas_address3
@@ -552,7 +554,7 @@ index aa72e09eba..0265c0518a 100644
set_default iw_enabled 0
if [ "$iw_enabled" = "1" ]; then
@@ -905,11 +986,12 @@ hostapd_set_bss_options() {
@@ -905,11 +988,12 @@ hostapd_set_bss_options() {
[ -n "$iw_network_auth_type" ] && \
append bss_conf "network_auth_type=$iw_network_auth_type" "$N"
[ -n "$iw_gas_address3" ] && append bss_conf "gas_address3=$iw_gas_address3" "$N"
@@ -566,12 +568,16 @@ index aa72e09eba..0265c0518a 100644
iw_domain_name_conf=
json_for_each_item append_iw_domain_name iw_domain_name
@@ -921,14 +1003,18 @@ hostapd_set_bss_options() {
[ -n "$iw_anqp_3gpp_cell_net_conf" ] && \
@@ -922,13 +1006,22 @@ hostapd_set_bss_options() {
append bss_conf "anqp_3gpp_cell_net=$iw_anqp_3gpp_cell_net_conf" "$N"
fi
+ [ -n "$iw_qos_map_set" ] && append bss_conf "qos_map_set=$iw_qos_map_set" "$N"
+ set_default iw_qos_map_set 0,0,2,16,1,1,255,255,18,22,24,38,40,40,44,46,48,56
+ case "$iw_qos_map_set" in
+ *,*);;
+ *) iw_qos_map_set="";;
+ esac
+ [ -n "$iw_qos_map_set" ] && append bss_conf "qos_map_set=$iw_qos_map_set" "$N"
local hs20 disable_dgaf osen anqp_domain_id hs20_deauth_req_timeout \
- osu_ssid hs20_wan_metrics hs20_operating_class hs20_t_c_filename hs20_t_c_timestamp
@@ -587,7 +593,7 @@ index aa72e09eba..0265c0518a 100644
set_default disable_dgaf $hs20
set_default osen 0
set_default anqp_domain_id 0
@@ -936,6 +1022,7 @@ hostapd_set_bss_options() {
@@ -936,6 +1029,7 @@ hostapd_set_bss_options() {
if [ "$hs20" = "1" ]; then
append bss_conf "hs20=1" "$N"
append_hs20_icons
@@ -595,7 +601,7 @@ index aa72e09eba..0265c0518a 100644
append bss_conf "disable_dgaf=$disable_dgaf" "$N"
append bss_conf "osen=$osen" "$N"
append bss_conf "anqp_domain_id=$anqp_domain_id" "$N"
@@ -945,16 +1032,31 @@ hostapd_set_bss_options() {
@@ -945,16 +1039,31 @@ hostapd_set_bss_options() {
[ -n "$hs20_operating_class" ] && append bss_conf "hs20_operating_class=$hs20_operating_class" "$N"
[ -n "$hs20_t_c_filename" ] && append bss_conf "hs20_t_c_filename=$hs20_t_c_filename" "$N"
[ -n "$hs20_t_c_timestamp" ] && append bss_conf "hs20_t_c_timestamp=$hs20_t_c_timestamp" "$N"
@@ -628,7 +634,7 @@ index aa72e09eba..0265c0518a 100644
set_default per_sta_vif 0
if [ "$per_sta_vif" -gt 0 ]; then
@@ -1079,16 +1181,16 @@ wpa_supplicant_set_fixed_freq() {
@@ -1079,16 +1188,16 @@ wpa_supplicant_set_fixed_freq() {
append network_data "frequency=$freq" "$N$T"
case "$htmode" in
NOHT) append network_data "disable_ht=1" "$N$T";;
@@ -649,7 +655,7 @@ index aa72e09eba..0265c0518a 100644
*) append network_data "disable_vht=1" "$N$T";;
esac
}
@@ -1106,19 +1208,21 @@ wpa_supplicant_add_network() {
@@ -1106,19 +1215,21 @@ wpa_supplicant_add_network() {
ssid bssid key \
basic_rate mcast_rate \
ieee80211w ieee80211r \
@@ -674,7 +680,7 @@ index aa72e09eba..0265c0518a 100644
local key_mgmt='NONE'
local network_data=
@@ -1150,7 +1254,10 @@ wpa_supplicant_add_network() {
@@ -1150,7 +1261,10 @@ wpa_supplicant_add_network() {
scan_ssid=""
}
@@ -686,7 +692,7 @@ index aa72e09eba..0265c0518a 100644
case "$auth_type" in
none) ;;
@@ -1186,7 +1293,7 @@ wpa_supplicant_add_network() {
@@ -1186,7 +1300,7 @@ wpa_supplicant_add_network() {
fi
append network_data "$passphrase" "$N$T"
;;

View File

@@ -1,17 +1,17 @@
From aab305d662fa77ef4495574c096cb1e065c1908a Mon Sep 17 00:00:00 2001
From 006abf1773051ad355b52d70095f63f44a496b13 Mon Sep 17 00:00:00 2001
From: John Crispin <john@phrozen.org>
Date: Sun, 25 Jul 2021 13:32:37 +0200
Subject: [PATCH 20/27] procd: add uxc support
Subject: [PATCH 02/70] procd: add uxc support
Signed-off-by: John Crispin <john@phrozen.org>
---
package/system/procd/Makefile | 12 ++---
package/system/procd/Makefile | 15 +++---
package/system/procd/files/procd.sh | 79 +++++++++++++++++++++++++++++
package/system/procd/files/uxc.init | 4 ++
3 files changed, 89 insertions(+), 6 deletions(-)
3 files changed, 90 insertions(+), 8 deletions(-)
diff --git a/package/system/procd/Makefile b/package/system/procd/Makefile
index 30d5adf427..98f1ed1775 100644
index 30d5adf427..b831f86639 100644
--- a/package/system/procd/Makefile
+++ b/package/system/procd/Makefile
@@ -12,9 +12,9 @@ PKG_RELEASE:=$(AUTORELEASE)
@@ -21,9 +21,9 @@ index 30d5adf427..98f1ed1775 100644
-PKG_SOURCE_DATE:=2021-02-23
-PKG_SOURCE_VERSION:=37eed131e9967a35f47bacb3437a9d3c8a57b3f4
-PKG_MIRROR_HASH:=2b0131ff9055ccf987cbeb5f36c2c2585dc780999df6be312fbbbcd61ce676d4
+PKG_SOURCE_DATE:=2021-08-15
+PKG_SOURCE_VERSION:=104b49d6ab25a8cf067e6d8d1f2da7defb9876d4
+PKG_MIRROR_HASH:=d13b566a14e84f6babe8b7d3dfb88e34c3dff0e97d7770d6fe71174685bca628
+PKG_MIRROR_HASH:=0d51642d82d7bb4150355a6986e54504dce171c6fcb7eeff312d20a5d106bad8
+PKG_SOURCE_DATE:=2021-11-04
+PKG_SOURCE_VERSION:=0ee8e734a7f67220cf4a3412b60ff674b5fb20dd
CMAKE_INSTALL:=1
PKG_LICENSE:=GPL-2.0
@@ -36,21 +36,30 @@ index 30d5adf427..98f1ed1775 100644
endif
CMAKE_OPTIONS += -DEARLY_PATH="$(TARGET_INIT_PATH)"
@@ -82,7 +82,7 @@ endef
@@ -68,7 +68,7 @@ define Package/procd-ujail
SECTION:=base
CATEGORY:=Base system
DEPENDS:=@KERNEL_NAMESPACES +@KERNEL_UTS_NS +@KERNEL_IPC_NS +@KERNEL_PID_NS \
- +libubox +libubus +libblobmsg-json
+ +libubox +libubus +libuci +libblobmsg-json
TITLE:=OpenWrt process jail helper
endef
@@ -82,15 +82,14 @@ endef
define Package/procd-seccomp
SECTION:=base
CATEGORY:=Base system
- DEPENDS:=@(arm||armeb||mips||mipsel||i386||powerpc||x86_64) @!TARGET_uml \
+ DEPENDS:=@(aarch64||arm||armeb||mips||mipsel||i386||powerpc||x86_64) @!TARGET_uml \
@KERNEL_SECCOMP +libubox +libblobmsg-json
- @KERNEL_SECCOMP +libubox +libblobmsg-json
+ DEPENDS:=@SECCOMP +libubox +libblobmsg-json
TITLE:=OpenWrt process seccomp helper + utrace
endef
@@ -90,7 +90,7 @@ endef
define Package/uxc
SECTION:=base
CATEGORY:=Base system
- DEPENDS:=+procd-ujail +libubus +libubox +libblobmsg-json
+ DEPENDS:=+procd-ujail +libubus +libubox +libblobmsg-json +blockd +rpcd
+ DEPENDS:=+procd-ujail +libubus +libubox +libblobmsg-json +blockd +PACKAGE_uxc:rpcd
TITLE:=OpenWrt container management
MAINTAINER:=Daniel Golle <daniel@makrotopia.org>
endef

View File

@@ -0,0 +1,35 @@
From d4e24006e05474b6dbe582f7c56a505cc0c45e81 Mon Sep 17 00:00:00 2001
From: Felix Fietkau <nbd@nbd.name>
Date: Mon, 1 Nov 2021 11:59:41 +0100
Subject: [PATCH] ubus: update to the latest version
b743a331421d ubusd: log ACL init errors
2099bb3ad997 libubus: use list_empty/list_first_entry in ubus_process_pending_msg
ef038488edc3 libubus: process pending messages in data handler if stack depth is 0
a72457b61df0 libubus: increase stack depth for processing obj msgs
Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
package/system/ubus/Makefile | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/package/system/ubus/Makefile b/package/system/ubus/Makefile
index 8a3fd1de7b..d5f86b6850 100644
--- a/package/system/ubus/Makefile
+++ b/package/system/ubus/Makefile
@@ -5,9 +5,9 @@ PKG_RELEASE:=2
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL=$(PROJECT_GIT)/project/ubus.git
-PKG_SOURCE_DATE:=2021-06-30
-PKG_SOURCE_VERSION:=4fc532c8a55ba8217ad67d7fd47c5eb9a8aba044
-PKG_MIRROR_HASH:=a5c8205f2e2b2f1f9ad687592e66a6e2bf8900dc54cfe3ceefe6c297d18971a8
+PKG_SOURCE_DATE:=2021-08-09
+PKG_SOURCE_VERSION:=a72457b61df045d3c499a6211362b751710590d7
+PKG_MIRROR_HASH:=ac617577bcb2ff3dbc3039ad67200afcce910840223a2de15977d3224e6557fd
PKG_ABI_VERSION:=$(call abi_version_str,$(PKG_SOURCE_DATE))
CMAKE_INSTALL:=1
--
2.25.1

View File

@@ -0,0 +1,34 @@
From 49ceb8a8d7009e5c81599c68b8aacc16d17d2e62 Mon Sep 17 00:00:00 2001
From: Stijn Tintel <stijn@linux-ipv6.be>
Date: Tue, 9 Nov 2021 17:20:41 +0100
Subject: [PATCH] rpcd: bump to git HEAD
20bf958 session: use uloop_timeout_remaining64
d11ffe9 session: use blobmsg_get_u64 for RPC_DUMP_EXPIRES
Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
---
package/system/rpcd/Makefile | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/package/system/rpcd/Makefile b/package/system/rpcd/Makefile
index 0896a7dada..af788dcfaa 100644
--- a/package/system/rpcd/Makefile
+++ b/package/system/rpcd/Makefile
@@ -12,10 +12,10 @@ PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL=$(PROJECT_GIT)/project/rpcd.git
-PKG_SOURCE_DATE:=2021-03-11
-PKG_SOURCE_VERSION:=ccb75178cf6a726896729c6904bd623636aa0b29
+PKG_MIRROR_HASH:=98071b4a1ce983a0e738d7e4a2f6e52b7f6db19f99510ddef430093314134ca4
+PKG_SOURCE_DATE:=2021-11-04
+PKG_SOURCE_VERSION:=d11ffe9383ae0ec34836421926364b24c1d891ca
PKG_MAINTAINER:=Jo-Philipp Wich <jo@mein.io>
-PKG_MIRROR_HASH:=87b1839275c209f9767057d6da5272cae973a064767fa28f380a37fb65e2e643
PKG_LICENSE:=ISC
PKG_LICENSE_FILES:=
--
2.25.1

View File

@@ -1,7 +1,8 @@
From b912dcd063381438ad70f4a3326ff0ac1be7c3ea Mon Sep 17 00:00:00 2001
From 3937223beab0c3e4284fd916c0c3b6548c287e03 Mon Sep 17 00:00:00 2001
From: Felix Fietkau <nbd@nbd.name>
Date: Tue, 26 Oct 2021 20:41:22 +0200
Subject: [PATCH] bpf-headers: add a package with kernel headers for ebpf
Subject: [PATCH 050/102] bpf-headers: add a package with kernel headers for
ebpf
In order to genererate suitable kernel headers, a 5.10 kernel tree is
prepared with a default config for mips. The arch is forced to mips in
@@ -11,27 +12,32 @@ It also has the advantage of supporting both endian types
Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
include/bpf.mk | 60 +++++++++++
include/bpf.mk | 65 ++++++++++++
package/kernel/bpf-headers/Makefile | 99 +++++++++++++++++++
.../src/include/generated/bounds.h | 14 +++
3 files changed, 173 insertions(+)
3 files changed, 178 insertions(+)
create mode 100644 include/bpf.mk
create mode 100644 package/kernel/bpf-headers/Makefile
create mode 100644 package/kernel/bpf-headers/src/include/generated/bounds.h
diff --git a/include/bpf.mk b/include/bpf.mk
new file mode 100644
index 0000000000..4e227a11d0
index 0000000000..3dc65c7685
--- /dev/null
+++ b/include/bpf.mk
@@ -0,0 +1,60 @@
+ifeq ($(CONFIG_BUILD_LLVM_BPF),)
+export PATH:=/usr/local/opt/llvm/bin:$(PATH)
+CLANG:=$(firstword $(shell PATH='$(PATH)' which clang clang-13 clang-12 clang-11 clang-10 clang-9))
+LLVM_VER:=$(subst clang,,$(notdir $(CLANG)))
@@ -0,0 +1,65 @@
+ifneq ($(CONFIG_BPF_TOOLCHAIN_HOST),)
+ BPF_TOOLCHAIN_HOST_PATH:=$(call qstrip,$(CONFIG_BPF_TOOLCHAIN_HOST_PATH))
+ ifneq ($(BPF_TOOLCHAIN_HOST_PATH),)
+ BPF_PATH:=$(BPF_TOOLCHAIN_HOST_PATH)/bin:$(PATH)
+ else
+ BPF_PATH:=$(BPF_PATH)
+ endif
+ CLANG:=$(firstword $(shell PATH='$(BPF_PATH)' which clang clang-13 clang-12 clang-11))
+ LLVM_VER:=$(subst clang,,$(notdir $(CLANG)))
+else
+CLANG:=$(STAGING_DIR_HOST)/bin/clang
+LLVM_VER:=
+ CLANG:=$(STAGING_DIR_HOST)/bin/clang
+ LLVM_VER:=
+endif
+
+LLVM_PATH:=$(dir $(CLANG))
@@ -87,7 +93,7 @@ index 0000000000..4e227a11d0
+
diff --git a/package/kernel/bpf-headers/Makefile b/package/kernel/bpf-headers/Makefile
new file mode 100644
index 0000000000..e316feea55
index 0000000000..5f5b89370d
--- /dev/null
+++ b/package/kernel/bpf-headers/Makefile
@@ -0,0 +1,99 @@
@@ -152,7 +158,7 @@ index 0000000000..e316feea55
+ $(Kernel/Patch/Default)
+endef
+
+BPF_DOC = $(wildcard $(patsubst %,$(LINUX_DIR)/scripts/%.py,bpf_doc bpf_helpers_doc))
+BPF_DOC = $(PKG_BUILD_DIR)/scripts/bpf_helpers_doc.py
+
+define Build/Configure
+ grep -vE 'CONFIG_(CPU_.*ENDIAN|HZ)' $(PKG_BUILD_DIR)/arch/mips/configs/generic_defconfig > $(PKG_BUILD_DIR)/.config

View File

@@ -0,0 +1,29 @@
From 32243b2148fd0dacd0630affaea59345c64df79a Mon Sep 17 00:00:00 2001
From: Felix Fietkau <nbd@nbd.name>
Date: Tue, 2 Nov 2021 10:36:14 +0100
Subject: [PATCH 051/102] bpf-headers: unset PKG_CONFIG_PATH
This fixes an issue where the kernel would pick up an incompatible target
libyaml for building host tools
Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
package/kernel/bpf-headers/Makefile | 2 ++
1 file changed, 2 insertions(+)
diff --git a/package/kernel/bpf-headers/Makefile b/package/kernel/bpf-headers/Makefile
index 5f5b89370d..df24bfa13f 100644
--- a/package/kernel/bpf-headers/Makefile
+++ b/package/kernel/bpf-headers/Makefile
@@ -41,6 +41,8 @@ define Package/bpf-headers
HIDDEN:=1
endef
+PKG_CONFIG_PATH:=
+
export HOST_EXTRACFLAGS=-I$(STAGING_DIR_HOST)/include
KERNEL_MAKE := \
--
2.25.1

View File

@@ -0,0 +1,99 @@
From 1eb36bc2be4b54e4e4e4ceffc01be78d996205f0 Mon Sep 17 00:00:00 2001
From: Felix Fietkau <nbd@nbd.name>
Date: Sun, 17 Oct 2021 17:50:53 +0200
Subject: [PATCH 052/102] tools/llvm-bpf: add llvm+clang build suitable for
compiling code to eBPF
Preparation for building packages that ship eBPF code
Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
toolchain/Config.in | 7 +++++++
tools/Makefile | 2 ++
tools/llvm-bpf/Makefile | 36 ++++++++++++++++++++++++++++++++++++
3 files changed, 45 insertions(+)
create mode 100644 tools/llvm-bpf/Makefile
diff --git a/toolchain/Config.in b/toolchain/Config.in
index 6dda9af92d..9062d6f65e 100644
--- a/toolchain/Config.in
+++ b/toolchain/Config.in
@@ -37,6 +37,13 @@ menuconfig TARGET_OPTIONS
Most people will answer N.
+config BUILD_LLVM_BPF
+ bool "Build LLVM toolchain for eBPF" if DEVEL
+ help
+ If enabled, a LLVM toolchain for building eBPF binaries will be built.
+ If this is not enabled, eBPF packages can only be built if the host
+ has a suitable toolchain
+
menuconfig EXTERNAL_TOOLCHAIN
bool
diff --git a/tools/Makefile b/tools/Makefile
index a2665dbc9a..83147014c6 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -35,6 +35,7 @@ tools-$(CONFIG_TARGET_mxs) += elftosb sdimage
tools-$(CONFIG_TARGET_tegra) += cbootimage cbootimage-configs
tools-$(CONFIG_USES_MINOR) += kernel2minor
tools-$(CONFIG_USE_SPARSE) += sparse
+tools-$(CONFIG_BUILD_LLVM_BPF) += llvm-bpf
# builddir dependencies
$(curdir)/autoconf/compile := $(curdir)/m4/compile
@@ -57,6 +58,7 @@ $(curdir)/libelf/compile := $(curdir)/libtool/compile
$(curdir)/libressl/compile := $(curdir)/pkgconf/compile
$(curdir)/libtool/compile := $(curdir)/m4/compile $(curdir)/autoconf/compile $(curdir)/automake/compile $(curdir)/missing-macros/compile
$(curdir)/lzma-old/compile := $(curdir)/zlib/compile
+$(curdir)/llvm-bpf/compile := $(curdir)/cmake/compile
$(curdir)/make-ext4fs/compile := $(curdir)/zlib/compile
$(curdir)/missing-macros/compile := $(curdir)/autoconf/compile
$(curdir)/mkimage/compile += $(curdir)/libressl/compile
diff --git a/tools/llvm-bpf/Makefile b/tools/llvm-bpf/Makefile
new file mode 100644
index 0000000000..a5ba2a4cb7
--- /dev/null
+++ b/tools/llvm-bpf/Makefile
@@ -0,0 +1,36 @@
+#
+# Copyright (C) 2006-2016 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=llvm-project
+PKG_VERSION:=13.0.0
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).src.tar.xz
+PKG_SOURCE_URL:=https://github.com/llvm/llvm-project/releases/download/llvmorg-$(PKG_VERSION)
+PKG_HASH:=6075ad30f1ac0e15f07c1bf062c1e1268c241d674f11bd32cdf0e040c71f2bf3
+
+HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/$(PKG_NAME)-$(PKG_VERSION).src
+
+HOST_BUILD_PARALLEL:=1
+
+CMAKE_BINARY_SUBDIR := build
+CMAKE_SOURCE_SUBDIR := llvm
+
+include $(INCLUDE_DIR)/host-build.mk
+include $(INCLUDE_DIR)/cmake.mk
+
+CMAKE_HOST_OPTIONS += \
+ -DLLVM_ENABLE_BINDINGS=OFF \
+ -DLLVM_INCLUDE_DOCS=OFF \
+ -DLLVM_INCLUDE_EXAMPLES=OFF \
+ -DLLVM_INCLUDE_TESTS=OFF \
+ -DLLVM_ENABLE_PROJECTS="clang;lld" \
+ -DLLVM_TARGETS_TO_BUILD=BPF \
+ -DCLANG_BUILD_EXAMPLES=OFF
+
+$(eval $(call HostBuild))
--
2.25.1

View File

@@ -0,0 +1,40 @@
From 103a743e7ca4a2e98969d0f60d8aeb6cc7641f67 Mon Sep 17 00:00:00 2001
From: Felix Fietkau <nbd@nbd.name>
Date: Tue, 2 Nov 2021 19:38:12 +0100
Subject: [PATCH 053/102] llvm-bpf: move to staging_dir/host/llvm-bpf
This makes it easier to package it up for the download server
Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
tools/llvm-bpf/Makefile | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/tools/llvm-bpf/Makefile b/tools/llvm-bpf/Makefile
index a5ba2a4cb7..ae279d26d2 100644
--- a/tools/llvm-bpf/Makefile
+++ b/tools/llvm-bpf/Makefile
@@ -24,6 +24,8 @@ CMAKE_SOURCE_SUBDIR := llvm
include $(INCLUDE_DIR)/host-build.mk
include $(INCLUDE_DIR)/cmake.mk
+CMAKE_HOST_INSTALL_PREFIX = $(STAGING_DIR_HOST)/llvm-bpf
+
CMAKE_HOST_OPTIONS += \
-DLLVM_ENABLE_BINDINGS=OFF \
-DLLVM_INCLUDE_DOCS=OFF \
@@ -31,6 +33,10 @@ CMAKE_HOST_OPTIONS += \
-DLLVM_INCLUDE_TESTS=OFF \
-DLLVM_ENABLE_PROJECTS="clang;lld" \
-DLLVM_TARGETS_TO_BUILD=BPF \
- -DCLANG_BUILD_EXAMPLES=OFF
+ -DCLANG_BUILD_EXAMPLES=OFF \
+ -DLLVM_INSTALL_TOOLCHAIN_ONLY=ON \
+ -DLLVM_LINK_LLVM_DYLIB=ON \
+ -DLLVM_TOOLCHAIN_TOOLS="llvm-objcopy;llvm-objdump;llvm-readelf;llvm-strip;llvm-ar;llvm-as;llvm-dis;llvm-link;llvm-nm;llvm-ranlib;llc;opt" \
+ -DCMAKE_SKIP_RPATH=OFF
$(eval $(call HostBuild))
--
2.25.1

View File

@@ -0,0 +1,103 @@
From a368d456ba1e9198fd8f473b7e82c0e066e4eb82 Mon Sep 17 00:00:00 2001
From: Felix Fietkau <nbd@nbd.name>
Date: Mon, 1 Nov 2021 18:40:03 +0100
Subject: [PATCH 054/102] build: fix bpf toolchain dependency for qosify
Add hidden symbols to fix defaults with CONFIG_DEVEL unset
Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
include/bpf.mk | 2 ++
toolchain/Config.in | 45 +++++++++++++++++++++++++++++++++++++++++++++
tools/Makefile | 2 +-
3 files changed, 48 insertions(+), 1 deletion(-)
diff --git a/include/bpf.mk b/include/bpf.mk
index 3dc65c7685..5211ec4434 100644
--- a/include/bpf.mk
+++ b/include/bpf.mk
@@ -1,3 +1,5 @@
+BPF_DEPENDS := @HAS_BPF_TOOLCHAIN
+
ifneq ($(CONFIG_BPF_TOOLCHAIN_HOST),)
BPF_TOOLCHAIN_HOST_PATH:=$(call qstrip,$(CONFIG_BPF_TOOLCHAIN_HOST_PATH))
ifneq ($(BPF_TOOLCHAIN_HOST_PATH),)
diff --git a/toolchain/Config.in b/toolchain/Config.in
index 9062d6f65e..997cff59e4 100644
--- a/toolchain/Config.in
+++ b/toolchain/Config.in
@@ -44,6 +44,32 @@ config BUILD_LLVM_BPF
If this is not enabled, eBPF packages can only be built if the host
has a suitable toolchain
+ choice BPF_TOOLCHAIN
+ prompt "BPF toolchain" if DEVEL
+ default BPF_TOOLCHAIN_NONE
+
+ config BPF_TOOLCHAIN_NONE
+ bool "None"
+
+ config BPF_TOOLCHAIN_HOST
+ select USE_LLVM_HOST
+ bool "Use host LLVM toolchain"
+
+ config BPF_TOOLCHAIN_BUILD_LLVM
+ select USE_LLVM_BUILD
+ bool "Build LLVM toolchain for eBPF"
+ help
+ If enabled, a LLVM toolchain for building eBPF binaries will be built.
+ If this is not enabled, eBPF packages can only be built if the host
+ has a suitable toolchain
+ endchoice
+
+ config BPF_TOOLCHAIN_HOST_PATH
+ string
+ depends on BPF_TOOLCHAIN_HOST
+ prompt "Host LLVM toolchain path (prefix)" if DEVEL
+ default "/usr/local/opt/llvm" if HOST_OS_MACOS
+ default ""
menuconfig EXTERNAL_TOOLCHAIN
bool
@@ -266,6 +292,25 @@ config GDB
help
Enable if you want to build the gdb.
+config GDB_PYTHON
+ bool
+ depends on GDB
+ prompt "Build gdb with python binding"
+
+ help
+ Enable the python bindings for GDB to allow using python in the gdb shell.
+
+config HAS_BPF_TOOLCHAIN
+ bool
+
+config USE_LLVM_HOST
+ select HAS_BPF_TOOLCHAIN
+ bool
+
+config USE_LLVM_BUILD
+ select HAS_BPF_TOOLCHAIN
+ bool
+
config USE_GLIBC
default y if !TOOLCHAINOPTS && !EXTERNAL_TOOLCHAIN && !NATIVE_TOOLCHAIN && (arc)
bool
diff --git a/tools/Makefile b/tools/Makefile
index 83147014c6..ae3cc5dfd6 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -35,7 +35,7 @@ tools-$(CONFIG_TARGET_mxs) += elftosb sdimage
tools-$(CONFIG_TARGET_tegra) += cbootimage cbootimage-configs
tools-$(CONFIG_USES_MINOR) += kernel2minor
tools-$(CONFIG_USE_SPARSE) += sparse
-tools-$(CONFIG_BUILD_LLVM_BPF) += llvm-bpf
+tools-$(CONFIG_USE_LLVM_BUILD) += llvm-bpf
# builddir dependencies
$(curdir)/autoconf/compile := $(curdir)/m4/compile
--
2.25.1

View File

@@ -0,0 +1,26 @@
From 2ae5b19a52da190ea342ec4210523407837c58ea Mon Sep 17 00:00:00 2001
From: Felix Fietkau <nbd@nbd.name>
Date: Tue, 2 Nov 2021 09:56:10 +0100
Subject: [PATCH 055/102] include/bpf.mk: fix typo
Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
include/bpf.mk | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/bpf.mk b/include/bpf.mk
index 5211ec4434..6223648c5d 100644
--- a/include/bpf.mk
+++ b/include/bpf.mk
@@ -5,7 +5,7 @@ ifneq ($(CONFIG_BPF_TOOLCHAIN_HOST),)
ifneq ($(BPF_TOOLCHAIN_HOST_PATH),)
BPF_PATH:=$(BPF_TOOLCHAIN_HOST_PATH)/bin:$(PATH)
else
- BPF_PATH:=$(BPF_PATH)
+ BPF_PATH:=$(PATH)
endif
CLANG:=$(firstword $(shell PATH='$(BPF_PATH)' which clang clang-13 clang-12 clang-11))
LLVM_VER:=$(subst clang,,$(notdir $(CLANG)))
--
2.25.1

View File

@@ -0,0 +1,39 @@
From aff796bf3e60d7f09e5ca500cbf59221211dd218 Mon Sep 17 00:00:00 2001
From: Felix Fietkau <nbd@nbd.name>
Date: Tue, 2 Nov 2021 10:39:35 +0100
Subject: [PATCH 056/102] include/bpf.mk: fix compile for big-endian targets
llvm-opt and llc need endian flags in the target as well
Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
include/bpf.mk | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/include/bpf.mk b/include/bpf.mk
index 6223648c5d..9636ad5165 100644
--- a/include/bpf.mk
+++ b/include/bpf.mk
@@ -22,6 +22,7 @@ LLVM_STRIP:=$(LLVM_PATH)/llvm-strip$(LLVM_VER)
BPF_KARCH:=mips
BPF_ARCH:=mips$(if $(CONFIG_BIG_ENDIAN),,el)
+BPF_TARGET:=bpf$(if $(CONFIG_BIG_ENDIAN),eb,el)
BPF_HEADERS_DIR:=$(STAGING_DIR)/bpf-headers
@@ -59,9 +60,9 @@ BPF_CFLAGS := \
define CompileBPF
$(CLANG) -g -target $(BPF_ARCH)-linux-gnu $(BPF_CFLAGS) $(2) \
-c $(1) -o $(patsubst %.c,%.bc,$(1))
- $(LLVM_OPT) -O2 -mtriple=bpf-pc-linux < $(patsubst %.c,%.bc,$(1)) > $(patsubst %.c,%.opt,$(1))
+ $(LLVM_OPT) -O2 -mtriple=$(BPF_TARGET) < $(patsubst %.c,%.bc,$(1)) > $(patsubst %.c,%.opt,$(1))
$(LLVM_DIS) < $(patsubst %.c,%.opt,$(1)) > $(patsubst %.c,%.S,$(1))
- $(LLVM_LLC) -march=bpf -filetype=obj -o $(patsubst %.c,%.o,$(1)) < $(patsubst %.c,%.S,$(1))
+ $(LLVM_LLC) -march=$(BPF_TARGET) -filetype=obj -o $(patsubst %.c,%.o,$(1)) < $(patsubst %.c,%.S,$(1))
$(LLVM_STRIP) --strip-debug $(patsubst %.c,%.o,$(1))
endef
--
2.25.1

View File

@@ -0,0 +1,34 @@
From d05fae42794c5fe76509935b1e8f900e1d17d9f0 Mon Sep 17 00:00:00 2001
From: John Crispin <john@phrozen.org>
Date: Fri, 5 Nov 2021 10:46:00 +0100
Subject: [PATCH] include/bpf.mk: add LD_LIBRARY_PATH
Signed-off-by: John Crispin <john@phrozen.org>
---
include/bpf.mk | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/include/bpf.mk b/include/bpf.mk
index 9636ad5165..2f797625b6 100644
--- a/include/bpf.mk
+++ b/include/bpf.mk
@@ -58,11 +58,16 @@ BPF_CFLAGS := \
-O2 -emit-llvm -Xclang -disable-llvm-passes
define CompileBPF
+ LD_LIBRARY_PATH=$(LD_LIBRARY_PATH):$(STAGING_DIR_HOST)/lib \
$(CLANG) -g -target $(BPF_ARCH)-linux-gnu $(BPF_CFLAGS) $(2) \
-c $(1) -o $(patsubst %.c,%.bc,$(1))
+ LD_LIBRARY_PATH=$(LD_LIBRARY_PATH):$(STAGING_DIR_HOST)/lib \
$(LLVM_OPT) -O2 -mtriple=$(BPF_TARGET) < $(patsubst %.c,%.bc,$(1)) > $(patsubst %.c,%.opt,$(1))
+ LD_LIBRARY_PATH=$(LD_LIBRARY_PATH):$(STAGING_DIR_HOST)/lib \
$(LLVM_DIS) < $(patsubst %.c,%.opt,$(1)) > $(patsubst %.c,%.S,$(1))
+ LD_LIBRARY_PATH=$(LD_LIBRARY_PATH):$(STAGING_DIR_HOST)/lib \
$(LLVM_LLC) -march=$(BPF_TARGET) -filetype=obj -o $(patsubst %.c,%.o,$(1)) < $(patsubst %.c,%.S,$(1))
+ LD_LIBRARY_PATH=$(LD_LIBRARY_PATH):$(STAGING_DIR_HOST)/lib \
$(LLVM_STRIP) --strip-debug $(patsubst %.c,%.o,$(1))
endef
--
2.25.1

View File

@@ -6,6 +6,7 @@ RUN apt-get update \
time git-core build-essential gcc-multilib clang \
libncurses5-dev zlib1g-dev gawk flex gettext wget unzip python \
python3 python3-pip python3-yaml libssl-dev rsync llvm llvm-12 \
clang-12 \
&& apt-get clean
RUN git config --global user.email "you@example.com"
RUN git config --global user.name "Your Name"

View File

@@ -230,6 +230,8 @@ IN_SFP_PHY=TRUE
IN_MALIBU_PHY=TRUE
else ifeq (CPPE, $(CHIP_TYPE))
IN_QCA808X_PHY=TRUE
IN_QCA803X_PHY=TRUE
IN_SFP_PHY=TRUE
IN_PHY_I2C_MODE=TRUE
IN_MALIBU_PHY=TRUE
else ifeq (DESS, $(CHIP_TYPE))

View File

@@ -17,7 +17,7 @@ include ./openvswitch.mk
#
PKG_NAME:=openvswitch
PKG_VERSION:=$(ovs_version)
PKG_RELEASE:=9
PKG_RELEASE:=10
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://www.openvswitch.org/releases/
PKG_HASH:=5c7baed537364d43af36c15dde298c95d35cb2cb3204b4d3fe9b0fc73c97f16d

View File

@@ -121,6 +121,7 @@ ovs_bridge_port_add() {
}
ovs-vsctl --may-exist add-port "$name" "$port" ${type:+ -- set interface "$port" type="$type"}
ovs_bridge_port_up "$port"
__port_list="$__port_list ${port} "
}
@@ -162,6 +163,7 @@ ovs_bridge_port_add_complex() {
ovs-vsctl --may-exist add-port "$bridge" "$port" ${tag:+tag="$tag"} \
${ofport:+ -- set interface "$port" ofport_request="$ofport"} \
${type:+ -- set interface "$port" type="$type"}
ovs_bridge_port_up "$port"
__port_list="$__port_list ${port} "
}
@@ -174,6 +176,12 @@ ovs_bridge_port_cleanup() {
done
}
ovs_bridge_port_up() {
local port="$1"
ip link set dev "$port" up
}
ovs_bridge_validate_datapath_id() {
local dpid="$1"

View File

@@ -79,9 +79,10 @@ return view.extend({
var cntbtn = E('button', {
'class': 'btn cbi-button-action important',
'click': ui.createHandlerFn(this, 'handleSysupgradeConfirm', btn),
'disabled': !is_valid
'click': ui.createHandlerFn(this, 'handleSysupgradeConfirm', btn)
}, [ _('Continue') ]);
if (!is_valid)
cntbtn.disabled = true;
body.push(E('div', { 'class': 'right' }, [
E('button', {

View File

@@ -43,6 +43,7 @@ return view.extend({
o.value('dhcp', _('Address configuration via DHCP'));
o.value('pppoe', _('Address configuration via PPPoE'));
o.value('wwan', _('Cellular network connection'));
o.value('wds', _('WiFi WDS uplink'));
o = s.option(form.ListValue, 'modem-type', _('Modem type'));
o.depends('protocol', 'wwan');
@@ -105,6 +106,25 @@ return view.extend({
o.depends('protocol', 'static');
o.datatype = 'ipaddr("nomask")';
o = s.option(form.Value, 'ssid', _('SSID'));
o.depends('protocol', 'wds');
o.rmempty = false;
o = s.option(form.Value, 'passphrase', _('Passphrase'));
o.depends('protocol', 'wds');
o.password = true;
o.rmempty = false;
o.datatype = "rangelength(8, 31)";
o = s.option(form.ListValue, 'encryption', _('Encryption'));
o.depends('protocol', 'wds');
o.value('psk', 'PSK');
o.value('psk-mixed', 'PSK-Mixed');
o.value('psk2', 'PSK2');
o.value('sae', 'SAE');
o.value('sae-mixed', 'SAE-Mixed');
o.password = true;
for (var i = 0; i < s.children.length; i++)
data.broadband[s.children[i].option] = profile.broadband[s.children[i].option];

View File

@@ -45,8 +45,6 @@ config_foreach delete_forwarding forwarding
uci commit
/etc/init.d/uhttpd enable
/etc/init.d/uhttpd start
/etc/init.d/ucentral stop
reload_config

View File

@@ -0,0 +1,36 @@
#
# Copyright (C) 2021 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=atfpolicy
PKG_VERSION:=1
PKG_LICENSE:=GPL-2.0
PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/cmake.mk
define Package/atfpolicy
SECTION:=net
CATEGORY:=Network
TITLE:=A simple daemon for handling airtime fairness prioritization
DEPENDS:=+libubox +libubus +libnl-tiny
endef
TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include/libnl-tiny
define Package/atfpolicy/install
$(INSTALL_DIR) $(1)/usr/sbin $(1)/etc/init.d $(1)/etc/config
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/atfpolicy $(1)/usr/sbin/
$(INSTALL_BIN) ./files/atfpolicy.init $(1)/etc/init.d/atfpolicy
$(INSTALL_DATA) ./files/atfpolicy.conf $(1)/etc/config/atfpolicy
endef
$(eval $(call BuildPackage,atfpolicy))

View File

@@ -0,0 +1,8 @@
config defaults
option vo_queue_weight 4
option update_pkt_threshold 100
option bulk_percent_thresh 50
option prio_percent_thresh 30
option weight_normal 256
option weight_prio 512
option weight_bulk 128

View File

@@ -0,0 +1,57 @@
#!/bin/sh /etc/rc.common
# Copyright (c) 2021 OpenWrt.org
START=50
USE_PROCD=1
PROG=/usr/sbin/atfpolicy
add_option() {
local type="$1"
local name="$2"
config_get val "$cfg" "$name"
[ -n "$val" ] && json_add_$type "$name" "$val"
}
add_defaults() {
cfg="$1"
json_add_boolean reset 1
add_option int vo_queue_weight
add_option int update_pkt_threshold
add_option int bulk_percent_thresh
add_option int prio_percent_thresh
add_option int weight_normal
add_option int weight_prio
add_option int weight_bulk
}
reload_service() {
json_init
config_load atfpolicy
config_foreach add_defaults defaults
ubus call atfpolicy config "$(json_dump)"
}
service_triggers() {
procd_add_reload_trigger atfpolicy
}
start_service() {
procd_open_instance
procd_set_param command "$PROG"
procd_set_param respawn
procd_close_instance
}
service_started() {
ubus -t 10 wait_for atfpolicy
[ $? = 0 ] && reload_service
}

View File

@@ -0,0 +1,15 @@
cmake_minimum_required(VERSION 3.10)
PROJECT(atfpolicy C)
ADD_DEFINITIONS(-Os -Wall -Wno-unknown-warning-option -Wno-array-bounds -Wno-format-truncation -Werror --std=gnu99)
SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
find_library(nl NAMES nl-tiny)
ADD_EXECUTABLE(atfpolicy main.c ubus.c interface.c nl80211.c)
TARGET_LINK_LIBRARIES(atfpolicy ${nl} ubox ubus)
INSTALL(TARGETS atfpolicy
RUNTIME DESTINATION ${CMAKE_INSTALL_SBINDIR}
)

View File

@@ -0,0 +1,90 @@
// SPDX-License-Identifier: GPL-2.0+
/*
* Copyright (C) 2021 Felix Fietkau <nbd@nbd.name>
*/
#ifndef __ATF_H
#define __ATF_H
#include <net/if.h>
#include <stdint.h>
#include <libubox/avl.h>
#define ATF_AVG_SCALE 12
#define ATF_AVG_WEIGHT_FACTOR 3
#define ATF_AVG_WEIGHT_DIV 4
#define MAC_ADDR_FMT "%02x:%02x:%02x:%02x:%02x:%02x"
#define MAC_ADDR_DATA(_a) \
((const uint8_t *)(_a))[0], \
((const uint8_t *)(_a))[1], \
((const uint8_t *)(_a))[2], \
((const uint8_t *)(_a))[3], \
((const uint8_t *)(_a))[4], \
((const uint8_t *)(_a))[5]
#define D(format, ...) do { \
if (debug_flag) \
fprintf(stderr, "DEBUG: %s(%d) " format "\n", __func__, __LINE__, ## __VA_ARGS__); \
} while (0)
struct atf_config {
int voice_queue_weight;
int min_pkt_thresh;
int bulk_percent_thresh;
int prio_percent_thresh;
int weight_normal;
int weight_prio;
int weight_bulk;
};
struct atf_interface {
struct avl_node avl;
char ifname[IFNAMSIZ + 1];
uint32_t ubus_obj;
struct avl_tree stations;
};
struct atf_stats {
uint64_t bulk, normal, prio;
};
struct atf_station {
struct avl_node avl;
uint8_t macaddr[6];
bool present;
uint8_t stats_idx;
struct atf_stats stats[2];
uint16_t avg_bulk;
uint16_t avg_prio;
int weight;
};
extern struct atf_config config;
extern int debug_flag;
void reset_config(void);
struct atf_interface *atf_interface_get(const char *ifname);
void atf_interface_sta_update(struct atf_interface *iface);
struct atf_station *atf_interface_sta_get(struct atf_interface *iface, uint8_t *macaddr);
void atf_interface_sta_changed(struct atf_interface *iface, struct atf_station *sta);
void atf_interface_sta_flush(struct atf_interface *iface);
void atf_interface_update_all(void);
int atf_ubus_init(void);
void atf_ubus_stop(void);
void atf_ubus_set_sta_weight(struct atf_interface *iface, struct atf_station *sta);
int atf_nl80211_init(void);
int atf_nl80211_interface_update(struct atf_interface *iface);
#endif

View File

@@ -0,0 +1,108 @@
// SPDX-License-Identifier: GPL-2.0+
/*
* Copyright (C) 2021 Felix Fietkau <nbd@nbd.name>
*/
#include <string.h>
#include <stdlib.h>
#include <libubox/avl-cmp.h>
#include "atf.h"
static AVL_TREE(interfaces, avl_strcmp, false, NULL);
#ifndef container_of_safe
#define container_of_safe(ptr, type, member) \
(ptr ? container_of(ptr, type, member) : NULL)
#endif
static int avl_macaddr_cmp(const void *k1, const void *k2, void *ptr)
{
return memcmp(k1, k2, 6);
}
void atf_interface_sta_update(struct atf_interface *iface)
{
struct atf_station *sta;
avl_for_each_element(&iface->stations, sta, avl)
sta->present = false;
}
struct atf_station *atf_interface_sta_get(struct atf_interface *iface, uint8_t *macaddr)
{
struct atf_station *sta;
sta = avl_find_element(&iface->stations, macaddr, sta, avl);
if (sta)
goto out;
sta = calloc(1, sizeof(*sta));
memcpy(sta->macaddr, macaddr, sizeof(sta->macaddr));
sta->avl.key = sta->macaddr;
sta->weight = -1;
avl_insert(&iface->stations, &sta->avl);
out:
sta->present = true;
return sta;
}
void atf_interface_sta_flush(struct atf_interface *iface)
{
struct atf_station *sta, *tmp;
avl_for_each_element_safe(&iface->stations, sta, avl, tmp) {
if (sta->present)
continue;
avl_delete(&iface->stations, &sta->avl);
free(sta);
}
}
void atf_interface_sta_changed(struct atf_interface *iface, struct atf_station *sta)
{
int weight;
if (sta->avg_prio > config.prio_percent_thresh)
weight = config.weight_prio;
else if (sta->avg_prio > config.bulk_percent_thresh)
weight = config.weight_bulk;
else
weight = config.weight_normal;
if (sta->weight == weight)
return;
sta->weight = weight;
atf_ubus_set_sta_weight(iface, sta);
}
struct atf_interface *atf_interface_get(const char *ifname)
{
struct atf_interface *iface;
iface = avl_find_element(&interfaces, ifname, iface, avl);
if (iface)
return iface;
if (strlen(ifname) + 1 > sizeof(iface->ifname))
return NULL;
iface = calloc(1, sizeof(*iface));
strcpy(iface->ifname, ifname);
iface->avl.key = iface->ifname;
avl_init(&iface->stations, avl_macaddr_cmp, false, NULL);
avl_insert(&interfaces, &iface->avl);
return iface;
}
void atf_interface_update_all(void)
{
struct atf_interface *iface, *tmp;
avl_for_each_element_safe(&interfaces, iface, avl, tmp)
atf_nl80211_interface_update(iface);
}

View File

@@ -0,0 +1,62 @@
// SPDX-License-Identifier: GPL-2.0+
/*
* Copyright (C) 2021 Felix Fietkau <nbd@nbd.name>
*/
#include <stdio.h>
#include <string.h>
#include <getopt.h>
#include <libubox/uloop.h>
#include "atf.h"
struct atf_config config;
int debug_flag;
void reset_config(void)
{
memset(&config, 0, sizeof(config));
config.voice_queue_weight = 4;
config.min_pkt_thresh = 100;
config.bulk_percent_thresh = (50 << ATF_AVG_SCALE) / 100;
config.prio_percent_thresh = (30 << ATF_AVG_SCALE) / 100;
config.weight_normal = 256;
config.weight_bulk = 128;
config.weight_prio = 512;
}
static void atf_update_cb(struct uloop_timeout *t)
{
atf_interface_update_all();
uloop_timeout_set(t, 1000);
}
int main(int argc, char **argv)
{
static struct uloop_timeout update_timer = {
.cb = atf_update_cb,
};
int ch;
while ((ch = getopt(argc, argv, "d")) != -1) {
switch (ch) {
case 'd':
debug_flag = 1;
break;
}
}
reset_config();
uloop_init();
atf_ubus_init();
atf_nl80211_init();
atf_update_cb(&update_timer);
uloop_run();
atf_ubus_stop();
uloop_done();
return 0;
}

View File

@@ -0,0 +1,174 @@
// SPDX-License-Identifier: GPL-2.0+
/*
* Copyright (C) 2021 Felix Fietkau <nbd@nbd.name>
*/
#define _GNU_SOURCE
#include <linux/nl80211.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <net/if.h>
#include <unl.h>
#include "atf.h"
static struct unl unl;
static void
atf_parse_tid_stats(struct atf_interface *iface, struct atf_stats *stats,
int tid, struct nlattr *attr)
{
struct nlattr *tb[NL80211_TID_STATS_MAX + 1];
uint64_t msdu;
if (nla_parse_nested(tb, NL80211_TID_STATS_MAX, attr, NULL))
return;
if (!tb[NL80211_TID_STATS_TX_MSDU])
return;
msdu = nla_get_u64(tb[NL80211_TID_STATS_TX_MSDU]);
switch (tid) {
case 0:
case 3:
/* BE */
stats->normal += msdu;
break;
case 1:
case 2:
/* BK */
stats->bulk += msdu;
break;
case 4:
case 5:
/* VI */
stats->prio += msdu;
break;
case 6:
case 7:
stats->prio += msdu * config.voice_queue_weight;
/* VO */
break;
default:
break;
}
}
static uint64_t atf_stats_total(struct atf_stats *stats)
{
return stats->normal + stats->prio + stats->bulk;
}
static void atf_stats_diff(struct atf_stats *dest, struct atf_stats *cur, struct atf_stats *prev)
{
dest->normal = cur->normal - prev->normal;
dest->prio = cur->prio - prev->prio;
dest->bulk = cur->bulk - prev->bulk;
}
static uint16_t atf_stats_avg(uint16_t avg, uint64_t cur, uint32_t total)
{
cur <<= ATF_AVG_SCALE;
cur /= total;
if (!avg)
return (uint16_t)cur;
avg *= ATF_AVG_WEIGHT_FACTOR;
avg += cur * (ATF_AVG_WEIGHT_DIV - ATF_AVG_WEIGHT_FACTOR);
avg /= ATF_AVG_WEIGHT_DIV;
if (!avg)
avg = 1;
return avg;
}
static void atf_sta_update_avg(struct atf_station *sta, struct atf_stats *cur)
{
uint64_t total = atf_stats_total(cur);
D("sta "MAC_ADDR_FMT" total pkts: total=%d bulk=%d normal=%d prio=%d",
MAC_ADDR_DATA(sta->macaddr), (uint32_t)total,
(uint32_t)cur->bulk, (uint32_t)cur->normal, (uint32_t)cur->prio);
if (total < config.min_pkt_thresh)
return;
sta->avg_bulk = atf_stats_avg(sta->avg_bulk, cur->bulk, total);
sta->avg_prio = atf_stats_avg(sta->avg_prio, cur->prio, total);
D("avg bulk=%d prio=%d",
(sta->avg_bulk * 100) >> ATF_AVG_SCALE,
(sta->avg_prio * 100) >> ATF_AVG_SCALE);
sta->stats_idx = !sta->stats_idx;
}
static int
atf_sta_cb(struct nl_msg *msg, void *arg)
{
struct atf_interface *iface = arg;
struct genlmsghdr *gnlh = nlmsg_data(nlmsg_hdr(msg));
struct nlattr *tb[NL80211_ATTR_MAX + 1];
struct nlattr *sinfo[NL80211_STA_INFO_MAX + 1];
struct atf_station *sta;
struct atf_stats *stats, diff = {};
struct nlattr *cur;
int idx = 0;
int rem;
nla_parse(tb, NL80211_ATTR_MAX, genlmsg_attrdata(gnlh, 0),
genlmsg_attrlen(gnlh, 0), NULL);
if (!tb[NL80211_ATTR_STA_INFO] || !tb[NL80211_ATTR_MAC])
return NL_SKIP;
if (nla_parse_nested(sinfo, NL80211_STA_INFO_MAX,
tb[NL80211_ATTR_STA_INFO], NULL))
return NL_SKIP;
if (!sinfo[NL80211_STA_INFO_TID_STATS])
return NL_SKIP;
sta = atf_interface_sta_get(iface, nla_data(tb[NL80211_ATTR_MAC]));
if (!sta)
return NL_SKIP;
stats = &sta->stats[sta->stats_idx];
memset(stats, 0, sizeof(*stats));
nla_for_each_nested(cur, sinfo[NL80211_STA_INFO_TID_STATS], rem)
atf_parse_tid_stats(iface, stats, idx++, cur);
atf_stats_diff(&diff, stats, &sta->stats[!sta->stats_idx]);
atf_sta_update_avg(sta, &diff);
atf_interface_sta_changed(iface, sta);
return NL_SKIP;
}
int atf_nl80211_interface_update(struct atf_interface *iface)
{
struct nl_msg *msg;
int ifindex;
ifindex = if_nametoindex(iface->ifname);
if (!ifindex)
return -1;
atf_interface_sta_update(iface);
msg = unl_genl_msg(&unl, NL80211_CMD_GET_STATION, true);
NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, ifindex);
unl_genl_request(&unl, msg, atf_sta_cb, iface);
atf_interface_sta_flush(iface);
return 0;
nla_put_failure:
nlmsg_free(msg);
return -1;
}
int atf_nl80211_init(void)
{
return unl_genl_init(&unl, "nl80211");
}

View File

@@ -0,0 +1,164 @@
// SPDX-License-Identifier: GPL-2.0+
/*
* Copyright (C) 2021 Felix Fietkau <nbd@nbd.name>
*/
#include <libubus.h>
#include "atf.h"
#define HOSTAPD_PREFIX "hostapd."
static struct ubus_auto_conn conn;
static struct blob_buf b;
enum {
ATF_CONFIG_RESET,
ATF_CONFIG_VO_Q_WEIGHT,
ATF_CONFIG_MIN_PKT_THRESH,
ATF_CONFIG_BULK_PERCENT_THR,
ATF_CONFIG_PRIO_PERCENT_THR,
ATF_CONFIG_WEIGHT_NORMAL,
ATF_CONFIG_WEIGHT_PRIO,
ATF_CONFIG_WEIGHT_BULK,
__ATF_CONFIG_MAX
};
static const struct blobmsg_policy atf_config_policy[__ATF_CONFIG_MAX] = {
[ATF_CONFIG_VO_Q_WEIGHT] = { "vo_queue_weight", BLOBMSG_TYPE_INT32 },
[ATF_CONFIG_MIN_PKT_THRESH] = { "update_pkt_threshold", BLOBMSG_TYPE_INT32 },
[ATF_CONFIG_BULK_PERCENT_THR] = { "bulk_percent_thresh", BLOBMSG_TYPE_INT32 },
[ATF_CONFIG_PRIO_PERCENT_THR] = { "prio_percent_thresh", BLOBMSG_TYPE_INT32 },
[ATF_CONFIG_WEIGHT_NORMAL] = { "weight_normal", BLOBMSG_TYPE_INT32 },
[ATF_CONFIG_WEIGHT_PRIO] = { "weight_prio", BLOBMSG_TYPE_INT32 },
[ATF_CONFIG_WEIGHT_BULK] = { "weight_bulk", BLOBMSG_TYPE_INT32 },
};
static int
atf_ubus_config(struct ubus_context *ctx, struct ubus_object *obj,
struct ubus_request_data *req, const char *method,
struct blob_attr *msg)
{
struct blob_attr *tb[__ATF_CONFIG_MAX];
struct blob_attr *cur;
static const struct {
int id;
int *field;
} field_map[] = {
{ ATF_CONFIG_VO_Q_WEIGHT, &config.voice_queue_weight },
{ ATF_CONFIG_MIN_PKT_THRESH, &config.min_pkt_thresh },
{ ATF_CONFIG_BULK_PERCENT_THR, &config.bulk_percent_thresh },
{ ATF_CONFIG_PRIO_PERCENT_THR, &config.prio_percent_thresh },
{ ATF_CONFIG_WEIGHT_NORMAL, &config.weight_normal },
{ ATF_CONFIG_WEIGHT_PRIO, &config.weight_prio },
{ ATF_CONFIG_WEIGHT_BULK, &config.weight_bulk },
};
bool reset = false;
int i;
blobmsg_parse(atf_config_policy, __ATF_CONFIG_MAX, tb,
blobmsg_data(msg), blobmsg_len(msg));
if ((cur = tb[ATF_CONFIG_RESET]) != NULL)
reset = blobmsg_get_bool(cur);
if (reset)
reset_config();
for (i = 0; i < ARRAY_SIZE(field_map); i++) {
if ((cur = tb[field_map[i].id]) != NULL)
*(field_map[i].field) = blobmsg_get_u32(cur);
}
return 0;
}
static const struct ubus_method atf_methods[] = {
UBUS_METHOD("config", atf_ubus_config, atf_config_policy),
};
static struct ubus_object_type atf_object_type =
UBUS_OBJECT_TYPE("atfpolicy", atf_methods);
static struct ubus_object atf_object = {
.name = "atfpolicy",
.type = &atf_object_type,
.methods = atf_methods,
.n_methods = ARRAY_SIZE(atf_methods),
};
static void
atf_ubus_add_interface(struct ubus_context *ctx, const char *name)
{
struct atf_interface *iface;
iface = atf_interface_get(name + strlen(HOSTAPD_PREFIX));
if (!iface)
return;
iface->ubus_obj = 0;
ubus_lookup_id(ctx, name, &iface->ubus_obj);
D("add interface %s", name + strlen(HOSTAPD_PREFIX));
}
static void
atf_ubus_lookup_cb(struct ubus_context *ctx, struct ubus_object_data *obj,
void *priv)
{
if (!strncmp(obj->path, HOSTAPD_PREFIX, strlen(HOSTAPD_PREFIX)))
atf_ubus_add_interface(ctx, obj->path);
}
void atf_ubus_set_sta_weight(struct atf_interface *iface, struct atf_station *sta)
{
D("set sta "MAC_ADDR_FMT" weight=%d", MAC_ADDR_DATA(sta->macaddr), sta->weight);
blob_buf_init(&b, 0);
blobmsg_printf(&b, "sta", MAC_ADDR_FMT, MAC_ADDR_DATA(sta->macaddr));
blobmsg_add_u32(&b, "weight", sta->weight);
if (ubus_invoke(&conn.ctx, iface->ubus_obj, "update_airtime", b.head, NULL, NULL, 100))
D("set airtime weight failed");
}
static void
atf_ubus_event_cb(struct ubus_context *ctx, struct ubus_event_handler *ev,
const char *type, struct blob_attr *msg)
{
static const struct blobmsg_policy policy =
{ "path", BLOBMSG_TYPE_STRING };
struct ubus_object_data obj;
struct blob_attr *attr;
blobmsg_parse(&policy, 1, &attr, blobmsg_data(msg), blobmsg_len(msg));
if (!attr)
return;
obj.path = blobmsg_get_string(attr);
atf_ubus_lookup_cb(ctx, &obj, NULL);
}
static void
ubus_connect_handler(struct ubus_context *ctx)
{
static struct ubus_event_handler ev = {
.cb = atf_ubus_event_cb
};
ubus_add_object(ctx, &atf_object);
ubus_register_event_handler(ctx, &ev, "ubus.object.add");
ubus_lookup(ctx, "hostapd.*", atf_ubus_lookup_cb, NULL);
}
int atf_ubus_init(void)
{
conn.cb = ubus_connect_handler;
ubus_auto_connect(&conn);
return 0;
}
void atf_ubus_stop(void)
{
ubus_auto_shutdown(&conn);
}

View File

@@ -16,7 +16,7 @@ PKG_BUILD_DEPENDS:=bpf-headers
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/cmake.mk
#include $(INCLUDE_DIR)/bpf.mk
include $(INCLUDE_DIR)/bpf.mk
define Package/qosify
SECTION:=kernel
@@ -27,12 +27,10 @@ define Package/qosify
PKGFLAGS+=nonshared
endef
#BPF_DOC = $(wildcard $(patsubst %,$(BPF_HEADERS_DIR)/scripts/%.py,bpf_doc bpf_helpers_doc))
TARGET_CFLAGS += -I$(BPF_HEADERS_DIR)/user_headers/include
BPF_DOC = $(wildcard $(patsubst %,$(BPF_HEADERS_DIR)/scripts/%.py,bpf_doc bpf_helpers_doc))
define Build/Compile
# $(call CompileBPF,$(PKG_BUILD_DIR)/qosify-bpf.c)
$(call CompileBPF,$(PKG_BUILD_DIR)/qosify-bpf.c)
$(Build/Compile/Default)
endef
@@ -43,7 +41,7 @@ endef
define Package/qosify/install
$(INSTALL_DIR) $(1)/lib/bpf $(1)/usr/sbin $(1)/etc/init.d $(1)/etc/config $(1)/etc/hotplug.d/net
$(INSTALL_DATA) ./files/qosify-bpf.o $(1)/lib/bpf
$(INSTALL_DATA) $(PKG_BUILD_DIR)/qosify-bpf.o $(1)/lib/bpf
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/qosify $(1)/usr/sbin/
$(INSTALL_BIN) ./files/qosify.init $(1)/etc/init.d/qosify
$(INSTALL_DATA) ./files/qosify-defaults.conf $(1)/etc/qosify-defaults.conf

View File

@@ -1,10 +1,12 @@
config defaults
list defaults /etc/qosify-defaults.conf
option dscp_prio CS5
option dscp_icmp CS6
option dscp_bulk CS0
option dscp_default_udp CS4
option bulk_trigger_timeout 5
option bulk_trigger_pps 100
option prio_max_avg_pkt_len 500
config interface wan
option name wan

View File

@@ -20,7 +20,7 @@ add_defaults() {
json_add_boolean reset 1
config_get files "$cfg" files
config_get files "$cfg" defaults
json_add_array files
for i in $files; do
json_add_string "" "$i"
@@ -30,10 +30,12 @@ add_defaults() {
add_option int timeout
add_option string dscp_prio
add_option string dscp_bulk
add_option string dscp_icmp
add_option string dscp_default_udp
add_option string dscp_default_tcp
add_option int bulk_trigger_timeout
add_option int bulk_trigger_pps
add_option int prio_max_avg_pkt_len
}
add_interface() {

View File

@@ -0,0 +1,112 @@
QoSify is simple daemon for setting up and managing CAKE along with a custom
eBPF based classifier that sets DSCP fields of packets.
It supports the following features:
- simple TCP/UDP port based mapping
- IP address based mapping
- priority boosting based on average packet size
- bulk flow detection based on number of packets per second
- dynamically add IP entries with timeout
- dns regex entries and ubus api for providing dns lookup results
It can be configured via ubus call qosify config.
This call supports the following parameters:
- "reset": BOOL
Reset the config to defaults instead of only updating supplied values
- "files": ARRAY of STRING
List of files with port/IP/host mappings
- "timeout": INT32
Default timeout for dynamically added entries
- "dscp_default_udp": STRING
Default DSCP value for UDP packets
- "dscp_default_tcp": STRING
Default DSCP value for TCP packets
- "dscp_prio": STRING
DSCP value for priority-marked packets
- "dscp_bulk": STRING
DSCP value for bulk-marked packets
- "dscp_icmp": STRING
DSCP value for ICMP packets
- "bulk_trigger_pps": INT32
Number of packets per second to trigger bulk flow detection
- "bulk_trigger_timeout": INT32
Time below bulk_trigger_pps threshold until a bulk flow mark is removed
- "prio_max_avg_pkt_len": INT32
Maximum average packet length for marking a flow as priority
- "interfaces": TABLE of TABLE
netifd interfaces to enable QoS on
- "devices": TABLE of TABLE
netdevs to enable QoS on
interface/device properties:
- "bandwidth_up": STRING
Uplink bandwidth (same format as tc)
- "bandwidth_down": STRING
Downlink bandwidth (same format as tc)
- "ingress": BOOL
Enable ingress shaping
- "egress": BOOL
Enable egress shaping
- "mode": STRING
CAKE diffserv mode
- "nat": BOOL
Enable CAKE NAT host detection via conntrack
- "host_isolate": BOOL
Enable CAKE host isolation
- "autorate_ingress": BOOL
Enable CAKE automatic rate estimation for ingress
- "ingress_options": STRING
CAKE ingress options
- "egress_options": STRING
CAKE egress options
- "options": STRING
CAKE options for ingress + egress
Mapping file syntax:
Each line has two whitespace separated fields, match and dscp
match is one of:
- tcp:<port>[-<endport>]
TCP single port, or range from <port> to <endport>
- udp:<port>[-<endport>]
UDP single port, or range from <port> to <endport>
- <ipaddr>
IPv4 address, e.g. 1.1.1.1
- <ipv6addr>
IPv6 address, e.g. ff01::1
- dns:<regex>
POSIX.2 extended regular expression for matching hostnames
Only works, if dns lookups are passed to qosify via the add_dns_host ubus call.
dscp can be a raw value, or a codepoint like CS0
Adding a + in front of the value tells qosify to only override the DSCP value if it is zero
Planned features:
- Integration with dnsmasq to support hostname pattern based DSCP marking
- Support for LAN host based priority

View File

@@ -1,3 +1,7 @@
// SPDX-License-Identifier: GPL-2.0+
/*
* Copyright (C) 2021 Felix Fietkau <nbd@nbd.name>
*/
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/wait.h>
@@ -130,8 +134,9 @@ static const char *check_str(struct blob_attr *attr)
}
static void
iface_config_set(struct qosify_iface_config *cfg, struct blob_attr *attr)
iface_config_set(struct qosify_iface *iface, struct blob_attr *attr)
{
struct qosify_iface_config *cfg = &iface->config;
struct blob_attr *tb[__IFACE_ATTR_MAX];
struct blob_attr *cur;
@@ -145,6 +150,7 @@ iface_config_set(struct qosify_iface_config *cfg, struct blob_attr *attr)
cfg->egress = true;
cfg->host_isolate = true;
cfg->autorate_ingress = true;
cfg->nat = !iface->device;
if ((cur = tb[IFACE_ATTR_BW_UP]) != NULL)
cfg->bandwidth_up = check_str(cur);
@@ -386,7 +392,7 @@ static void
interface_set_config(struct qosify_iface *iface, struct blob_attr *config)
{
iface->config_data = blob_memdup(config);
iface_config_set(&iface->config, iface->config_data);
iface_config_set(iface, iface->config_data);
interface_start(iface);
}

View File

@@ -1,3 +1,7 @@
// SPDX-License-Identifier: GPL-2.0+
/*
* Copyright (C) 2021 Felix Fietkau <nbd@nbd.name>
*/
#include <sys/resource.h>
#include <sys/stat.h>
#include <arpa/inet.h>
@@ -35,24 +39,17 @@ static void qosify_fill_rodata(struct bpf_object *obj, uint32_t flags)
}
static int
qosify_create_program(const char *suffix, uint32_t flags, bool *force_init)
qosify_create_program(const char *suffix, uint32_t flags)
{
DECLARE_LIBBPF_OPTS(bpf_object_open_opts, opts,
.pin_root_path = CLASSIFY_DATA_PATH,
);
struct bpf_program *prog;
struct bpf_object *obj;
struct stat st;
char path[256];
int err;
snprintf(path, sizeof(path), CLASSIFY_PIN_PATH "_" "%s", suffix);
if (!*force_init) {
if (stat(path, &st) == 0)
return 0;
*force_init = true;
}
obj = bpf_object__open_file(CLASSIFY_PROG_PATH, &opts);
err = libbpf_get_error(obj);
@@ -91,7 +88,7 @@ qosify_create_program(const char *suffix, uint32_t flags, bool *force_init)
return 0;
}
int qosify_loader_init(bool force_init)
int qosify_loader_init(void)
{
static const struct {
const char *suffix;
@@ -105,8 +102,7 @@ int qosify_loader_init(bool force_init)
glob_t g;
int i;
if (force_init &&
glob(CLASSIFY_DATA_PATH "/*", 0, NULL, &g) == 0) {
if (glob(CLASSIFY_DATA_PATH "/*", 0, NULL, &g) == 0) {
for (i = 0; i < g.gl_pathc; i++)
unlink(g.gl_pathv[i]);
}
@@ -117,8 +113,7 @@ int qosify_loader_init(bool force_init)
qosify_init_env();
for (i = 0; i < ARRAY_SIZE(progs); i++) {
if (qosify_create_program(progs[i].suffix, progs[i].flags,
&force_init))
if (qosify_create_program(progs[i].suffix, progs[i].flags))
return -1;
}

View File

@@ -1,3 +1,7 @@
// SPDX-License-Identifier: GPL-2.0+
/*
* Copyright (C) 2021 Felix Fietkau <nbd@nbd.name>
*/
#include <stdio.h>
#include <unistd.h>
#include <stdint.h>
@@ -10,7 +14,6 @@ static int usage(const char *progname)
{
fprintf(stderr, "Usage: %s [options]\n"
"Options:\n"
" -f: force reload of BPF programs\n"
" -l <file> Load defaults from <file>\n"
" -o only load program/maps without running as daemon\n"
"\n", progname);
@@ -21,14 +24,12 @@ static int usage(const char *progname)
int main(int argc, char **argv)
{
const char *load_file = NULL;
bool force_init = false;
bool oneshot = false;
int ch;
while ((ch = getopt(argc, argv, "fl:o")) != -1) {
switch (ch) {
case 'f':
force_init = true;
break;
case 'l':
load_file = optarg;
@@ -41,7 +42,7 @@ int main(int argc, char **argv)
}
}
if (qosify_loader_init(force_init))
if (qosify_loader_init())
return 2;
if (qosify_map_init())
@@ -62,6 +63,7 @@ int main(int argc, char **argv)
uloop_run();
qosify_ubus_stop();
qosify_iface_stop();
uloop_done();

View File

@@ -1,3 +1,7 @@
// SPDX-License-Identifier: GPL-2.0+
/*
* Copyright (C) 2021 Felix Fietkau <nbd@nbd.name>
*/
#include <arpa/inet.h>
#include <errno.h>
@@ -17,7 +21,8 @@ static AVL_TREE(map_data, qosify_map_entry_cmp, false, NULL);
static LIST_HEAD(map_files);
static uint32_t next_timeout;
static uint8_t qosify_dscp_default[2] = { 0xff, 0xff };
int qosify_map_timeout = 3600;
int qosify_map_timeout;
int qosify_active_timeout;
struct qosify_config config;
struct qosify_map_file {
@@ -34,6 +39,37 @@ static const struct {
[CL_MAP_IPV4_ADDR] = { "ipv4_map", "ipv4_addr" },
[CL_MAP_IPV6_ADDR] = { "ipv6_map", "ipv6_addr" },
[CL_MAP_CONFIG] = { "config", "config" },
[CL_MAP_DNS] = { "dns", "dns" },
};
static const struct {
const char name[5];
uint8_t val;
} codepoints[] = {
{ "CS0", 0 },
{ "CS1", 8 },
{ "CS2", 16 },
{ "CS3", 24 },
{ "CS4", 32 },
{ "CS5", 40 },
{ "CS6", 48 },
{ "CS7", 56 },
{ "AF11", 10 },
{ "AF12", 12 },
{ "AF13", 14 },
{ "AF21", 18 },
{ "AF22", 20 },
{ "AF22", 22 },
{ "AF31", 26 },
{ "AF32", 28 },
{ "AF33", 30 },
{ "AF41", 34 },
{ "AF42", 36 },
{ "AF43", 38 },
{ "EF", 46 },
{ "VA", 44 },
{ "LE", 1 },
{ "DF", 0 },
};
static void qosify_map_timer_cb(struct uloop_timeout *t)
@@ -104,6 +140,8 @@ static void __qosify_map_set_dscp_default(enum qosify_map_id id, uint8_t val)
int fd = qosify_map_fds[id];
int i;
val |= QOSIFY_DSCP_DEFAULT_FLAG;
for (i = 0; i < (1 << 16); i++) {
data.addr.port = htons(i);
if (avl_find(&map_data, &data))
@@ -135,7 +173,7 @@ int qosify_map_init(void)
{
int i;
for (i = 0; i < ARRAY_SIZE(qosify_map_fds); i++) {
for (i = 0; i < CL_MAP_DNS; i++) {
qosify_map_fds[i] = qosify_map_get_fd(i);
if (qosify_map_fds[i] < 0)
return -1;
@@ -159,38 +197,11 @@ static char *str_skip(char *str, bool space)
static int
qosify_map_codepoint(const char *val)
{
static const struct {
const char name[5];
uint8_t val;
} cp[] = {
{ "CS0", 0 },
{ "CS1", 8 },
{ "CS2", 16 },
{ "CS3", 24 },
{ "CS4", 32 },
{ "CS5", 40 },
{ "CS6", 48 },
{ "CS7", 56 },
{ "AF11", 10 },
{ "AF12", 12 },
{ "AF13", 14 },
{ "AF21", 18 },
{ "AF22", 20 },
{ "AF22", 22 },
{ "AF31", 26 },
{ "AF32", 28 },
{ "AF33", 30 },
{ "AF41", 34 },
{ "AF42", 36 },
{ "AF43", 38 },
{ "EF", 46 },
{ "VA", 44 },
};
int i;
for (i = 0; i < ARRAY_SIZE(cp); i++)
if (!strcmp(cp[i].name, val))
return cp[i].val;
for (i = 0; i < ARRAY_SIZE(codepoints); i++)
if (!strcmp(codepoints[i].name, val))
return codepoints[i].val;
return 0xff;
}
@@ -203,9 +214,37 @@ static int qosify_map_entry_cmp(const void *k1, const void *k2, void *ptr)
if (d1->id != d2->id)
return d2->id - d1->id;
if (d1->id == CL_MAP_DNS)
return strcmp(d1->addr.dns.pattern, d2->addr.dns.pattern);
return memcmp(&d1->addr, &d2->addr, sizeof(d1->addr));
}
static struct qosify_map_entry *
__qosify_map_alloc_entry(struct qosify_map_data *data)
{
struct qosify_map_entry *e;
char *pattern;
if (data->id < CL_MAP_DNS) {
e = calloc(1, sizeof(*e));
memcpy(&e->data.addr, &data->addr, sizeof(e->data.addr));
return e;
}
e = calloc_a(sizeof(*e), &pattern, strlen(data->addr.dns.pattern) + 1);
strcpy(pattern, data->addr.dns.pattern);
e->data.addr.dns.pattern = pattern;
if (regcomp(&e->data.addr.dns.regex, pattern,
REG_EXTENDED | REG_ICASE | REG_NOSUB)) {
free(e);
return NULL;
}
return e;
}
static void __qosify_map_set_entry(struct qosify_map_data *data)
{
int fd = qosify_map_fds[data->id];
@@ -220,10 +259,12 @@ static void __qosify_map_set_entry(struct qosify_map_data *data)
if (!add)
return;
e = calloc(1, sizeof(*e));
e = __qosify_map_alloc_entry(data);
if (!e)
return;
e->avl.key = &e->data;
e->data.id = data->id;
memcpy(&e->data.addr, &data->addr, sizeof(e->data.addr));
avl_insert(&map_data, &e->avl);
} else {
prev_dscp = e->data.dscp;
@@ -243,8 +284,14 @@ static void __qosify_map_set_entry(struct qosify_map_data *data)
e->data.dscp = e->data.file_dscp;
}
if (e->data.dscp != prev_dscp)
bpf_map_update_elem(fd, &data->addr, &e->data.dscp, BPF_ANY);
if (e->data.dscp != prev_dscp && data->id < CL_MAP_DNS) {
struct qosify_ip_map_val val = {
.dscp = e->data.dscp,
.seen = 1,
};
bpf_map_update_elem(fd, &data->addr, &val, BPF_ANY);
}
if (add) {
if (qosify_map_timeout == ~0 || file) {
@@ -313,6 +360,9 @@ int qosify_map_set_entry(enum qosify_map_id id, bool file, const char *str, uint
};
switch (id) {
case CL_MAP_DNS:
data.addr.dns.pattern = str;
break;
case CL_MAP_TCP_PORTS:
case CL_MAP_UDP_PORTS:
return qosify_map_set_port(&data, str);
@@ -351,6 +401,28 @@ int qosify_map_dscp_value(const char *val)
return dscp + (fallback << 6);
}
static void
qosify_map_dscp_codepoint_str(char *dest, int len, uint8_t dscp)
{
int i;
if (dscp & QOSIFY_DSCP_FALLBACK_FLAG) {
*(dest++) = '+';
len--;
dscp &= ~QOSIFY_DSCP_FALLBACK_FLAG;
}
for (i = 0; i < ARRAY_SIZE(codepoints); i++) {
if (codepoints[i].val != dscp)
continue;
snprintf(dest, len, "%s", codepoints[i].name);
return;
}
snprintf(dest, len, "0x%x", dscp);
}
static void
qosify_map_parse_line(char *str)
{
@@ -372,6 +444,8 @@ qosify_map_parse_line(char *str)
if (dscp < 0)
return;
if (!strncmp(key, "dns:", 4))
qosify_map_set_entry(CL_MAP_DNS, true, key + 4, dscp);
if (!strncmp(key, "tcp:", 4))
qosify_map_set_entry(CL_MAP_TCP_PORTS, true, key + 4, dscp);
else if (!strncmp(key, "udp:", 4))
@@ -458,6 +532,7 @@ void qosify_map_reset_config(void)
qosify_map_set_dscp_default(CL_MAP_TCP_PORTS, 0);
qosify_map_set_dscp_default(CL_MAP_UDP_PORTS, 0);
qosify_map_timeout = 3600;
qosify_active_timeout = 300;
memset(&config, 0, sizeof(config));
config.dscp_prio = 0xff;
@@ -477,12 +552,44 @@ void qosify_map_reload(void)
qosify_map_gc();
}
static void qosify_map_free_entry(struct qosify_map_entry *e)
{
int fd = qosify_map_fds[e->data.id];
avl_delete(&map_data, &e->avl);
if (e->data.id < CL_MAP_DNS)
bpf_map_delete_elem(fd, &e->data.addr);
free(e);
}
static bool
qosify_map_entry_refresh_timeout(struct qosify_map_entry *e)
{
struct qosify_ip_map_val val;
int fd = qosify_map_fds[e->data.id];
if (e->data.id != CL_MAP_IPV4_ADDR &&
e->data.id != CL_MAP_IPV6_ADDR)
return false;
if (bpf_map_lookup_elem(fd, &e->data.addr, &val))
return false;
if (!val.seen)
return false;
e->timeout = qosify_gettime() + qosify_active_timeout;
val.seen = 0;
bpf_map_update_elem(fd, &e->data.addr, &val, BPF_ANY);
return true;
}
void qosify_map_gc(void)
{
struct qosify_map_entry *e, *tmp;
int32_t timeout = 0;
uint32_t cur_time = qosify_gettime();
int fd;
next_timeout = 0;
avl_for_each_element_safe(&map_data, e, avl, tmp) {
@@ -490,6 +597,9 @@ void qosify_map_gc(void)
if (e->data.user && e->timeout != ~0) {
cur_timeout = e->timeout - cur_time;
if (cur_timeout <= 0 &&
qosify_map_entry_refresh_timeout(e))
cur_timeout = e->timeout - cur_time;
if (cur_timeout <= 0) {
e->data.user = false;
e->data.dscp = e->data.file_dscp;
@@ -502,10 +612,7 @@ void qosify_map_gc(void)
if (e->data.file || e->data.user)
continue;
avl_delete(&map_data, &e->avl);
fd = qosify_map_fds[e->data.id];
bpf_map_delete_elem(fd, &e->data.addr);
free(e);
qosify_map_free_entry(e);
}
if (!timeout)
@@ -514,6 +621,52 @@ void qosify_map_gc(void)
uloop_timeout_set(&qosify_map_timer, timeout * 1000);
}
int qosify_map_add_dns_host(const char *host, const char *addr, const char *type, int ttl)
{
struct qosify_map_data data = {
.id = CL_MAP_DNS,
.addr.dns.pattern = "",
};
struct qosify_map_entry *e;
int prev_timeout = qosify_map_timeout;
e = avl_find_ge_element(&map_data, &data, e, avl);
if (!e)
return 0;
memset(&data, 0, sizeof(data));
data.user = true;
if (!strcmp(type, "A"))
data.id = CL_MAP_IPV4_ADDR;
else if (!strcmp(type, "AAAA"))
data.id = CL_MAP_IPV6_ADDR;
else
return 0;
if (qosify_map_fill_ip(&data, addr))
return -1;
avl_for_element_to_last(&map_data, e, e, avl) {
regex_t *regex = &e->data.addr.dns.regex;
if (e->data.id != CL_MAP_DNS)
return 0;
if (regexec(regex, host, 0, NULL, 0) != 0)
continue;
if (ttl)
qosify_map_timeout = ttl;
data.dscp = e->data.dscp;
__qosify_map_set_entry(&data);
qosify_map_timeout = prev_timeout;
}
return 0;
}
void qosify_map_dump(struct blob_buf *b)
{
struct qosify_map_entry *e;
@@ -543,24 +696,31 @@ void qosify_map_dump(struct blob_buf *b)
blobmsg_add_u8(b, "file", e->data.file);
blobmsg_add_u8(b, "user", e->data.user);
buf = blobmsg_alloc_string_buffer(b, "dscp", buf_len);
qosify_map_dscp_codepoint_str(buf, buf_len, e->data.dscp);
blobmsg_add_string_buffer(b);
blobmsg_add_string(b, "type", qosify_map_info[e->data.id].type_name);
buf = blobmsg_alloc_string_buffer(b, "value", buf_len);
switch (e->data.id) {
case CL_MAP_TCP_PORTS:
case CL_MAP_UDP_PORTS:
snprintf(buf, buf_len, "%d", ntohs(e->data.addr.port));
blobmsg_printf(b, "addr", "%d", ntohs(e->data.addr.port));
break;
case CL_MAP_IPV4_ADDR:
case CL_MAP_IPV6_ADDR:
buf = blobmsg_alloc_string_buffer(b, "addr", buf_len);
af = e->data.id == CL_MAP_IPV6_ADDR ? AF_INET6 : AF_INET;
inet_ntop(af, &e->data.addr, buf, buf_len);
blobmsg_add_string_buffer(b);
break;
case CL_MAP_DNS:
blobmsg_add_string(b, "addr", e->data.addr.dns.pattern);
break;
default:
*buf = 0;
break;
}
blobmsg_add_string_buffer(b);
blobmsg_close_table(b, c);
}
blobmsg_close_array(b, a);

View File

@@ -1,3 +1,7 @@
// SPDX-License-Identifier: GPL-2.0+
/*
* Copyright (C) 2021 Felix Fietkau <nbd@nbd.name>
*/
#define KBUILD_MODNAME "foo"
#include <uapi/linux/bpf.h>
#include <uapi/linux/if_ether.h>
@@ -16,7 +20,6 @@
#include "qosify-bpf.h"
#define INET_ECN_MASK 3
#define DSCP_FALLBACK_FLAG BIT(6)
#define FLOW_CHECK_INTERVAL ((u32)((1000000000ULL) >> 24))
#define FLOW_TIMEOUT ((u32)((30ULL * 1000000000ULL) >> 24))
@@ -65,7 +68,7 @@ struct {
__uint(type, BPF_MAP_TYPE_HASH);
__uint(pinning, 1);
__uint(key_size, sizeof(struct in_addr));
__type(value, __u8);
__type(value, struct qosify_ip_map_val);
__uint(max_entries, 100000);
__uint(map_flags, BPF_F_NO_PREALLOC);
} ipv4_map SEC(".maps");
@@ -74,7 +77,7 @@ struct {
__uint(type, BPF_MAP_TYPE_HASH);
__uint(pinning, 1);
__uint(key_size, sizeof(struct in6_addr));
__type(value, __u8);
__type(value, struct qosify_ip_map_val);
__uint(max_entries, 100000);
__uint(map_flags, BPF_F_NO_PREALLOC);
} ipv6_map SEC(".maps");
@@ -211,34 +214,40 @@ static void
parse_l4proto(struct qosify_config *config, struct __sk_buff *skb,
__u32 offset, __u8 proto, __u8 *dscp_out)
{
struct udphdr *udp = skb_ptr(skb, offset);
__u32 key;
struct udphdr *udp;
__u32 src, dest, key;
__u8 *value;
udp = skb_ptr(skb, offset);
if (skb_check(skb, &udp->len))
return;
if (module_flags & QOSIFY_INGRESS)
key = udp->source;
else
key = udp->dest;
if (proto == IPPROTO_TCP)
value = bpf_map_lookup_elem(&tcp_ports, &key);
else if (proto == IPPROTO_UDP)
value = bpf_map_lookup_elem(&udp_ports, &key);
else {
if ((proto == IPPROTO_ICMP || proto == IPPROTO_ICMPV6) &&
config && config->dscp_icmp != 0xff)
*dscp_out = config->dscp_icmp;
if (config && (proto == IPPROTO_ICMP || proto == IPPROTO_ICMPV6)) {
*dscp_out = config->dscp_icmp;
return;
}
src = udp->source;
dest = udp->dest;
if (module_flags & QOSIFY_INGRESS)
key = src;
else
key = dest;
if (proto == IPPROTO_TCP) {
value = bpf_map_lookup_elem(&tcp_ports, &key);
} else {
if (proto != IPPROTO_UDP)
key = 0;
value = bpf_map_lookup_elem(&udp_ports, &key);
}
if (!value)
return;
if ((*value & DSCP_FALLBACK_FLAG) && *dscp_out)
*dscp_out = *value;
*dscp_out = *value;
}
static void
@@ -251,9 +260,16 @@ check_flow(struct qosify_config *config, struct __sk_buff *skb,
__u32 hash;
__u32 time;
if (!(*dscp & QOSIFY_DSCP_DEFAULT_FLAG))
return;
if (!config)
return;
if (!config->bulk_trigger_pps &&
!config->prio_max_avg_pkt_len)
return;
time = cur_time();
hash = bpf_get_hash_recalc(skb);
flow = bpf_map_lookup_elem(&flow_map, &hash);
@@ -285,7 +301,8 @@ check_flow(struct qosify_config *config, struct __sk_buff *skb,
if (flow->pkt_count < 0xffff)
flow->pkt_count++;
if (flow->pkt_count > config->bulk_trigger_pps) {
if (config->bulk_trigger_pps &&
flow->pkt_count > config->bulk_trigger_pps) {
flow->dscp = config->dscp_bulk;
flow->bulk_timeout = config->bulk_trigger_timeout;
}
@@ -300,8 +317,7 @@ out:
flow->dscp = 0xff;
}
if (flow->dscp != 0xff &&
!(*dscp && (flow->dscp & DSCP_FALLBACK_FLAG)))
if (flow->dscp != 0xff)
*dscp = flow->dscp;
return;
@@ -320,10 +336,12 @@ static __always_inline void
parse_ipv4(struct __sk_buff *skb, __u32 *offset)
{
struct qosify_config *config;
struct qosify_ip_map_val *ip_val;
const __u32 zero_port = 0;
struct iphdr *iph;
__u8 dscp = 0;
__u8 dscp = 0xff;
__u8 *value;
__u8 ipproto;
int hdr_len;
void *key;
bool force;
@@ -335,7 +353,7 @@ parse_ipv4(struct __sk_buff *skb, __u32 *offset)
return;
hdr_len = iph->ihl * 4;
if (bpf_skb_pull_data(skb, *offset + hdr_len))
if (bpf_skb_pull_data(skb, *offset + hdr_len + sizeof(struct udphdr)))
return;
iph = skb_ptr(skb, *offset);
@@ -344,23 +362,29 @@ parse_ipv4(struct __sk_buff *skb, __u32 *offset)
if (skb_check(skb, (void *)(iph + 1)))
return;
parse_l4proto(config, skb, *offset, iph->protocol, &dscp);
ipproto = iph->protocol;
parse_l4proto(config, skb, *offset, ipproto, &dscp);
if (module_flags & QOSIFY_INGRESS)
key = &iph->saddr;
else
key = &iph->daddr;
value = bpf_map_lookup_elem(&ipv4_map, key);
/* use udp port 0 entry as fallback for non-tcp/udp */
if (!value)
ip_val = bpf_map_lookup_elem(&ipv4_map, key);
if (ip_val) {
if (!ip_val->seen)
ip_val->seen = 1;
dscp = ip_val->dscp;
} else if (dscp == 0xff) {
/* use udp port 0 entry as fallback for non-tcp/udp */
value = bpf_map_lookup_elem(&udp_ports, &zero_port);
if (value)
dscp = *value;
if (value)
dscp = *value;
}
check_flow(config, skb, &dscp);
force = !(dscp & DSCP_FALLBACK_FLAG);
force = !(dscp & QOSIFY_DSCP_FALLBACK_FLAG);
dscp &= GENMASK(5, 0);
ipv4_change_dsfield(iph, INET_ECN_MASK, dscp << 2, force);
@@ -370,16 +394,18 @@ static __always_inline void
parse_ipv6(struct __sk_buff *skb, __u32 *offset)
{
struct qosify_config *config;
struct qosify_ip_map_val *ip_val;
const __u32 zero_port = 0;
struct ipv6hdr *iph;
__u8 dscp = 0;
__u8 *value;
__u8 ipproto;
void *key;
bool force;
config = get_config();
if (bpf_skb_pull_data(skb, *offset + sizeof(*iph)))
if (bpf_skb_pull_data(skb, *offset + sizeof(*iph) + sizeof(struct udphdr)))
return;
iph = skb_ptr(skb, *offset);
@@ -388,24 +414,29 @@ parse_ipv6(struct __sk_buff *skb, __u32 *offset)
if (skb_check(skb, (void *)(iph + 1)))
return;
ipproto = iph->nexthdr;
if (module_flags & QOSIFY_INGRESS)
key = &iph->saddr;
else
key = &iph->daddr;
parse_l4proto(config, skb, *offset, iph->nexthdr, &dscp);
parse_l4proto(config, skb, *offset, ipproto, &dscp);
value = bpf_map_lookup_elem(&ipv6_map, key);
/* use udp port 0 entry as fallback for non-tcp/udp */
if (!value)
ip_val = bpf_map_lookup_elem(&ipv6_map, key);
if (ip_val) {
if (!ip_val->seen)
ip_val->seen = 1;
dscp = ip_val->dscp;
} else if (dscp == 0xff) {
/* use udp port 0 entry as fallback for non-tcp/udp */
value = bpf_map_lookup_elem(&udp_ports, &zero_port);
if (value)
dscp = *value;
if (value)
dscp = *value;
}
check_flow(config, skb, &dscp);
force = !(dscp & DSCP_FALLBACK_FLAG);
force = !(dscp & QOSIFY_DSCP_FALLBACK_FLAG);
dscp &= GENMASK(5, 0);
ipv6_change_dsfield(iph, INET_ECN_MASK, dscp << 2, force);

View File

@@ -1,3 +1,7 @@
// SPDX-License-Identifier: GPL-2.0+
/*
* Copyright (C) 2021 Felix Fietkau <nbd@nbd.name>
*/
#ifndef __BPF_QOSIFY_H
#define __BPF_QOSIFY_H
@@ -11,6 +15,10 @@
#define QOSIFY_INGRESS (1 << 0)
#define QOSIFY_IP_ONLY (1 << 1)
#define QOSIFY_DSCP_FALLBACK_FLAG (1 << 6)
#define QOSIFY_DSCP_DEFAULT_FLAG (1 << 7)
/* global config data */
struct qosify_config {
uint8_t dscp_prio;
@@ -23,4 +31,9 @@ struct qosify_config {
uint16_t prio_max_avg_pkt_len;
};
struct qosify_ip_map_val {
uint8_t dscp; /* must be first */
uint8_t seen;
};
#endif

View File

@@ -1,7 +1,12 @@
// SPDX-License-Identifier: GPL-2.0+
/*
* Copyright (C) 2021 Felix Fietkau <nbd@nbd.name>
*/
#ifndef __QOS_CLASSIFY_H
#define __QOS_CLASSIFY_H
#include <stdbool.h>
#include <regex.h>
#include <bpf/bpf.h>
#include <bpf/libbpf.h>
@@ -25,6 +30,7 @@ enum qosify_map_id {
CL_MAP_IPV4_ADDR,
CL_MAP_IPV6_ADDR,
CL_MAP_CONFIG,
CL_MAP_DNS,
__CL_MAP_MAX,
};
@@ -38,9 +44,13 @@ struct qosify_map_data {
uint8_t file_dscp;
union {
uint16_t port;
uint32_t port;
struct in_addr ip;
struct in6_addr ip6;
struct {
const char *pattern;
regex_t regex;
} dns;
} addr;
};
@@ -54,9 +64,10 @@ struct qosify_map_entry {
extern int qosify_map_timeout;
extern int qosify_active_timeout;
extern struct qosify_config config;
int qosify_loader_init(bool force_init);
int qosify_loader_init(void);
int qosify_map_init(void);
int qosify_map_dscp_value(const char *val);
@@ -69,6 +80,7 @@ void qosify_map_dump(struct blob_buf *b);
void qosify_map_set_dscp_default(enum qosify_map_id id, uint8_t val);
void qosify_map_reset_config(void);
void qosify_map_update_config(void);
int qosify_map_add_dns_host(const char *host, const char *addr, const char *type, int ttl);
int qosify_iface_init(void);
void qosify_iface_config_update(struct blob_attr *ifaces, struct blob_attr *devs);
@@ -77,6 +89,7 @@ void qosify_iface_status(struct blob_buf *b);
void qosify_iface_stop(void);
int qosify_ubus_init(void);
void qosify_ubus_stop(void);
int qosify_ubus_check_interface(const char *name, char *ifname, int ifname_len);
#endif

View File

@@ -1,3 +1,7 @@
// SPDX-License-Identifier: GPL-2.0+
/*
* Copyright (C) 2021 Felix Fietkau <nbd@nbd.name>
*/
#include <libubus.h>
#include "qosify.h"
@@ -46,6 +50,7 @@ enum {
CL_ADD_IPV6,
CL_ADD_TCP_PORT,
CL_ADD_UDP_PORT,
CL_ADD_DNS,
__CL_ADD_MAX
};
@@ -56,6 +61,7 @@ static const struct blobmsg_policy qosify_add_policy[__CL_ADD_MAX] = {
[CL_ADD_IPV6] = { "ipv6", BLOBMSG_TYPE_ARRAY },
[CL_ADD_TCP_PORT] = { "tcp_port", BLOBMSG_TYPE_ARRAY },
[CL_ADD_UDP_PORT] = { "udp_port", BLOBMSG_TYPE_ARRAY },
[CL_ADD_DNS] = { "dns", BLOBMSG_TYPE_ARRAY },
};
@@ -113,6 +119,10 @@ qosify_ubus_add(struct ubus_context *ctx, struct ubus_object *obj,
(ret = qosify_ubus_add_array(cur, dscp, CL_MAP_UDP_PORTS) != 0))
return ret;
if ((cur = tb[CL_ADD_DNS]) != NULL &&
(ret = qosify_ubus_add_array(cur, dscp, CL_MAP_DNS) != 0))
return ret;
qosify_map_timeout = prev_timemout;
return 0;
@@ -139,8 +149,8 @@ static const struct blobmsg_policy qosify_config_policy[__CL_CONFIG_MAX] = {
[CL_CONFIG_RESET] = { "reset", BLOBMSG_TYPE_BOOL },
[CL_CONFIG_FILES] = { "files", BLOBMSG_TYPE_ARRAY },
[CL_CONFIG_TIMEOUT] = { "timeout", BLOBMSG_TYPE_INT32 },
[CL_CONFIG_DSCP_UDP] = { "dscp_default_tcp", BLOBMSG_TYPE_STRING },
[CL_CONFIG_DSCP_TCP] = { "dscp_default_udp", BLOBMSG_TYPE_STRING },
[CL_CONFIG_DSCP_UDP] = { "dscp_default_udp", BLOBMSG_TYPE_STRING },
[CL_CONFIG_DSCP_TCP] = { "dscp_default_tcp", BLOBMSG_TYPE_STRING },
[CL_CONFIG_DSCP_PRIO] = { "dscp_prio", BLOBMSG_TYPE_STRING },
[CL_CONFIG_DSCP_BULK] = { "dscp_bulk", BLOBMSG_TYPE_STRING },
[CL_CONFIG_DSCP_ICMP] = { "dscp_icmp", BLOBMSG_TYPE_STRING },
@@ -254,12 +264,6 @@ qosify_ubus_status(struct ubus_context *ctx, struct ubus_object *obj,
return 0;
}
enum {
CL_DEV_EVENT_NAME,
CL_DEV_EVENT_ADD,
__CL_DEV_EVENT_MAX,
};
static int
qosify_ubus_check_devices(struct ubus_context *ctx, struct ubus_object *obj,
struct ubus_request_data *req, const char *method,
@@ -270,6 +274,48 @@ qosify_ubus_check_devices(struct ubus_context *ctx, struct ubus_object *obj,
return 0;
}
enum {
CL_DNS_HOST_NAME,
CL_DNS_HOST_TYPE,
CL_DNS_HOST_ADDR,
CL_DNS_HOST_TTL,
__CL_DNS_HOST_MAX
};
static const struct blobmsg_policy qosify_dns_policy[__CL_DNS_HOST_MAX] = {
[CL_DNS_HOST_NAME] = { "name", BLOBMSG_TYPE_STRING },
[CL_DNS_HOST_TYPE] = { "type", BLOBMSG_TYPE_STRING },
[CL_DNS_HOST_ADDR] = { "address", BLOBMSG_TYPE_STRING },
[CL_DNS_HOST_TTL] = { "ttl", BLOBMSG_TYPE_INT32 },
};
static int
qosify_ubus_add_dns_host(struct ubus_context *ctx, struct ubus_object *obj,
struct ubus_request_data *req, const char *method,
struct blob_attr *msg)
{
struct blob_attr *tb[__CL_DNS_HOST_MAX];
struct blob_attr *cur;
uint32_t ttl = 0;
blobmsg_parse(qosify_dns_policy, __CL_DNS_HOST_MAX, tb,
blobmsg_data(msg), blobmsg_len(msg));
if (!tb[CL_DNS_HOST_NAME] || !tb[CL_DNS_HOST_TYPE] ||
!tb[CL_DNS_HOST_ADDR])
return UBUS_STATUS_INVALID_ARGUMENT;
if ((cur = tb[CL_DNS_HOST_TTL]) != NULL)
ttl = blobmsg_get_u32(cur);
if (qosify_map_add_dns_host(blobmsg_get_string(tb[CL_DNS_HOST_NAME]),
blobmsg_get_string(tb[CL_DNS_HOST_ADDR]),
blobmsg_get_string(tb[CL_DNS_HOST_TYPE]),
ttl))
return UBUS_STATUS_INVALID_ARGUMENT;
return 0;
}
static const struct ubus_method qosify_methods[] = {
UBUS_METHOD_NOARG("reload", qosify_ubus_reload),
@@ -279,6 +325,7 @@ static const struct ubus_method qosify_methods[] = {
UBUS_METHOD("config", qosify_ubus_config, qosify_config_policy),
UBUS_METHOD_NOARG("dump", qosify_ubus_dump),
UBUS_METHOD_NOARG("status", qosify_ubus_status),
UBUS_METHOD("add_dns_host", qosify_ubus_add_dns_host, qosify_dns_policy),
UBUS_METHOD_NOARG("check_devices", qosify_ubus_check_devices),
};
@@ -308,6 +355,11 @@ int qosify_ubus_init(void)
return 0;
}
void qosify_ubus_stop(void)
{
ubus_auto_shutdown(&conn);
}
struct iface_req {
char *name;
int len;

View File

@@ -39,8 +39,8 @@ delclient() {
TC class del dev $ifb parent 1:1 classid 1:$id
}
ingress=
egress=
ingress=0
egress=0
getrate() {
config_get ssid $1 ssid
@@ -55,12 +55,17 @@ addclient() {
local mac=$2
local ssid=$(cat /tmp/ratelimit.$iface)
egress=$3
ingress=$4
logger "ratelimit: adding client"
config_load ratelimit
config_foreach getrate rate $ssid
[ "$egress" -eq 0 -o $ingress -eq 0 ] && {
config_load ratelimit
config_foreach getrate rate $ssid
}
[ -z "$egress" -o -z $ingress ] && {
[ "$egress" -eq 0 -o $ingress -eq 0 ] && {
logger "ratelimit: no valid rates"
exit 1
}
@@ -146,7 +151,7 @@ addiface() {
waitiface() {
local iface=$1
ubus -t 75 wait_for hostapd.$1
ubus -t 120 wait_for hostapd.$1
[ $? -eq 0 ] || exit 0

View File

@@ -2,7 +2,7 @@
case $2 in
AP-STA-CONNECTED)
ratelimit addclient $1 $3
ratelimit addclient $1 $3 $4 $5
;;
AP-STA-DISCONNECTED)
ratelimit delclient $1 $3

View File

@@ -6,7 +6,7 @@ PKG_RELEASE:=1
PKG_SOURCE_URL=https://github.com/blogic/ucentral-client.git
PKG_SOURCE_PROTO:=git
PKG_SOURCE_DATE:=2021-02-15
PKG_SOURCE_VERSION:=0179c0f98039b0fe6492b6f98e321c7e80dff42d
PKG_SOURCE_VERSION:=e27356216c6baecda9424b81ad90242505e16f08
PKG_LICENSE:=BSD-3-Clause
PKG_MAINTAINER:=John Crispin <john@phrozen.org>

View File

@@ -0,0 +1,14 @@
#!/bin/sh /etc/rc.common
START=99
USE_PROCD=1
PROG=/usr/libexec/ucentral-wdt.sh
start_service() {
active=$(readlink /etc/ucentral/ucentral.active)
[ -n "$active" -a "$active" != "/etc/ucentral/ucentral.cfg.0000000001" ] && return 0
procd_open_instance
procd_set_param command "$PROG"
procd_close_instance
}

View File

@@ -0,0 +1,16 @@
#!/bin/sh
sleep 60
[ -f /etc/ucentral/redirector.json ] || return 0
active=$(ubus call ucentral status | jsonfilter -e '@.active')
[ -n "$active" -a ! "$active" -eq 1 ] && {
logger ucentral-wdt: all good
exit 0
}
logger ucentral-wdt: restarting client
/etc/init.d/ucentral restart

View File

@@ -6,7 +6,7 @@ PKG_RELEASE:=1
PKG_SOURCE_URL=https://github.com/blogic/ucentral-schema.git
PKG_SOURCE_PROTO:=git
PKG_SOURCE_DATE:=2021-02-15
PKG_SOURCE_VERSION:=1bdc8de73f66d5b846cc07c2697959c0cfda6aee
PKG_SOURCE_VERSION:=6d321d65047e1582fffad6034679ecb7aeabed71
PKG_MAINTAINER:=John Crispin <john@phrozen.org>
PKG_LICENSE:=BSD-3-Clause

View File

@@ -102,10 +102,6 @@
"encryption": {
"proto": "none",
"ieee80211w": "optional"
},
"roaming": {
"message-exchange": "ds",
"generate-psk": true
}
}
]

View File

@@ -0,0 +1,107 @@
{
"uuid": 2,
"radios": [
{
"band": "2G",
"country": "CA",
"channel-mode": "HE",
"channel-width": 80,
"channel": 32
}
],
"interfaces": [
{
"name": "WAN",
"role": "upstream",
"services": [ "lldp" ],
"ethernet": [
{
"select-ports": [
"WAN*"
]
}
],
"ipv4": {
"addressing": "dynamic"
},
"ipv6": {
"addressing": "dynamic"
},
"ssids": [
{
"name": "OpenWifi",
"wifi-bands": [
"2G"
],
"bss-mode": "ap",
"encryption": {
"proto": "psk2",
"key": "OpenWifi",
"ieee80211w": "optional"
}
}
]
},
{
"name": "LAN",
"role": "downstream",
"services": [ "ssh", "lldp" ],
"ethernet": [
{
"select-ports": [
"LAN*"
]
}
],
"ipv4": {
"addressing": "static",
"subnet": "192.168.1.1/24",
"dhcp": {
"lease-first": 10,
"lease-count": 100,
"lease-time": "6h"
}
},
"ipv6": {
"addressing": "static",
"dhcpv6": {
"mode": "hybrid"
}
},
"ssids": [
{
"name": "OpenWifi",
"wifi-bands": [
"2G"
],
"bss-mode": "ap",
"encryption": {
"proto": "psk2",
"key": "OpenWifi",
"ieee80211w": "optional"
}
}
]
}
],
"metrics": {
"statistics": {
"interval": 120,
"types": [ "ssids", "lldp", "clients" ]
},
"health": {
"interval": 120
}
},
"services": {
"lldp": {
"describe": "uCentral",
"location": "universe"
},
"ssh": {
"port": 22
}
}
}

View File

@@ -2,14 +2,7 @@
"uuid": 2,
"globals": {
"wireless-multimedia": {
"UP0": [ "DF"],
"UP1": [ "CS1" ],
"UP2": [ "AF11", "AF12", "AF13" ],
"UP3": [ "CS2", "AF21", "AF22", "AF23" ],
"UP4": [ "CS3", "AF31", "AF32", "AF33" ],
"UP5": [ "CS5", "AF41", "AF42", "AF43" ],
"UP6": [ "CS4", "EF" ],
"UP7": [ "CS6" ]
"profile": "rfc8325"
}
},
"radios": [
@@ -110,27 +103,36 @@
"select-ports": [ "WAN" ],
"bandwidth_up": 1000,
"bandwidth_down": 1000,
"bulk-detection": {
"dscp": "CS1",
"packets-per-second": 500
},
"classifier": [
{
"dscp": "CS0",
"dscp": "CS1",
"ports": [
{ "protocol": "any", "port": 53 },
{ "protocol": "tcp", "port": 80 }
],
"dns": [
"telecominfraproject.com"
{ "fqdn": "telecominfraproject.com", "suffix-matching": false }
]
}, {
"dscp": "CS1",
"ports": [
{ "protocol": "any", "port": 53, "range-end": 80 },
{ "protocol": "udp", "port": 80, "reclassify": true }
],
"dscp": "AF41",
"dns": [
"telecominfraproject.com"
{ "fqdn": "zoom.us" }
]
}
]
},
"airtime-fairness": {
"voice-weight": 4,
"packet-threshold": 100,
"bulk-threshold": 50,
"priority-threshold": 30,
"weight-normal": 256,
"weight-priority": 384,
"weight-bulk": 128
}
}
}

View File

@@ -5,6 +5,11 @@
"band": "2G",
"country": "CA",
"channel-mode": "HE",
"channel-width": 40
}, {
"band": "5G",
"country": "CA",
"channel-mode": "HE",
"channel-width": 80
}
],

View File

@@ -6,7 +6,7 @@ PKG_RELEASE:=1
PKG_SOURCE_URL=https://github.com/blogic/ucentral-wifi.git
PKG_SOURCE_PROTO:=git
PKG_SOURCE_DATE:=2021-04-13
PKG_SOURCE_VERSION:=b6dd24f79b14346e767fdda7206ad8c9d851ab35
PKG_SOURCE_VERSION:=b64cd4149388bd6b49852ba37296cb76acaff537
#PKG_MIRROR_HASH:=a8000b3cf43ce9ebfa7305661475fec98ec1dba2dc7b062028c2e17d7c2ec50b
PKG_MAINTAINER:=John Crispin <john@phrozen.org>

View File

@@ -0,0 +1,30 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=udnssnoop
PKG_RELEASE:=1
PKG_LICENSE:=GPL-2.0
PKG_MAINTAINER:=John Crispin <john@phrozen.org>
PKG_SOURCE_URL=https://github.com/blogic/udnssnoop.git
PKG_SOURCE_PROTO:=git
PKG_SOURCE_DATE:=2021-04-12
PKG_SOURCE_VERSION:=852a5246af43d321905979fc850e654718a56061
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/cmake.mk
define Package/udnssnoop
SECTION:=net
CATEGORY:=Network
TITLE:=DNS Snooping Daemon
DEPENDS:=+libubox +libubus
endef
define Package/udnssnoop/install
$(INSTALL_DIR) $(1)/usr/sbin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/udnssnoop $(1)/usr/sbin/
$(CP) ./files/* $(1)
endef
$(eval $(call BuildPackage,udnssnoop))

View File

@@ -0,0 +1,24 @@
#!/bin/sh /etc/rc.common
START=80
USE_PROCD=1
PROG=/usr/sbin/udnssnoop
service_triggers() {
procd_add_reload_trigger qosify
}
start_service() {
local device=$(uci get qosify.@device[0].name)
[ -z "$device" ] && return
procd_open_instance
procd_set_param command "$PROG" $device
procd_set_param respawn
procd_close_instance
}
reload_service() {
restart
}

View File

@@ -31,7 +31,8 @@ ALLWIFIBOARDS:= \
edgecore-eap101 \
sercomm-wallaby \
edgecore-eap102 \
wallys-dr6018
wallys-dr6018 \
wallys-dr6018-v4 \
tplink-ex227 \
tplink-ex447
@@ -134,6 +135,7 @@ $(eval $(call generate-ath11k-wifi-package,cig-wf194c,Cigtech WF194c))
$(eval $(call generate-ath11k-wifi-package,cig-wf194c4,Cigtech WF194c4))
$(eval $(call generate-ath11k-wifi-package,sercomm-wallaby,Sercomm Kiwi))
$(eval $(call generate-ath11k-wifi-package,wallys-dr6018,Wallys DR6018))
$(eval $(call generate-ath11k-wifi-package,wallys-dr6018-v4,Wallys DR6018 V4))
$(eval $(call generate-ath11k-wifi-package,edgecore-eap101,EdgeCore EAP101))
$(eval $(call generate-ath11k-wifi-package,edgecore-eap102,Edgecore EAP102))
$(eval $(call generate-ath11k-wifi-package,tplink-ex227,TP-Link EX227))

Binary file not shown.

View File

@@ -114,6 +114,7 @@ hostapd_common_add_device_config() {
config_add_int airtime_mode
config_add_boolean multiple_bssid rnr_beacon he_co_locate ema
hostapd_add_log_config
}
@@ -125,7 +126,8 @@ hostapd_prepare_device_config() {
json_get_vars country country3 country_ie beacon_int:100 dtim_period:2 doth require_mode legacy_rates \
acs_chan_bias local_pwr_constraint spectrum_mgmt_required airtime_mode cell_density \
rts_threshold beacon_rate rssi_reject_assoc_rssi rssi_ignore_probe_request maxassoc
rts_threshold beacon_rate rssi_reject_assoc_rssi rssi_ignore_probe_request maxassoc \
multiple_bssid he_co_locate rnr_beacon ema
hostapd_set_log_options base_cfg
@@ -135,6 +137,10 @@ hostapd_prepare_device_config() {
set_default legacy_rates 0
set_default airtime_mode 0
set_default cell_density 0
set_default he_co_locate 0
set_default rnr_beacon 0
set_default multiple_bssid 0
set_default ema 0
[ -n "$country" ] && {
append base_cfg "country_code=$country" "$N"
@@ -227,6 +233,10 @@ hostapd_prepare_device_config() {
append base_cfg "dtim_period=$dtim_period" "$N"
[ "$airtime_mode" -gt 0 ] && append base_cfg "airtime_mode=$airtime_mode" "$N"
[ -n "$maxassoc" ] && append base_cfg "iface_max_num_sta=$maxassoc" "$N"
[ "$rnr_beacon" -gt 0 ] && append base_cfg "rnr_beacon=$rnr_beacon" "$N"
[ "$he_co_locate" -gt 0 ] && append base_cfg "he_co_locate=$he_co_locate" "$N"
[ "$multiple_bssid" -gt 0 ] && append base_cfg "multiple_bssid=$multiple_bssid" "$N"
[ "$ema" -gt 0 ] && append base_cfg "ema=$ema" "$N"
json_get_values opts hostapd_options
for val in $opts; do
@@ -363,6 +373,8 @@ hostapd_common_add_bss_config() {
config_add_int eap_server
config_add_string eap_user_file ca_cert server_cert private_key private_key_passwd server_id
config_add_boolean ratelimit
}
hostapd_set_vlan_file() {
@@ -1003,8 +1015,13 @@ hostapd_set_bss_options() {
[ -n "$iw_anqp_3gpp_cell_net_conf" ] && \
append bss_conf "anqp_3gpp_cell_net=$iw_anqp_3gpp_cell_net_conf" "$N"
fi
[ -n "$iw_qos_map_set" ] && append bss_conf "qos_map_set=$iw_qos_map_set" "$N"
set_default iw_qos_map_set 0,0,2,16,1,1,255,255,18,22,24,38,40,40,44,46,48,56
case "$iw_qos_map_set" in
*,*);;
*) iw_qos_map_set="";;
esac
[ -n "$iw_qos_map_set" ] && append bss_conf "qos_map_set=$iw_qos_map_set" "$N"
local hs20 disable_dgaf osen anqp_domain_id hs20_deauth_req_timeout \
osu_ssid hs20_wan_metrics hs20_operating_class hs20_t_c_filename hs20_t_c_timestamp \

View File

@@ -0,0 +1,126 @@
Index: hostapd-2021-02-20-59e9794c/src/ap/ieee802_1x.c
===================================================================
--- hostapd-2021-02-20-59e9794c.orig/src/ap/ieee802_1x.c
+++ hostapd-2021-02-20-59e9794c/src/ap/ieee802_1x.c
@@ -1904,6 +1904,25 @@ static int ieee802_1x_update_vlan(struct
}
#endif /* CONFIG_NO_VLAN */
+static int ieee802_1x_update_wispr(struct hostapd_data *hapd,
+ struct sta_info *sta,
+ struct radius_msg *msg)
+{
+ memset(sta->bandwidth, 0, sizeof(sta->bandwidth));
+
+ if (radius_msg_get_wispr(msg, &sta->bandwidth))
+ return 0;
+
+ if (!sta->bandwidth[0] && !sta->bandwidth[1])
+ return 0;
+
+ hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE8021X,
+ HOSTAPD_LEVEL_INFO,
+ "received wispr bandwidth from RADIUS server %d/%d",
+ sta->bandwidth[0], sta->bandwidth[1]);
+
+ return 0;
+}
/**
* ieee802_1x_receive_auth - Process RADIUS frames from Authentication Server
@@ -2029,6 +2048,7 @@ ieee802_1x_receive_auth(struct radius_ms
ieee802_1x_check_hs20(hapd, sta, msg,
session_timeout_set ?
(int) session_timeout : -1);
+ ieee802_1x_update_wispr(hapd, sta, msg);
break;
case RADIUS_CODE_ACCESS_REJECT:
sm->eap_if->aaaFail = true;
Index: hostapd-2021-02-20-59e9794c/src/ap/sta_info.h
===================================================================
--- hostapd-2021-02-20-59e9794c.orig/src/ap/sta_info.h
+++ hostapd-2021-02-20-59e9794c/src/ap/sta_info.h
@@ -117,6 +117,7 @@ struct sta_info {
u8 supported_rates[WLAN_SUPP_RATES_MAX];
int supported_rates_len;
u8 qosinfo; /* Valid when WLAN_STA_WMM is set */
+ u32 bandwidth[2];
#ifdef CONFIG_MESH
enum mesh_plink_state plink_state;
Index: hostapd-2021-02-20-59e9794c/src/radius/radius.c
===================================================================
--- hostapd-2021-02-20-59e9794c.orig/src/radius/radius.c
+++ hostapd-2021-02-20-59e9794c/src/radius/radius.c
@@ -1182,6 +1182,35 @@ radius_msg_get_cisco_keys(struct radius_
return keys;
}
+#define RADIUS_VENDOR_ID_WISPR 14122
+#define RADIUS_WISPR_AV_BW_UP 7
+#define RADIUS_WISPR_AV_BW_DOWN 8
+
+int
+radius_msg_get_wispr(struct radius_msg *msg, u32 *bandwidth)
+{
+ int i;
+
+ if (msg == NULL || bandwidth == NULL)
+ return 1;
+
+ for (i = 0; i < 2; i++) {
+ size_t keylen;
+ u8 *key;
+
+ key = radius_msg_get_vendor_attr(msg, RADIUS_VENDOR_ID_WISPR,
+ RADIUS_WISPR_AV_BW_UP + i, &keylen);
+ if (!key)
+ continue;
+
+ if (keylen == 4)
+ bandwidth[i] = ntohl(*((u32 *)key));
+ os_free(key);
+ }
+
+ return 0;
+}
+
int radius_msg_add_mppe_keys(struct radius_msg *msg,
const u8 *req_authenticator,
Index: hostapd-2021-02-20-59e9794c/src/radius/radius.h
===================================================================
--- hostapd-2021-02-20-59e9794c.orig/src/radius/radius.h
+++ hostapd-2021-02-20-59e9794c/src/radius/radius.h
@@ -205,6 +205,10 @@ enum {
RADIUS_VENDOR_ATTR_WFA_HS20_T_C_URL = 10,
};
+#define RADIUS_VENDOR_ID_WISPR 14122
+#define RADIUS_WISPR_AV_BW_UP 7
+#define RADIUS_WISPR_AV_BW_DOWN 8
+
#ifdef _MSC_VER
#pragma pack(pop)
#endif /* _MSC_VER */
@@ -277,6 +281,7 @@ radius_msg_get_ms_keys(struct radius_msg
struct radius_ms_mppe_keys *
radius_msg_get_cisco_keys(struct radius_msg *msg, struct radius_msg *sent_msg,
const u8 *secret, size_t secret_len);
+int radius_msg_get_wispr(struct radius_msg *msg, u32 *bandwidth);
int radius_msg_add_mppe_keys(struct radius_msg *msg,
const u8 *req_authenticator,
const u8 *secret, size_t secret_len,
Index: hostapd-2021-02-20-59e9794c/src/ap/sta_info.c
===================================================================
--- hostapd-2021-02-20-59e9794c.orig/src/ap/sta_info.c
+++ hostapd-2021-02-20-59e9794c/src/ap/sta_info.c
@@ -1292,7 +1292,7 @@ void ap_sta_set_authorized(struct hostap
MAC2STR(sta->addr), MAC2STR(dev_addr));
else
#endif /* CONFIG_P2P */
- os_snprintf(buf, sizeof(buf), MACSTR, MAC2STR(sta->addr));
+ os_snprintf(buf, sizeof(buf), MACSTR " %d %d", MAC2STR(sta->addr), sta->bandwidth[0] / 1000, sta->bandwidth[1] / 1000);
if (hapd->sta_authorized_cb)
hapd->sta_authorized_cb(hapd->sta_authorized_cb_ctx,

View File

@@ -59,9 +59,9 @@ config-$(call config_package,ath10k) += ATH10K ATH10K_PCI
config-$(call config_package,ath11k) += ATH11K ATH11K_AHB ATH11K_SPECTRAL ATH11K_DEBUG
config-$(call config_package,ath11k-pci) += ATH11K_PCI
ifeq ($(CONFIG_KERNEL_IPQ_MEM_PROFILE),512)
#config-y += ATH11K_MEM_PROFILE_512M
endif
#ifeq ($(CONFIG_KERNEL_IPQ_MEM_PROFILE),512)
config-y += ATH11K_MEM_PROFILE_512M
#endif
config-$(call config_package,ath5k) += ATH5K
ifdef CONFIG_TARGET_ath25

View File

@@ -53,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 \
@@ -294,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 \
@@ -334,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" ] && \
@@ -499,6 +515,7 @@ mac80211_get_addr() {
mac80211_generate_mac() {
local phy="$1"
local multiple_bssid="$2"
local id="${macidx:-0}"
local ref="$(cat /sys/class/ieee80211/${phy}/macaddress)"
@@ -522,7 +539,10 @@ mac80211_generate_mac() {
local mask6=$6
local oIFS="$IFS"; IFS=":"; set -- $ref; IFS="$oIFS"
[ "$multiple_bssid" -eq 1 ] && {
printf "02:%s:%s:%s:%s:%02x" $b1 $2 $3 $4 $5 $macidx
return
}
macidx=$(($id + 1))
local use_global=0
@@ -635,6 +655,7 @@ mac80211_iw_interface_add() {
}
mac80211_prepare_vif() {
local multiple_bssid=$1
json_select config
json_get_vars ifname mode ssid wds powersave macaddr enable wpa_psk_file vlan_file
@@ -648,7 +669,7 @@ mac80211_prepare_vif() {
json_select ..
[ -n "$macaddr" ] || {
macaddr="$(mac80211_generate_mac $phy)"
macaddr="$(mac80211_generate_mac $phy $multiple_bssid)"
macidx="$(($macidx + 1))"
}
@@ -1017,6 +1038,7 @@ drv_mac80211_setup() {
txpower antenna_gain \
rxantenna txantenna \
frag rts beacon_int:100 htmode \
multiple_bssid:0 \
num_global_macaddr
json_get_values basic_rate_list basic_rate
json_get_values scan_list scan_list
@@ -1111,7 +1133,7 @@ drv_mac80211_setup() {
mac80211_prepare_iw_htmode
for_each_interface "sta adhoc mesh monitor" mac80211_prepare_vif
NEWAPLIST=
for_each_interface "ap" mac80211_prepare_vif
for_each_interface "ap" mac80211_prepare_vif ${multiple_bssid}
NEW_MD5=$(test -e "${hostapd_conf_file}" && md5sum ${hostapd_conf_file})
OLD_MD5=$(uci -q -P /var/state get wireless._${phy}.md5)
if [ "${NEWAPLIST}" != "${OLDAPLIST}" ]; then

View File

@@ -0,0 +1,31 @@
From: Sven Eckelmann <sven@narfation.org>
Date: Tue, 22 Sep 2020 11:05:12 +0200
Subject: ath11k: Disable intersection of regd from BDF/firmware
We definitely don't want to use an arbitrary default domain which is
intersected with each other. Instead, the each reported regulary domain
from the device should be handled independently.
Signed-off-by: Sven Eckelmann <sven@narfation.org>
diff --git a/drivers/net/wireless/ath/ath11k/wmi.c b/drivers/net/wireless/ath/ath11k/wmi.c
index 54617c0e5484700939417abaa6652524dda29c36..ad31e709fc78978376178a38ef4ca51d6b6c8ebe 100644
--- a/drivers/net/wireless/ath/ath11k/wmi.c
+++ b/drivers/net/wireless/ath/ath11k/wmi.c
@@ -7207,16 +7207,6 @@ static int ath11k_reg_chan_list_event(struct ath11k_base *ab, struct sk_buff *sk
(char *)reg_info->alpha2, 2))
goto mem_free;
- /* Intersect new rules with default regd if a new country setting was
- * requested, i.e a default regd was already set during initialization
- * and the regd coming from this event has a valid country info.
- */
- if (ab->default_regd[pdev_idx] &&
- !ath11k_reg_is_world_alpha((char *)
- ab->default_regd[pdev_idx]->alpha2) &&
- !ath11k_reg_is_world_alpha((char *)reg_info->alpha2))
- intersect = true;
-
regd = ath11k_reg_build_regd(ab, reg_info, intersect);
if (!regd) {
ath11k_warn(ab, "failed to build regd from reg_info\n");

View File

@@ -0,0 +1,85 @@
From: Sven Eckelmann <sven@narfation.org>
Date: Fri, 30 Oct 2020 12:02:21 +0100
Subject: ath11k: Accept new regdomain during initialization
The driver is registering as iee80211_hw with its OPs and is then able to
be called by the upper layer. This for example happens early in the phase
when the correct regulary domain should be set. But the regulary domain
will only be accepted when the ATH11K_FLAG_REGISTERED flag was set after
the ATH11K_QMI_EVENT_FW_READY was processed. So it can easily happen that
the regularly domain is not correctly processed when
ATH11K_QMI_EVENT_FW_READY isn't handled immediately:
$ iw reg set CA
$ iw reg get|grep country
country CA: DFS-FCC
country CA: DFS-FCC
country CA: DFS-FCC
$ echo "c000000.wifi1" > /sys/bus/platform/drivers/ath11k/unbind
$ echo "c000000.wifi1" > /sys/bus/platform/drivers/ath11k/bind
$ iw reg get|grep country
country CA: DFS-FCC
country US: DFS-FCC
country US: DFS-FCC
It is therefore essential to accept the regulatory changes without having
seen the ATH11K_QMI_EVENT_FW_READY. And since there are also potentially
more problems in ath11k_debug_pdev_create, ath11k_mac_register and
ath11k_mac_allocate with their use of ATH11K_FLAG_REGISTERED, it is better
to move the ATH11K_QMI_EVENT_FW_READY. to a new flag.
Tested with WLAN.HK.2.4.0.1.r1-00019-QCAHKSWPL_SILICONZ-1
Fixes: d5c65159f289 ("ath11k: driver for Qualcomm IEEE 802.11ax devices")
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Forwarded: https://lore.kernel.org/all/1829665.1PRlr7bOQj@ripper/
diff --git a/drivers/net/wireless/ath/ath11k/core.h b/drivers/net/wireless/ath/ath11k/core.h
index 63a9f47146fe6dec0942176c04437e7900b05efe..2585518cb1a853bbae3b59af93a3bd3e1310f646 100644
--- a/drivers/net/wireless/ath/ath11k/core.h
+++ b/drivers/net/wireless/ath/ath11k/core.h
@@ -208,7 +208,7 @@ enum ath11k_scan_state {
enum ath11k_dev_flags {
ATH11K_CAC_RUNNING,
- ATH11K_FLAG_CORE_REGISTERED,
+ ATH11K_FLAG_FW_READY,
ATH11K_FLAG_CRASH_FLUSH,
ATH11K_FLAG_RAW_MODE,
ATH11K_FLAG_HW_CRYPTO_DISABLED,
diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/ath/ath11k/mac.c
index 9beda3b94da5d28af53eb25c287a24c41bc6285c..6f0d830dc7c946351b642af9444b12ed82bec558 100644
--- a/drivers/net/wireless/ath/ath11k/mac.c
+++ b/drivers/net/wireless/ath/ath11k/mac.c
@@ -9385,6 +9385,8 @@ static int __ath11k_mac_register(struct ath11k *ar)
goto err_free_if_combs;
}
+ set_bit(ATH11K_FLAG_REGISTERED, &ab->dev_flags);
+
if (!ab->hw_params.supports_monitor)
/* There's a race between calling ieee80211_register_hw()
* and here where the monitor mode is enabled for a little
diff --git a/drivers/net/wireless/ath/ath11k/qmi.c b/drivers/net/wireless/ath/ath11k/qmi.c
index f9a8f96e7d31b404d6b47d12cc37a885fb55f764..f3dd4604db2e4c834238e306ad20194f253fe432 100644
--- a/drivers/net/wireless/ath/ath11k/qmi.c
+++ b/drivers/net/wireless/ath/ath11k/qmi.c
@@ -4465,7 +4465,7 @@ static void ath11k_qmi_driver_event_work(struct work_struct *work)
break;
case ATH11K_QMI_EVENT_FW_READY:
clear_bit(ATH11K_FLAG_QMI_FAIL, &ab->dev_flags);
- if (test_bit(ATH11K_FLAG_REGISTERED, &ab->dev_flags)) {
+ if (test_bit(ATH11K_FLAG_FW_READY, &ab->dev_flags)) {
ath11k_hal_dump_srng_stats(ab);
queue_work(ab->workqueue, &ab->restart_work);
break;
@@ -4487,7 +4487,7 @@ static void ath11k_qmi_driver_event_work(struct work_struct *work)
}
ath11k_core_qmi_firmware_ready(ab);
- set_bit(ATH11K_FLAG_REGISTERED, &ab->dev_flags);
+ set_bit(ATH11K_FLAG_FW_READY, &ab->dev_flags);
}
break;

View File

@@ -0,0 +1,60 @@
From: Joe Stefek <jstefek@datto.com>
Date: Tue, 15 Sep 2020 08:44:21 -0700
Subject: Drop regd patch which prevents changing reg domain on system with vdevs.
diff --git a/drivers/net/wireless/ath/ath11k/reg.c b/drivers/net/wireless/ath/ath11k/reg.c
index 03e2a5ca60dcde2173f1abf10d10d1648f0ba29d..b83d89c1af33073c25e2877557d947895ef9537d 100644
--- a/drivers/net/wireless/ath/ath11k/reg.c
+++ b/drivers/net/wireless/ath/ath11k/reg.c
@@ -41,37 +41,6 @@ static bool ath11k_regdom_changes(struct ath11k *ar, char *alpha2)
return memcmp(regd->alpha2, alpha2, 2) != 0;
}
-static bool ath11k_reg_validate_pdev_state(struct ath11k* ar)
-{
- struct ath11k_base *ab = ar->ab;
- struct ath11k_pdev *pdev;
- struct ath11k* tmp_ar;
- int i;
-
- rcu_read_lock();
- for (i = 0; i < ab->num_radios; i++) {
- pdev = rcu_dereference(ab->pdevs_active[i]);
- if (!pdev)
- continue;
-
- tmp_ar = pdev->ar;
- if (tmp_ar) {
- mutex_lock(&tmp_ar->conf_mutex);
- if (tmp_ar->num_started_vdevs) {
- if (tmp_ar == ar)
- ath11k_warn(ab, "%s has active interface, please bring down to set country code",
- wiphy_name(ar->hw->wiphy));
- mutex_unlock(&tmp_ar->conf_mutex);
- rcu_read_unlock();
- return false;
- }
- mutex_unlock(&tmp_ar->conf_mutex);
- }
- }
- rcu_read_unlock();
- return true;
-}
-
static void
ath11k_reg_notifier(struct wiphy *wiphy, struct regulatory_request *request)
{
@@ -105,13 +74,6 @@ ath11k_reg_notifier(struct wiphy *wiphy, struct regulatory_request *request)
return;
}
- /* The SET_INIT_COUNTRY command should not be sent to firmware while any vdev is active.
- * Also it does not make sense to give the command for certain pdev's alone.
- * Hence check all the pdev's if any have an active vdev before sending the command.
- */
- if (!ath11k_reg_validate_pdev_state(ar))
- return;
-
/* Set the country code to the firmware and wait for
* the WMI_REG_CHAN_LIST_CC EVENT for updating the
* reg info

View File

@@ -0,0 +1,278 @@
From patchwork Fri Nov 12 15:31:16 2021
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Sven Eckelmann <sven@narfation.org>
X-Patchwork-Id: 12616993
X-Patchwork-Delegate: kvalo@adurom.com
Return-Path: <linux-wireless-owner@kernel.org>
X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on
aws-us-west-2-korg-lkml-1.web.codeaurora.org
Received: from mail.kernel.org (mail.kernel.org [198.145.29.99])
by smtp.lore.kernel.org (Postfix) with ESMTP id 721EAC433F5
for <linux-wireless@archiver.kernel.org>;
Fri, 12 Nov 2021 15:32:26 +0000 (UTC)
Received: from vger.kernel.org (vger.kernel.org [23.128.96.18])
by mail.kernel.org (Postfix) with ESMTP id 4E73F60C40
for <linux-wireless@archiver.kernel.org>;
Fri, 12 Nov 2021 15:32:26 +0000 (UTC)
Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand
id S230182AbhKLPfQ (ORCPT
<rfc822;linux-wireless@archiver.kernel.org>);
Fri, 12 Nov 2021 10:35:16 -0500
Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56078 "EHLO
lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
with ESMTP id S229509AbhKLPfP (ORCPT
<rfc822;linux-wireless@vger.kernel.org>);
Fri, 12 Nov 2021 10:35:15 -0500
Received: from dvalin.narfation.org (dvalin.narfation.org
[IPv6:2a00:17d8:100::8b1])
by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C3035C061766
for <linux-wireless@vger.kernel.org>;
Fri, 12 Nov 2021 07:32:24 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=narfation.org;
s=20121; t=1636731141;
h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
to:to:cc:cc:mime-version:mime-version:
content-transfer-encoding:content-transfer-encoding;
bh=oHqfDu/AzlIIJ7kJWRvWS79eoKm0cbRICNb1jk+xitA=;
b=QcxgTgtUlyXNy5WQL+HLDH08b/xtVIevhpQATuhOx1ydUSKdszhvhpZwXwoQO6YajcE44M
ZxrForTEDSbDg0ewdn/v6X0/tUqzAFbLruW76huN+w/XEO2/egNP0LiAxknVbhFwgf0rX8
s4RipvwxFT/ecJd/iL80lK1oLkTVeSg=
From: Sven Eckelmann <sven@narfation.org>
To: ath11k@lists.infradead.org
Cc: linux-wireless@vger.kernel.org, Sven Eckelmann <sven@narfation.org>
Subject: [PATCH] ath11k: Fix ETSI regd with weather radar overlap
Date: Fri, 12 Nov 2021 16:31:16 +0100
Message-Id: <20211112153116.1214421-1-sven@narfation.org>
X-Mailer: git-send-email 2.30.2
MIME-Version: 1.0
Precedence: bulk
List-ID: <linux-wireless.vger.kernel.org>
X-Mailing-List: linux-wireless@vger.kernel.org
Some ETSI countries have a small overlap in the wireless-regdb with an ETSI
channel (5590-5650). A good example is Australia:
country AU: DFS-ETSI
(2400 - 2483.5 @ 40), (36)
(5150 - 5250 @ 80), (23), NO-OUTDOOR, AUTO-BW
(5250 - 5350 @ 80), (20), NO-OUTDOOR, AUTO-BW, DFS
(5470 - 5600 @ 80), (27), DFS
(5650 - 5730 @ 80), (27), DFS
(5730 - 5850 @ 80), (36)
(57000 - 66000 @ 2160), (43), NO-OUTDOOR
If the firmware (or the BDF) is shipped with these rules then there is only
a 10 MHz overlap with the weather radar:
* below: 5470 - 5590
* weather radar: 5590 - 5600
* above: (none for the rule "5470 - 5600 @ 80")
There are several wrong assumption in the ath11k code:
* there is always a valid range below the weather radar
(actually: there could be no range below the weather radar range OR range
could be smaller than 20 MHz)
* intersected range in the weather radar range is valid
(actually: the range could be smaller than 20 MHz)
* range above weather radar is either empty or valid
(actually: the range could be smaller than 20 MHz)
These wrong assumption will lead in this example to a rule
(5590 - 5600 @ 20), (N/A, 27), (600000 ms), DFS, AUTO-BW
which is invalid according to is_valid_reg_rule() because the freq_diff is
only 10 MHz but the max_bandwidth is set to 20 MHz. Which results in a
rejection like:
WARNING: at backports-20210222_001-4.4.60-b157d2276/net/wireless/reg.c:3984
[...]
Call trace:
[<ffffffbffc3d2e50>] reg_get_max_bandwidth+0x300/0x3a8 [cfg80211]
[<ffffffbffc3d3d0c>] regulatory_set_wiphy_regd_sync+0x3c/0x98 [cfg80211]
[<ffffffbffc651598>] ath11k_regd_update+0x1a8/0x210 [ath11k]
[<ffffffbffc652108>] ath11k_regd_update_work+0x18/0x20 [ath11k]
[<ffffffc0000a93e0>] process_one_work+0x1f8/0x340
[<ffffffc0000a9784>] worker_thread+0x25c/0x448
[<ffffffc0000aedc8>] kthread+0xd0/0xd8
[<ffffffc000085550>] ret_from_fork+0x10/0x40
ath11k c000000.wifi: failed to perform regd update : -22
Invalid regulatory domain detected
To avoid this, the algorithm has to be changed slightly. Instead of
splitting a rule which overlaps with the weather radar range into 3 pieces
and accepting the first two parts blindly, it must actually be checked for
each piece whether it is a valid range. And only if it is valid, add it to
the output array.
When these checks are in place, the processed rules for AU would end up as
country AU: DFS-ETSI
(2400 - 2483 @ 40), (N/A, 36), (N/A)
(5150 - 5250 @ 80), (6, 23), (N/A), NO-OUTDOOR, AUTO-BW
(5250 - 5350 @ 80), (6, 20), (0 ms), NO-OUTDOOR, DFS, AUTO-BW
(5470 - 5590 @ 80), (6, 27), (0 ms), DFS, AUTO-BW
(5650 - 5730 @ 80), (6, 27), (0 ms), DFS, AUTO-BW
(5730 - 5850 @ 80), (6, 36), (N/A), AUTO-BW
and will be accepted by the wireless regulatory code.
Fixes: d5c65159f289 ("ath11k: driver for Qualcomm IEEE 802.11ax devices")
Signed-off-by: Sven Eckelmann <sven@narfation.org>
---
drivers/net/wireless/ath/ath11k/reg.c | 103 ++++++++++++++------------
1 file changed, 56 insertions(+), 47 deletions(-)
diff --git a/drivers/net/wireless/ath/ath11k/reg.c b/drivers/net/wireless/ath/ath11k/reg.c
index a66b5bdd2167..8606170ba80d 100644
--- a/drivers/net/wireless/ath/ath11k/reg.c
+++ b/drivers/net/wireless/ath/ath11k/reg.c
@@ -456,6 +456,9 @@ ath11k_reg_adjust_bw(u16 start_freq, u16 end_freq, u16 max_bw)
{
u16 bw;
+ if (end_freq <= start_freq)
+ return 0;
+
bw = end_freq - start_freq;
bw = min_t(u16, bw, max_bw);
@@ -463,8 +466,10 @@ ath11k_reg_adjust_bw(u16 start_freq, u16 end_freq, u16 max_bw)
bw = 80;
else if (bw >= 40 && bw < 80)
bw = 40;
- else if (bw < 40)
+ else if (bw >= 20 && bw < 40)
bw = 20;
+ else
+ bw = 0;
return bw;
}
@@ -488,73 +493,77 @@ ath11k_reg_update_weather_radar_band(struct ath11k_base *ab,
struct cur_reg_rule *reg_rule,
u8 *rule_idx, u32 flags, u16 max_bw)
{
+ u32 start_freq;
u32 end_freq;
u16 bw;
u8 i;
i = *rule_idx;
+ /* there might be situations when even the input rule must be dropped */
+ i--;
+
+ /* frequencies below weather radar */
bw = ath11k_reg_adjust_bw(reg_rule->start_freq,
ETSI_WEATHER_RADAR_BAND_LOW, max_bw);
+ if (bw > 0) {
+ i++;
- ath11k_reg_update_rule(regd->reg_rules + i, reg_rule->start_freq,
- ETSI_WEATHER_RADAR_BAND_LOW, bw,
- reg_rule->ant_gain, reg_rule->reg_power,
- flags);
+ ath11k_reg_update_rule(regd->reg_rules + i,
+ reg_rule->start_freq,
+ ETSI_WEATHER_RADAR_BAND_LOW, bw,
+ reg_rule->ant_gain, reg_rule->reg_power,
+ flags);
- ath11k_dbg(ab, ATH11K_DBG_REG,
- "\t%d. (%d - %d @ %d) (%d, %d) (%d ms) (FLAGS %d)\n",
- i + 1, reg_rule->start_freq, ETSI_WEATHER_RADAR_BAND_LOW,
- bw, reg_rule->ant_gain, reg_rule->reg_power,
- regd->reg_rules[i].dfs_cac_ms,
- flags);
-
- if (reg_rule->end_freq > ETSI_WEATHER_RADAR_BAND_HIGH)
- end_freq = ETSI_WEATHER_RADAR_BAND_HIGH;
- else
- end_freq = reg_rule->end_freq;
+ ath11k_dbg(ab, ATH11K_DBG_REG,
+ "\t%d. (%d - %d @ %d) (%d, %d) (%d ms) (FLAGS %d)\n",
+ i + 1, reg_rule->start_freq,
+ ETSI_WEATHER_RADAR_BAND_LOW, bw, reg_rule->ant_gain,
+ reg_rule->reg_power, regd->reg_rules[i].dfs_cac_ms,
+ flags);
+ }
- bw = ath11k_reg_adjust_bw(ETSI_WEATHER_RADAR_BAND_LOW, end_freq,
- max_bw);
+ /* weather radar frequencies */
+ start_freq = max_t(u32, reg_rule->start_freq,
+ ETSI_WEATHER_RADAR_BAND_LOW);
+ end_freq = min_t(u32, reg_rule->end_freq, ETSI_WEATHER_RADAR_BAND_HIGH);
- i++;
+ bw = ath11k_reg_adjust_bw(start_freq, end_freq, max_bw);
+ if (bw > 0) {
+ i++;
- ath11k_reg_update_rule(regd->reg_rules + i,
- ETSI_WEATHER_RADAR_BAND_LOW, end_freq, bw,
- reg_rule->ant_gain, reg_rule->reg_power,
- flags);
+ ath11k_reg_update_rule(regd->reg_rules + i, start_freq,
+ end_freq, bw, reg_rule->ant_gain,
+ reg_rule->reg_power, flags);
- regd->reg_rules[i].dfs_cac_ms = ETSI_WEATHER_RADAR_BAND_CAC_TIMEOUT;
+ regd->reg_rules[i].dfs_cac_ms = ETSI_WEATHER_RADAR_BAND_CAC_TIMEOUT;
- ath11k_dbg(ab, ATH11K_DBG_REG,
- "\t%d. (%d - %d @ %d) (%d, %d) (%d ms) (FLAGS %d)\n",
- i + 1, ETSI_WEATHER_RADAR_BAND_LOW, end_freq,
- bw, reg_rule->ant_gain, reg_rule->reg_power,
- regd->reg_rules[i].dfs_cac_ms,
- flags);
-
- if (end_freq == reg_rule->end_freq) {
- regd->n_reg_rules--;
- *rule_idx = i;
- return;
+ ath11k_dbg(ab, ATH11K_DBG_REG,
+ "\t%d. (%d - %d @ %d) (%d, %d) (%d ms) (FLAGS %d)\n",
+ i + 1, start_freq, end_freq, bw,
+ reg_rule->ant_gain, reg_rule->reg_power,
+ regd->reg_rules[i].dfs_cac_ms, flags);
}
+ /* frequencies above weather radar */
bw = ath11k_reg_adjust_bw(ETSI_WEATHER_RADAR_BAND_HIGH,
reg_rule->end_freq, max_bw);
+ if (bw > 0) {
+ i++;
- i++;
-
- ath11k_reg_update_rule(regd->reg_rules + i, ETSI_WEATHER_RADAR_BAND_HIGH,
- reg_rule->end_freq, bw,
- reg_rule->ant_gain, reg_rule->reg_power,
- flags);
+ ath11k_reg_update_rule(regd->reg_rules + i,
+ ETSI_WEATHER_RADAR_BAND_HIGH,
+ reg_rule->end_freq, bw,
+ reg_rule->ant_gain, reg_rule->reg_power,
+ flags);
- ath11k_dbg(ab, ATH11K_DBG_REG,
- "\t%d. (%d - %d @ %d) (%d, %d) (%d ms) (FLAGS %d)\n",
- i + 1, ETSI_WEATHER_RADAR_BAND_HIGH, reg_rule->end_freq,
- bw, reg_rule->ant_gain, reg_rule->reg_power,
- regd->reg_rules[i].dfs_cac_ms,
- flags);
+ ath11k_dbg(ab, ATH11K_DBG_REG,
+ "\t%d. (%d - %d @ %d) (%d, %d) (%d ms) (FLAGS %d)\n",
+ i + 1, ETSI_WEATHER_RADAR_BAND_HIGH,
+ reg_rule->end_freq, bw, reg_rule->ant_gain,
+ reg_rule->reg_power, regd->reg_rules[i].dfs_cac_ms,
+ flags);
+ }
*rule_idx = i;
}

View File

@@ -1,33 +0,0 @@
Index: backports-20210222_001-4.4.60-b157d2276/drivers/net/wireless/ath/ath11k/reg.c
===================================================================
--- backports-20210222_001-4.4.60-b157d2276.orig/drivers/net/wireless/ath/ath11k/reg.c
+++ backports-20210222_001-4.4.60-b157d2276/drivers/net/wireless/ath/ath11k/reg.c
@@ -170,6 +170,9 @@ int ath11k_regd_update(struct ath11k *ar
}
} else {
regd = ab->new_regd[pdev_id];
+ /* force update custom regdm to cfg80211 */
+ ar->hw->wiphy->regulatory_flags |= REGULATORY_CUSTOM_REG;
+ wiphy_apply_custom_regulatory(ar->hw->wiphy, regd);
}
if (!regd) {
Index: backports-20210222_001-4.4.60-b157d2276/drivers/net/wireless/ath/ath11k/wmi.c
===================================================================
--- backports-20210222_001-4.4.60-b157d2276.orig/drivers/net/wireless/ath/ath11k/wmi.c
+++ backports-20210222_001-4.4.60-b157d2276/drivers/net/wireless/ath/ath11k/wmi.c
@@ -7212,12 +7212,12 @@ static int ath11k_reg_chan_list_event(st
* requested, i.e a default regd was already set during initialization
* and the regd coming from this event has a valid country info.
*/
- if (ab->default_regd[pdev_idx] &&
+/* if (ab->default_regd[pdev_idx] &&
!ath11k_reg_is_world_alpha((char *)
ab->default_regd[pdev_idx]->alpha2) &&
!ath11k_reg_is_world_alpha((char *)reg_info->alpha2))
intersect = true;
-
+*/
regd = ath11k_reg_build_regd(ab, reg_info, intersect);
if (!regd) {
ath11k_warn(ab, "failed to build regd from reg_info\n");

View File

@@ -1,7 +1,7 @@
From 164756923b3e89cb2fc825a80d4cc4236fb6dc89 Mon Sep 17 00:00:00 2001
From 19c481164dc772e49e173e08d1bfd266a5f458dd Mon Sep 17 00:00:00 2001
From: John Crispin <john@phrozen.org>
Date: Sat, 18 Jul 2020 08:53:44 +0200
Subject: [PATCH 01/30] ipq807x: add the Qualcomm AX target support
Subject: [PATCH 01/36] ipq807x: add the Qualcomm AX target support
Signed-off-by: John Crispin <john@phrozen.org>
---
@@ -13,13 +13,14 @@ Signed-off-by: John Crispin <john@phrozen.org>
target/linux/ipq807x/109-logspam.patch | 24 +
target/linux/ipq807x/Makefile | 22 +
.../ipq807x/base-files/etc/board.d/01_leds | 38 +
.../ipq807x/base-files/etc/board.d/02_network | 82 +
.../etc/hotplug.d/firmware/10-ath11k-caldata | 95 +
.../ipq807x/base-files/etc/board.d/02_network | 81 +
.../etc/hotplug.d/firmware/10-ath11k-caldata | 111 +
.../ipq807x/base-files/etc/hotplug.d/net/macs | 3 +
.../ipq807x/base-files/etc/init.d/aq_phy | 16 +
.../ipq807x/base-files/etc/init.d/bootcount | 12 +
.../linux/ipq807x/base-files/etc/init.d/wdt | 14 +
...G4_v5.4.B-AQR_CIG_WIFI_ID44715_VER1673.cld | Bin 0 -> 391170 bytes
.../base-files/lib/upgrade/platform.sh | 72 +
.../base-files/lib/upgrade/platform.sh | 73 +
target/linux/ipq807x/config-4.4 | 828 +
.../arm/boot/dts/qcom-ipq6018-cig-wf188.dts | 18 +
.../arm/boot/dts/qcom-ipq6018-cig-wf188n.dts | 18 +
@@ -63,15 +64,16 @@ Signed-off-by: John Crispin <john@phrozen.org>
.../ipq807x/patches/110-add-esmt-nand.patch | 37 +
target/linux/ipq807x/patches/111-eap106.patch | 765 +
target/linux/ipq807x/patches/112-pstore.patch | 147 +
.../ipq807x/patches/200-bpf_backport.patch | 44635 ++++++++++++++++
.../ipq807x/patches/200-bpf_backport.patch | 44780 ++++++++++++++++
toolchain/kernel-headers/Makefile | 8 +
60 files changed, 56539 insertions(+), 2 deletions(-)
61 files changed, 56703 insertions(+), 2 deletions(-)
create mode 100644 package/boot/uboot-envtools/files/ipq807x
create mode 100644 target/linux/ipq807x/109-logspam.patch
create mode 100644 target/linux/ipq807x/Makefile
create mode 100755 target/linux/ipq807x/base-files/etc/board.d/01_leds
create mode 100755 target/linux/ipq807x/base-files/etc/board.d/02_network
create mode 100755 target/linux/ipq807x/base-files/etc/hotplug.d/firmware/10-ath11k-caldata
create mode 100644 target/linux/ipq807x/base-files/etc/hotplug.d/net/macs
create mode 100755 target/linux/ipq807x/base-files/etc/init.d/aq_phy
create mode 100755 target/linux/ipq807x/base-files/etc/init.d/bootcount
create mode 100755 target/linux/ipq807x/base-files/etc/init.d/wdt
@@ -342,10 +344,10 @@ index 0000000000..1f1797b0c6
+exit 0
diff --git a/target/linux/ipq807x/base-files/etc/board.d/02_network b/target/linux/ipq807x/base-files/etc/board.d/02_network
new file mode 100755
index 0000000000..2c30b01aab
index 0000000000..7772e309a3
--- /dev/null
+++ b/target/linux/ipq807x/base-files/etc/board.d/02_network
@@ -0,0 +1,82 @@
@@ -0,0 +1,81 @@
+#!/bin/sh
+
+. /lib/functions.sh
@@ -408,8 +410,7 @@ index 0000000000..2c30b01aab
+ lan_mac=$(macaddr_add "$wan_mac" 1)
+ ucidef_set_network_device_mac eth0 $lan_mac
+ ucidef_set_network_device_mac eth1 $wan_mac
+ ip link set eth0 address $lan_mac
+ ip link set eth1 address $wan_mac
+ ucidef_set_label_macaddr $wan_mac
+ ;;
+ *)
+ wan_mac=$(cat /sys/class/net/eth0/address)
@@ -430,10 +431,10 @@ index 0000000000..2c30b01aab
+exit 0
diff --git a/target/linux/ipq807x/base-files/etc/hotplug.d/firmware/10-ath11k-caldata b/target/linux/ipq807x/base-files/etc/hotplug.d/firmware/10-ath11k-caldata
new file mode 100755
index 0000000000..1788908ab0
index 0000000000..016416c089
--- /dev/null
+++ b/target/linux/ipq807x/base-files/etc/hotplug.d/firmware/10-ath11k-caldata
@@ -0,0 +1,95 @@
@@ -0,0 +1,111 @@
+#!/bin/sh
+
+[ -e /lib/firmware/$FIRMWARE ] && exit 0
@@ -452,6 +453,18 @@ index 0000000000..1788908ab0
+ echo -ne \\x${mac3//:/\\x} >> /lib/firmware/ath11k-macs
+}
+
+ath11k_generate_macs_wf194() {
+ touch /lib/firmware/ath11k-macs
+ mac=$(grep BaseMacAddress= /dev/mtd14 | cut -dx -f2)
+ eth=$(macaddr_canonicalize $mac)
+ mac1=$(macaddr_add $eth 2)
+ mac2=$(macaddr_add $eth 10)
+ mac3=$(macaddr_add $eth 18)
+ echo -ne \\x${mac1//:/\\x} >> /lib/firmware/ath11k-macs
+ echo -ne \\x${mac2//:/\\x} >> /lib/firmware/ath11k-macs
+ echo -ne \\x${mac3//:/\\x} >> /lib/firmware/ath11k-macs
+}
+
+caldata_die() {
+ echo "caldata: " "$*"
+ exit 1
@@ -523,12 +536,25 @@ index 0000000000..1788908ab0
+ cig,wf188n)
+ ath11k_generate_macs
+ ;;
+ cig,wf194c|\
+ cig,wf194c)
+ ath11k_generate_macs_wf194
+ ;;
+ esac
+ ;;
+*)
+ exit 1
+ ;;
+esac
diff --git a/target/linux/ipq807x/base-files/etc/hotplug.d/net/macs b/target/linux/ipq807x/base-files/etc/hotplug.d/net/macs
new file mode 100644
index 0000000000..10f38108c8
--- /dev/null
+++ b/target/linux/ipq807x/base-files/etc/hotplug.d/net/macs
@@ -0,0 +1,3 @@
+#!/bin/sh
+mac=$(cat /etc/board.json | jsonfilter -e '@["network-device"]["'$DEVICENAME'"]'.macaddr)
+[ -n "$mac" ] && ip link set $DEVICENAME address $mac
diff --git a/target/linux/ipq807x/base-files/etc/init.d/aq_phy b/target/linux/ipq807x/base-files/etc/init.d/aq_phy
new file mode 100755
index 0000000000..e64755b5d6
@@ -4770,10 +4796,10 @@ HcmV?d00001
diff --git a/target/linux/ipq807x/base-files/lib/upgrade/platform.sh b/target/linux/ipq807x/base-files/lib/upgrade/platform.sh
new file mode 100755
index 0000000000..407db099f6
index 0000000000..2c6b682178
--- /dev/null
+++ b/target/linux/ipq807x/base-files/lib/upgrade/platform.sh
@@ -0,0 +1,72 @@
@@ -0,0 +1,73 @@
+. /lib/functions/system.sh
+
+qca_do_upgrade() {
@@ -4842,6 +4868,7 @@ index 0000000000..407db099f6
+ edgecore,eap102|\
+ edgecore,eap101)
+ CI_UBIPART="rootfs1"
+ [ "$(find_mtd_chardev rootfs)" ] && CI_UBIPART="rootfs"
+ nand_upgrade_tar "$1"
+ ;;
+ esac
@@ -16570,10 +16597,10 @@ index 0000000000..dc3960306d
+ * The following routines scan a subtree and registers a device for
diff --git a/target/linux/ipq807x/patches/200-bpf_backport.patch b/target/linux/ipq807x/patches/200-bpf_backport.patch
new file mode 100644
index 0000000000..3e730c313e
index 0000000000..4357369c29
--- /dev/null
+++ b/target/linux/ipq807x/patches/200-bpf_backport.patch
@@ -0,0 +1,44635 @@
@@ -0,0 +1,44780 @@
+--- a/arch/arm/Kconfig
++++ b/arch/arm/Kconfig
+@@ -38,7 +38,7 @@ config ARM
@@ -61209,6 +61236,151 @@ index 0000000000..3e730c313e
+ if (IS_ERR(fp))
+ return PTR_ERR(fp);
+
+--- a/net/8021q/vlan_core.c
++++ b/net/8021q/vlan_core.c
+@@ -50,7 +50,7 @@ bool vlan_do_receive(struct sk_buff **sk
+ }
+
+ skb->priority = vlan_get_ingress_priority(vlan_dev, skb->vlan_tci);
+- skb->vlan_tci = 0;
++ __vlan_hwaccel_clear_tag(skb);
+
+ rx_stats = this_cpu_ptr(vlan_dev_priv(vlan_dev)->vlan_pcpu_stats);
+
+--- a/net/ipv4/ip_tunnel_core.c
++++ b/net/ipv4/ip_tunnel_core.c
+@@ -128,7 +128,7 @@ int iptunnel_pull_header(struct sk_buff
+ secpath_reset(skb);
+ skb_clear_hash_if_not_l4(skb);
+ skb_dst_drop(skb);
+- skb->vlan_tci = 0;
++ __vlan_hwaccel_clear_tag(skb);
+ skb_set_queue_mapping(skb, 0);
+ skb->pkt_type = PACKET_HOST;
+
+--- a/net/bridge/br_netfilter_hooks.c
++++ b/net/bridge/br_netfilter_hooks.c
+@@ -673,10 +673,8 @@ static int br_nf_push_frag_xmit(struct n
+ return 0;
+ }
+
+- if (data->vlan_tci) {
+- skb->vlan_tci = data->vlan_tci;
+- skb->vlan_proto = data->vlan_proto;
+- }
++ if (data->vlan_proto)
++ __vlan_hwaccel_put_tag(skb, data->vlan_proto, data->vlan_tci);
+
+ skb_copy_to_linear_data_offset(skb, -data->size, data->mac, data->size);
+ __skb_push(skb, data->encap_size);
+@@ -740,8 +738,13 @@ static int br_nf_dev_queue_xmit(struct n
+
+ data = this_cpu_ptr(&brnf_frag_data_storage);
+
+- data->vlan_tci = skb->vlan_tci;
+- data->vlan_proto = skb->vlan_proto;
++ if (skb_vlan_tag_present(skb)) {
++ data->vlan_tci = skb->vlan_tci;
++ data->vlan_proto = skb->vlan_proto;
++ } else {
++ data->vlan_proto = 0;
++ }
++
+ data->encap_size = nf_bridge_encap_header_len(skb);
+ data->size = ETH_HLEN + data->encap_size;
+
+--- a/net/bridge/br_private.h
++++ b/net/bridge/br_private.h
+@@ -751,7 +751,7 @@ static inline int br_vlan_get_tag(const
+ int err = 0;
+
+ if (skb_vlan_tag_present(skb)) {
+- *vid = skb_vlan_tag_get(skb) & VLAN_VID_MASK;
++ *vid = skb_vlan_tag_get_id(skb);
+ } else {
+ *vid = 0;
+ err = -EINVAL;
+--- a/net/bridge/br_vlan.c
++++ b/net/bridge/br_vlan.c
+@@ -354,7 +354,7 @@ struct sk_buff *br_handle_vlan(struct ne
+ }
+ }
+ if (v->flags & BRIDGE_VLAN_INFO_UNTAGGED)
+- skb->vlan_tci = 0;
++ __vlan_hwaccel_clear_tag(skb);
+
+ out:
+ return skb;
+@@ -420,8 +420,8 @@ static bool __allowed_ingress(struct net
+ __vlan_hwaccel_put_tag(skb, proto, pvid);
+ else
+ /* Priority-tagged Frame.
+- * At this point, We know that skb->vlan_tci had
+- * VLAN_TAG_PRESENT bit and its VID field was 0x000.
++ * At this point, we know that skb->vlan_tci VID
++ * field was 0.
+ * We update only VID field and preserve PCP field.
+ */
+ skb->vlan_tci |= pvid;
+--- a/net/core/dev.c
++++ b/net/core/dev.c
+@@ -3988,7 +3988,7 @@ ncls:
+ * and set skb->priority like in vlan_do_receive()
+ * For the time being, just ignore Priority Code Point
+ */
+- skb->vlan_tci = 0;
++ __vlan_hwaccel_clear_tag(skb);
+ }
+
+ type = skb->protocol;
+@@ -4211,7 +4211,9 @@ static void gro_list_prepare(struct napi
+ }
+
+ diffs = (unsigned long)p->dev ^ (unsigned long)skb->dev;
+- diffs |= p->vlan_tci ^ skb->vlan_tci;
++ diffs |= skb_vlan_tag_present(p) ^ skb_vlan_tag_present(skb);
++ if (skb_vlan_tag_present(p))
++ diffs |= p->vlan_tci ^ skb->vlan_tci;
+ diffs |= skb_metadata_dst_cmp(p, skb);
+ if (maclen == ETH_HLEN)
+ diffs |= compare_ether_header(skb_mac_header(p),
+@@ -4452,7 +4454,7 @@ static void napi_reuse_skb(struct napi_s
+ __skb_pull(skb, skb_headlen(skb));
+ /* restore the reserve we had after netdev_alloc_skb_ip_align() */
+ skb_reserve(skb, NET_SKB_PAD + NET_IP_ALIGN - skb_headroom(skb));
+- skb->vlan_tci = 0;
++ __vlan_hwaccel_clear_tag(skb);
+ skb->dev = napi->dev;
+ skb->skb_iif = 0;
+ skb->encapsulation = 0;
+--- a/net/core/skbuff.c
++++ b/net/core/skbuff.c
+@@ -4491,7 +4491,7 @@ int skb_vlan_pop(struct sk_buff *skb)
+ int err;
+
+ if (likely(skb_vlan_tag_present(skb))) {
+- skb->vlan_tci = 0;
++ __vlan_hwaccel_clear_tag(skb);
+ } else {
+ if (unlikely((skb->protocol != htons(ETH_P_8021Q) &&
+ skb->protocol != htons(ETH_P_8021AD)) ||
+--- a/include/net/sock.h
++++ b/include/net/sock.h
+@@ -1484,6 +1484,14 @@ do { \
+ lockdep_init_map(&(sk)->sk_lock.dep_map, (name), (key), 0); \
+ } while (0)
+
++#ifdef CONFIG_LOCKDEP
++static inline bool lockdep_sock_is_held(struct sock *sk)
++{
++ return lockdep_is_held(&sk->sk_lock) ||
++ lockdep_is_held(&sk->sk_lock.slock);
++}
++#endif
++
+ void lock_sock_nested(struct sock *sk, int subclass);
+
+ static inline void lock_sock(struct sock *sk)
diff --git a/toolchain/kernel-headers/Makefile b/toolchain/kernel-headers/Makefile
index c33f26d46d..06236b5a47 100644
--- a/toolchain/kernel-headers/Makefile

View File

@@ -0,0 +1,78 @@
From b144b80999d1e1facf299b57c5fa3305cdfd9ee8 Mon Sep 17 00:00:00 2001
From: Paul Spooren <mail@aparcar.org>
Date: Thu, 4 Nov 2021 12:48:04 -1000
Subject: [PATCH] scripts: gen_config.py add host_dependencies option
In case a package/image requres specific host dependencies it is
possible to define entries in the `host_dependencies` array. Each entry
is an object containing at least `name` and `which`. The `which` array
contains tools to be checked in the current `PATH`.
Optionally the two options `success_diffconfig` and
`fallback_diffconfig` can be set. The former is optionally added in case
the tool is found. The latter is added if the dependency is not
available.
If the dependecy is not available and no `fallback_diffconfig` is set,
the config generation is considered impossible and stopped.
Signed-off-by: Paul Spooren <mail@aparcar.org>
---
scripts/gen_config.py | 27 +++++++++++++++++++++++++--
1 file changed, 25 insertions(+), 2 deletions(-)
diff --git a/scripts/gen_config.py b/scripts/gen_config.py
index a348386124..5572de80c7 100755
--- a/scripts/gen_config.py
+++ b/scripts/gen_config.py
@@ -2,7 +2,7 @@
from os import getenv
from pathlib import Path
-from shutil import rmtree
+from shutil import rmtree, which
from subprocess import run
import sys
import yaml
@@ -36,7 +36,27 @@ def usage(code: int = 0):
sys.exit(code)
-def load_yaml(fname: str, profile: dict, include = True):
+def process_host_dependency(dependecy: dict, profile: dict):
+ print(f"Checking host dependecy {dependecy['name']}")
+ found = False
+ for w in dependecy["which"]:
+ if which(w):
+ print(f"-> Found {w}")
+ found = True
+ break
+
+ if found:
+ profile["diffconfig"] += dependecy.get("success_diffconfig", "")
+ else:
+ print(f"-> Could not find host dependecy {dependecy['name']}.")
+ print(f" -> Please make sure one of {dependecy['which']} is available")
+ if "fallback_diffconfig" in dependecy:
+ profile["diffconfig"] += dependecy["fallback_diffconfig"]
+ else:
+ die("Can't continue without dependency and no `fallback_diffconfig` set")
+
+
+def load_yaml(fname: str, profile: dict, include=True):
profile_file = (profile_folder / fname).with_suffix(".yml")
if not profile_file.is_file():
@@ -59,6 +79,9 @@ def load_yaml(fname: str, profile: dict, include = True):
if f.get("name", "") == "" or (f.get("uri", "") == "" and f.get("path", "") == ""):
die(f"Found bad feed {f}")
profile["feeds"][f.get("name")] = f
+ elif n in {"host_dependecies"}:
+ for d in new.get(n):
+ process_host_dependency(d, profile)
if "include" in new and include:
for i in range(len(new["include"])):
--
2.30.2

View File

@@ -0,0 +1,54 @@
From bcb6e18b492d4fa055c136729ad85c53c725f241 Mon Sep 17 00:00:00 2001
From: Paul Spooren <mail@aparcar.org>
Date: Fri, 5 Nov 2021 12:12:25 -1000
Subject: [PATCH] scripts: gen_config allow explicit warning message
Instead of generically mentioning a missing dependency the host
dependency can also be explained by defining a `warning`.
Warning messages are collected and printed at the end.
Signed-off-by: Paul Spooren <mail@aparcar.org>
---
scripts/gen_config.py | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/scripts/gen_config.py b/scripts/gen_config.py
index 5572de80c7..071e00bb4d 100755
--- a/scripts/gen_config.py
+++ b/scripts/gen_config.py
@@ -8,6 +8,7 @@ import sys
import yaml
profile_folder = Path(getenv("PROFILES", "./profiles")).absolute()
+warnings = []
def die(msg: str):
@@ -48,8 +49,13 @@ def process_host_dependency(dependecy: dict, profile: dict):
if found:
profile["diffconfig"] += dependecy.get("success_diffconfig", "")
else:
- print(f"-> Could not find host dependecy {dependecy['name']}.")
- print(f" -> Please make sure one of {dependecy['which']} is available")
+ if "warning" in dependecy:
+ warnings.append(f"Dependecy {dependecy['name']}: {dependecy['warning']}")
+ else:
+ warnings.append(
+ f"Dependecy {dependecy['name']}: Please install {dependecy['which']}"
+ )
+
if "fallback_diffconfig" in dependecy:
profile["diffconfig"] += dependecy["fallback_diffconfig"]
else:
@@ -220,3 +226,7 @@ if __name__ == "__main__":
print("Running make defconfig")
if run(["make", "defconfig"]).returncode:
die(f"Error running make defconfig")
+
+ print("#########################\n" * 3)
+ print("\n".join(warnings))
+ print("#########################\n" * 3)
--
2.30.2

View File

@@ -0,0 +1,146 @@
From 844a6bacb1c416ad5f56ee60142e786548dd659c Mon Sep 17 00:00:00 2001
From: John Crispin <john@phrozen.org>
Date: Tue, 9 Nov 2021 12:49:43 +0100
Subject: [PATCH] hostapd: add wispr bandwidth patch
Signed-off-by: John Crispin <john@phrozen.org>
---
.../services/hostapd/patches/750-wispr.patch | 126 ++++++++++++++++++
1 file changed, 126 insertions(+)
create mode 100644 package/network/services/hostapd/patches/750-wispr.patch
diff --git a/package/network/services/hostapd/patches/750-wispr.patch b/package/network/services/hostapd/patches/750-wispr.patch
new file mode 100644
index 0000000000..f2f4a933d7
--- /dev/null
+++ b/package/network/services/hostapd/patches/750-wispr.patch
@@ -0,0 +1,126 @@
+Index: hostapd-2021-02-20-59e9794c/src/ap/ieee802_1x.c
+===================================================================
+--- hostapd-2021-02-20-59e9794c.orig/src/ap/ieee802_1x.c
++++ hostapd-2021-02-20-59e9794c/src/ap/ieee802_1x.c
+@@ -1904,6 +1904,25 @@ static int ieee802_1x_update_vlan(struct
+ }
+ #endif /* CONFIG_NO_VLAN */
+
++static int ieee802_1x_update_wispr(struct hostapd_data *hapd,
++ struct sta_info *sta,
++ struct radius_msg *msg)
++{
++ memset(sta->bandwidth, 0, sizeof(sta->bandwidth));
++
++ if (radius_msg_get_wispr(msg, &sta->bandwidth))
++ return 0;
++
++ if (!sta->bandwidth[0] && !sta->bandwidth[1])
++ return 0;
++
++ hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE8021X,
++ HOSTAPD_LEVEL_INFO,
++ "received wispr bandwidth from RADIUS server %d/%d",
++ sta->bandwidth[0], sta->bandwidth[1]);
++
++ return 0;
++}
+
+ /**
+ * ieee802_1x_receive_auth - Process RADIUS frames from Authentication Server
+@@ -2029,6 +2048,7 @@ ieee802_1x_receive_auth(struct radius_ms
+ ieee802_1x_check_hs20(hapd, sta, msg,
+ session_timeout_set ?
+ (int) session_timeout : -1);
++ ieee802_1x_update_wispr(hapd, sta, msg);
+ break;
+ case RADIUS_CODE_ACCESS_REJECT:
+ sm->eap_if->aaaFail = true;
+Index: hostapd-2021-02-20-59e9794c/src/ap/sta_info.h
+===================================================================
+--- hostapd-2021-02-20-59e9794c.orig/src/ap/sta_info.h
++++ hostapd-2021-02-20-59e9794c/src/ap/sta_info.h
+@@ -117,6 +117,7 @@ struct sta_info {
+ u8 supported_rates[WLAN_SUPP_RATES_MAX];
+ int supported_rates_len;
+ u8 qosinfo; /* Valid when WLAN_STA_WMM is set */
++ u32 bandwidth[2];
+
+ #ifdef CONFIG_MESH
+ enum mesh_plink_state plink_state;
+Index: hostapd-2021-02-20-59e9794c/src/radius/radius.c
+===================================================================
+--- hostapd-2021-02-20-59e9794c.orig/src/radius/radius.c
++++ hostapd-2021-02-20-59e9794c/src/radius/radius.c
+@@ -1182,6 +1182,35 @@ radius_msg_get_cisco_keys(struct radius_
+ return keys;
+ }
+
++#define RADIUS_VENDOR_ID_WISPR 14122
++#define RADIUS_WISPR_AV_BW_UP 7
++#define RADIUS_WISPR_AV_BW_DOWN 8
++
++int
++radius_msg_get_wispr(struct radius_msg *msg, u32 *bandwidth)
++{
++ int i;
++
++ if (msg == NULL || bandwidth == NULL)
++ return 1;
++
++ for (i = 0; i < 2; i++) {
++ size_t keylen;
++ u8 *key;
++
++ key = radius_msg_get_vendor_attr(msg, RADIUS_VENDOR_ID_WISPR,
++ RADIUS_WISPR_AV_BW_UP + i, &keylen);
++ if (!key)
++ continue;
++
++ if (keylen == 4)
++ bandwidth[i] = ntohl(*((u32 *)key));
++ os_free(key);
++ }
++
++ return 0;
++}
++
+
+ int radius_msg_add_mppe_keys(struct radius_msg *msg,
+ const u8 *req_authenticator,
+Index: hostapd-2021-02-20-59e9794c/src/radius/radius.h
+===================================================================
+--- hostapd-2021-02-20-59e9794c.orig/src/radius/radius.h
++++ hostapd-2021-02-20-59e9794c/src/radius/radius.h
+@@ -205,6 +205,10 @@ enum {
+ RADIUS_VENDOR_ATTR_WFA_HS20_T_C_URL = 10,
+ };
+
++#define RADIUS_VENDOR_ID_WISPR 14122
++#define RADIUS_WISPR_AV_BW_UP 7
++#define RADIUS_WISPR_AV_BW_DOWN 8
++
+ #ifdef _MSC_VER
+ #pragma pack(pop)
+ #endif /* _MSC_VER */
+@@ -277,6 +281,7 @@ radius_msg_get_ms_keys(struct radius_msg
+ struct radius_ms_mppe_keys *
+ radius_msg_get_cisco_keys(struct radius_msg *msg, struct radius_msg *sent_msg,
+ const u8 *secret, size_t secret_len);
++int radius_msg_get_wispr(struct radius_msg *msg, u32 *bandwidth);
+ int radius_msg_add_mppe_keys(struct radius_msg *msg,
+ const u8 *req_authenticator,
+ const u8 *secret, size_t secret_len,
+Index: hostapd-2021-02-20-59e9794c/src/ap/sta_info.c
+===================================================================
+--- hostapd-2021-02-20-59e9794c.orig/src/ap/sta_info.c
++++ hostapd-2021-02-20-59e9794c/src/ap/sta_info.c
+@@ -1292,7 +1292,7 @@ void ap_sta_set_authorized(struct hostap
+ MAC2STR(sta->addr), MAC2STR(dev_addr));
+ else
+ #endif /* CONFIG_P2P */
+- os_snprintf(buf, sizeof(buf), MACSTR, MAC2STR(sta->addr));
++ os_snprintf(buf, sizeof(buf), MACSTR " %d %d", MAC2STR(sta->addr), sta->bandwidth[0] / 1000, sta->bandwidth[1] / 1000);
+
+ if (hapd->sta_authorized_cb)
+ hapd->sta_authorized_cb(hapd->sta_authorized_cb_ctx,
--
2.25.1

View File

@@ -0,0 +1,992 @@
From a0e1c6853dabbc3bae674e1644f2de67d565fadb Mon Sep 17 00:00:00 2001
From: John Crispin <john@phrozen.org>
Date: Thu, 18 Nov 2021 10:44:40 +0100
Subject: [PATCH] ipq807x: add hfcl ion4xe/i
Signed-off-by: John Crispin <john@phrozen.org>
---
.../ipq807x/base-files/etc/board.d/01_leds | 5 +
.../ipq807x/base-files/etc/board.d/02_network | 5 +
.../etc/hotplug.d/firmware/10-ath11k-caldata | 2 +
.../base-files/lib/upgrade/platform.sh | 4 +
target/linux/ipq807x/config-4.4 | 2 +-
.../arm/boot/dts/qcom-ipq6018-hfcl-ion4xe.dts | 18 +
.../arm/boot/dts/qcom-ipq6018-hfcl-ion4xi.dts | 18 +
.../boot/dts/qcom/qcom-ipq6018-cp01-hfcl.dtsi | 478 ++++++++++++++++++
.../dts/qcom/qcom-ipq6018-hfcl-ion4xe.dts | 155 ++++++
.../dts/qcom/qcom-ipq6018-hfcl-ion4xi.dts | 156 ++++++
target/linux/ipq807x/image/ipq60xx.mk | 18 +
11 files changed, 860 insertions(+), 1 deletion(-)
create mode 100644 target/linux/ipq807x/files/arch/arm/boot/dts/qcom-ipq6018-hfcl-ion4xe.dts
create mode 100644 target/linux/ipq807x/files/arch/arm/boot/dts/qcom-ipq6018-hfcl-ion4xi.dts
create mode 100644 target/linux/ipq807x/files/arch/arm64/boot/dts/qcom/qcom-ipq6018-cp01-hfcl.dtsi
create mode 100644 target/linux/ipq807x/files/arch/arm64/boot/dts/qcom/qcom-ipq6018-hfcl-ion4xe.dts
create mode 100644 target/linux/ipq807x/files/arch/arm64/boot/dts/qcom/qcom-ipq6018-hfcl-ion4xi.dts
diff --git a/target/linux/ipq807x/base-files/etc/board.d/01_leds b/target/linux/ipq807x/base-files/etc/board.d/01_leds
index 1f1797b0c6..ab19fd0532 100755
--- a/target/linux/ipq807x/base-files/etc/board.d/01_leds
+++ b/target/linux/ipq807x/base-files/etc/board.d/01_leds
@@ -31,6 +31,11 @@ edgecore,eap102)
ucidef_set_led_wlan "wlan5g" "WLAN5G" "green:wifi5" "phy0tpt"
ucidef_set_led_wlan "wlan2g" "WLAN2G" "green:wifi2" "phy1tpt"
;;
+hfcl,ion4xi|\
+hfcl,ion4xe)
+ ucidef_set_led_wlan "wlan5g" "WLAN5G" "blue:wifi5" "phy0tpt"
+ ucidef_set_led_wlan "wlan2g" "WLAN2G" "blue:wifi2" "phy1tpt"
+ ;;
esac
board_config_flush
diff --git a/target/linux/ipq807x/base-files/etc/board.d/02_network b/target/linux/ipq807x/base-files/etc/board.d/02_network
index 9d7dd4e61e..89db0cc5a4 100755
--- a/target/linux/ipq807x/base-files/etc/board.d/02_network
+++ b/target/linux/ipq807x/base-files/etc/board.d/02_network
@@ -12,6 +12,11 @@ qcom_setup_interfaces()
ucidef_add_switch_attr "switch0" "reset" "false"
case $board in
+ hfcl,ion4xi|\
+ hfcl,ion4xe)
+ ucidef_set_interface_wan "eth0 eth1"
+ ucidef_set_interface_lan ""
+ ;;
cig,wf188|\
tplink,ex227|\
tplink,ex447)
diff --git a/target/linux/ipq807x/base-files/etc/hotplug.d/firmware/10-ath11k-caldata b/target/linux/ipq807x/base-files/etc/hotplug.d/firmware/10-ath11k-caldata
index 1788908ab0..ba7991759e 100755
--- a/target/linux/ipq807x/base-files/etc/hotplug.d/firmware/10-ath11k-caldata
+++ b/target/linux/ipq807x/base-files/etc/hotplug.d/firmware/10-ath11k-caldata
@@ -57,6 +57,8 @@ case "$FIRMWARE" in
cig,wf188|\
cig,wf188n|\
edgecore,eap101|\
+ hfcl,ion4xi|\
+ hfcl,ion4xe|\
wallys,dr6018|\
qcom,ipq6018-cp01|\
xiaomi,ax1800)
diff --git a/target/linux/ipq807x/base-files/lib/upgrade/platform.sh b/target/linux/ipq807x/base-files/lib/upgrade/platform.sh
index 407db099f6..ef8cce8614 100755
--- a/target/linux/ipq807x/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ipq807x/base-files/lib/upgrade/platform.sh
@@ -28,6 +28,8 @@ platform_check_image() {
edgecore,eap101|\
edgecore,eap102|\
edgecore,eap106|\
+ hfcl,ion4xi|\
+ hfcl,ion4xe|\
tplink,ex227|\
tplink,ex447|\
qcom,ipq6018-cp01|\
@@ -53,6 +55,8 @@ platform_do_upgrade() {
cig,wf188n|\
cig,wf194c|\
cig,wf194c4|\
+ hfcl,ion4xi|\
+ hfcl,ion4xe|\
qcom,ipq6018-cp01|\
qcom,ipq807x-hk01|\
qcom,ipq807x-hk14|\
diff --git a/target/linux/ipq807x/config-4.4 b/target/linux/ipq807x/config-4.4
index 1b4b95b968..cef3f951b6 100644
--- a/target/linux/ipq807x/config-4.4
+++ b/target/linux/ipq807x/config-4.4
@@ -638,7 +638,7 @@ CONFIG_SND_PCM=y
CONFIG_SND_SOC=y
# CONFIG_SND_SOC_APQ8016_SBC is not set
CONFIG_SND_SOC_I2C_AND_SPI=y
-CONFIG_SND_SOC_IPQ=y
+# CONFIG_SND_SOC_IPQ is not set
# CONFIG_SND_SOC_IPQ806X_LPAIF is not set
# CONFIG_SND_SOC_IPQ806X_PCM_RAW is not set
CONFIG_SND_SOC_IPQ_ADSS=y
diff --git a/target/linux/ipq807x/files/arch/arm/boot/dts/qcom-ipq6018-hfcl-ion4xe.dts b/target/linux/ipq807x/files/arch/arm/boot/dts/qcom-ipq6018-hfcl-ion4xe.dts
new file mode 100644
index 0000000000..5a44b9a3e7
--- /dev/null
+++ b/target/linux/ipq807x/files/arch/arm/boot/dts/qcom-ipq6018-hfcl-ion4xe.dts
@@ -0,0 +1,18 @@
+/*
+ * Copyright (c) 2019, The Linux Foundation. All rights reserved.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include "../../../arm64/boot/dts/qcom/qcom-ipq6018-hfcl-ion4xe.dts"
+#include "qcom-ipq6018.dtsi"
diff --git a/target/linux/ipq807x/files/arch/arm/boot/dts/qcom-ipq6018-hfcl-ion4xi.dts b/target/linux/ipq807x/files/arch/arm/boot/dts/qcom-ipq6018-hfcl-ion4xi.dts
new file mode 100644
index 0000000000..8edd1d817a
--- /dev/null
+++ b/target/linux/ipq807x/files/arch/arm/boot/dts/qcom-ipq6018-hfcl-ion4xi.dts
@@ -0,0 +1,18 @@
+/*
+ * Copyright (c) 2019, The Linux Foundation. All rights reserved.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include "../../../arm64/boot/dts/qcom/qcom-ipq6018-hfcl-ion4xi.dts"
+#include "qcom-ipq6018.dtsi"
diff --git a/target/linux/ipq807x/files/arch/arm64/boot/dts/qcom/qcom-ipq6018-cp01-hfcl.dtsi b/target/linux/ipq807x/files/arch/arm64/boot/dts/qcom/qcom-ipq6018-cp01-hfcl.dtsi
new file mode 100644
index 0000000000..7c67cf7ade
--- /dev/null
+++ b/target/linux/ipq807x/files/arch/arm64/boot/dts/qcom/qcom-ipq6018-cp01-hfcl.dtsi
@@ -0,0 +1,478 @@
+/*
+ * Copyright (c) 2019, The Linux Foundation. All rights reserved.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include "qcom-ipq6018.dtsi"
+#include <dt-bindings/input/input.h>
+#include <dt-bindings/gpio/gpio.h>
+
+/ {
+ #address-cells = <0x2>;
+ #size-cells = <0x2>;
+ compatible = "qcom,ipq6018-cp01", "qcom,ipq6018";
+ interrupt-parent = <&intc>;
+ qcom,msm-id = <0x192 0x0>, <0x193 0x0>;
+
+ aliases {
+ serial0 = &blsp1_uart3;
+ serial1 = &blsp1_uart2;
+ sdhc2 = &sdhc_2;
+ /*
+ * Aliases as required by u-boot
+ * to patch MAC addresses
+ */
+ ethernet0 = "/soc/dp1";
+ ethernet1 = "/soc/dp2";
+ };
+
+ chosen {
+ bootargs = "console=ttyMSM0,115200,n8 rw init=/init";
+#ifdef __IPQ_MEM_PROFILE_256_MB__
+ bootargs-append = " swiotlb=1";
+#else
+ bootargs-append = " swiotlb=1 coherent_pool=2M";
+#endif
+ };
+
+};
+
+&tlmm {
+ pinctrl-0 = <&sd_ldo_pins &hfcl_gpio>;
+ pinctrl-names = "default";
+
+ uart_pins: uart_pins {
+ mux {
+ pins = "gpio44", "gpio45";
+ function = "blsp2_uart";
+ drive-strength = <8>;
+ bias-pull-down;
+ };
+ };
+
+ sd_ldo_pins: sd_ldo_pins {
+ mux {
+ pins = "gpio66";
+ function = "gpio";
+ drive-strength = <2>;
+ bias-disable;
+ output-low;
+ };
+ };
+
+ spi_0_pins: spi_0_pins {
+ mux {
+ pins = "gpio38", "gpio39", "gpio40", "gpio41";
+ function = "blsp0_spi";
+ drive-strength = <8>;
+ bias-pull-down;
+ };
+ };
+
+ qpic_pins: qpic_pins {
+ data_0 {
+ pins = "gpio15";
+ function = "qpic_pad0";
+ drive-strength = <8>;
+ bias-pull-down;
+ };
+ data_1 {
+ pins = "gpio12";
+ function = "qpic_pad1";
+ drive-strength = <8>;
+ bias-pull-down;
+ };
+ data_2 {
+ pins = "gpio13";
+ function = "qpic_pad2";
+ drive-strength = <8>;
+ bias-pull-down;
+ };
+ data_3 {
+ pins = "gpio14";
+ function = "qpic_pad3";
+ drive-strength = <8>;
+ bias-pull-down;
+ };
+ data_4 {
+ pins = "gpio5";
+ function = "qpic_pad4";
+ drive-strength = <8>;
+ bias-pull-down;
+ };
+ data_5 {
+ pins = "gpio6";
+ function = "qpic_pad5";
+ drive-strength = <8>;
+ bias-pull-down;
+ };
+ data_6 {
+ pins = "gpio7";
+ function = "qpic_pad6";
+ drive-strength = <8>;
+ bias-pull-down;
+ };
+ data_7 {
+ pins = "gpio8";
+ function = "qpic_pad7";
+ drive-strength = <8>;
+ bias-pull-down;
+ };
+ qpic_pad {
+ pins = "gpio1", "gpio3", "gpio4",
+ "gpio10", "gpio11", "gpio17";
+ function = "qpic_pad";
+ drive-strength = <8>;
+ bias-pull-down;
+ };
+ };
+
+ sd_pins: sd_pins {
+ mux {
+ pins = "gpio62";
+ function = "sd_card";
+ drive-strength = <8>;
+ bias-pull-up;
+ };
+ };
+
+ extcon_usb_pins: extcon_usb_pins {
+ mux {
+ pins = "gpio26";
+ function = "gpio";
+ drive-strength = <2>;
+ bias-pull-down;
+ };
+ };
+
+ button_pins: button_pins {
+ reset_button {
+ pins = "gpio53";
+ function = "gpio";
+ drive-strength = <8>;
+ bias-pull-up;
+ };
+ };
+
+ mdio_pins: mdio_pinmux {
+ mux_0 {
+ pins = "gpio64";
+ function = "mdc";
+ drive-strength = <8>;
+ bias-pull-up;
+ };
+ mux_1 {
+ pins = "gpio65";
+ function = "mdio";
+ drive-strength = <8>;
+ bias-pull-up;
+ };
+ mux_2 {
+ pins = "gpio75";
+ function = "gpio";
+ bias-pull-up;
+ };
+ mux_3 {
+ pins = "gpio77";
+ function = "gpio";
+ bias-pull-up;
+ };
+ };
+
+ leds_pins: leds_pins {
+ led_5g {
+ pins = "gpio60";
+ function = "gpio";
+ drive-strength = <8>;
+ bias-pull-down;
+ };
+ led_2g {
+ pins = "gpio61";
+ function = "gpio";
+ drive-strength = <8>;
+ bias-pull-down;
+ };
+ };
+
+ hfcl_gpio: hfcl_gpio {
+ mux_0 {
+ pins = "gpio25";
+ function = "gpio";
+ drive-strength = <8>;
+ output-low;
+ };
+ mux_1 {
+ pins = "gpio29";
+ function = "gpio";
+ drive-strength = <8>;
+ bias-pull-down;
+ };
+ mux_2 {
+ pins = "gpio33";
+ function = "gpio";
+ drive-strength = <8>;
+ bias-pull-down;
+ };
+ mux_3 {
+ pins = "gpio34";
+ function = "gpio";
+ drive-strength = <8>;
+ bias-pull-down;
+ };
+ mux_4 {
+ pins = "gpio35";
+ function = "gpio";
+ drive-strength = <8>;
+ bias-pull-down;
+ };
+ mux_5 {
+ pins = "gpio59";
+ function = "gpio";
+ drive-strength = <8>;
+ bias-pull-down;
+ };
+ mux_6 {
+ pins = "gpio67";
+ function = "gpio";
+ drive-strength = <8>;
+ bias-pull-down;
+ };
+ mux_7 {
+ pins = "gpio70";
+ function = "gpio";
+ drive-strength = <8>;
+ bias-pull-down;
+ };
+ mux_8 {
+ pins = "gpio79";
+ function = "gpio";
+ drive-strength = <8>;
+ bias-pull-down;
+ };
+ };
+
+ uniphy_pins: uniphy_pinmux {
+ mux {
+ pins = "gpio63";
+ function = "rx0";
+ bias-disable;
+ };
+ sfp_tx {
+ pins = "gpio48";
+ function = "gpio";
+ driver-strength = <8>;
+ bias-pull-down;
+ output-low;
+ };
+ };
+
+ hsuart_pins: hsuart_pins {
+ mux {
+ pins = "gpio71", "gpio72";
+ function = "blsp1_uart";
+ drive-strength = <8>;
+ bias-disable;
+ };
+ };
+
+};
+
+&soc {
+ extcon_usb: extcon_usb {
+ pinctrl-0 = <&extcon_usb_pins>;
+ pinctrl-names = "default";
+ id-gpio = <&tlmm 26 GPIO_ACTIVE_LOW>;
+ status = "disabled";
+ };
+
+ mdio: mdio@90000 {
+ pinctrl-0 = <&mdio_pins>;
+ pinctrl-names = "default";
+ phy-reset-gpio = <&tlmm 77 0>;
+ status = "ok";
+ phy0: ethernet-phy@0 {
+ reg = <4>;
+ };
+ phy1: ethernet-phy@1 {
+ reg = <30>;
+ };
+ };
+
+ dp1 {
+ device_type = "network";
+ compatible = "qcom,nss-dp";
+ qcom,id = <4>;
+ reg = <0x3a001600 0x200>;
+ qcom,mactype = <0>;
+ local-mac-address = [000000000000];
+ qcom,link-poll = <1>;
+ qcom,phy-mdio-addr = <4>;
+ phy-mode = "sgmii";
+ };
+
+ dp2 {
+ device_type = "network";
+ compatible = "qcom,nss-dp";
+ qcom,id = <5>;
+ reg = <0x3a003000 0x3fff>;
+ qcom,mactype = <1>;
+ local-mac-address = [000000000000];
+ qcom,link-poll = <1>;
+ qcom,phy-mdio-addr = <30>;
+ phy-mode = "sgmii";
+ };
+
+ nss-macsec1 {
+ compatible = "qcom,nss-macsec";
+ phy_addr = <30>;
+ phy_access_mode = <0>;
+ mdiobus = <&mdio>;
+ };
+
+ ess-switch@3a000000 {
+ pinctrl-0 = <&uniphy_pins>;
+ pinctrl-names = "default";
+ switch_cpu_bmp = <0x1>; /* cpu port bitmap */
+ switch_lan_bmp = <0x10>; /* lan port bitmap */
+ switch_wan_bmp = <0x20>; /* wan port bitmap */
+ switch_inner_bmp = <0xc0>; /*inner port bitmap*/
+ switch_mac_mode = <0xf>; /* mac mode for uniphy instance0*/
+ switch_mac_mode1 = <0x14>; /* mac mode for uniphy instance1*/
+ switch_mac_mode2 = <0xff>; /* mac mode for uniphy instance2*/
+ qcom,port_phyinfo {
+ port@0 {
+ port_id = <4>;
+ phy_address = <4>;
+ };
+ port@2 {
+ port_id = <5>;
+ phy_address = <30>;
+ phy_i2c_address = <30>;
+ phy-i2c-mode;
+ port_mac_sel = "GMAC_PORT";
+ };
+ };
+ };
+
+ gpio_keys {
+ compatible = "gpio-keys";
+ pinctrl-0 = <&button_pins>;
+ pinctrl-names = "default";
+
+ reset {
+ label = "reset";
+ linux,code = <KEY_RESTART>;
+ gpios = <&tlmm 53 GPIO_ACTIVE_LOW>;
+ linux,input-type = <1>;
+ debounce-interval = <60>;
+ };
+ };
+
+ i2c_2: i2c@78b9000 {
+ compatible = "qcom,i2c-qup-v2.2.1";
+ #address-cells = <1>;
+ #size-cells = <0>;
+ reg = <0x78b9000 0x600>;
+ interrupts = <GIC_SPI 299 IRQ_TYPE_LEVEL_HIGH>;
+ clocks = <&gcc GCC_BLSP1_AHB_CLK>,
+ <&gcc GCC_BLSP1_QUP5_I2C_APPS_CLK>;
+ clock-names = "iface", "core";
+ clock-frequency = <400000>;
+ dmas = <&blsp_dma 21>, <&blsp_dma 20>;
+ dma-names = "rx", "tx";
+ status = "disabled";
+ };
+};
+
+&blsp1_uart3 {
+ pinctrl-0 = <&uart_pins>;
+ pinctrl-names = "default";
+ status = "ok";
+};
+
+&spi_0 {
+ pinctrl-0 = <&spi_0_pins>;
+ pinctrl-names = "default";
+ cs-select = <0>;
+ status = "ok";
+
+ m25p80@0 {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ reg = <0>;
+ compatible = "n25q128a11";
+ linux,modalias = "m25p80", "n25q128a11";
+ spi-max-frequency = <50000000>;
+ use-default-sizes;
+ };
+};
+
+&blsp1_uart2 {
+ pinctrl-0 = <&hsuart_pins>;
+ pinctrl-names = "default";
+ dmas = <&blsp_dma 2>,
+ <&blsp_dma 3>;
+ dma-names = "tx", "rx";
+ status = "ok";
+};
+
+&qpic_bam {
+ status = "ok";
+};
+
+&nand {
+ pinctrl-0 = <&qpic_pins>;
+ pinctrl-names = "default";
+ status = "ok";
+};
+
+&ssphy_0 {
+ status = "ok";
+};
+
+&qusb_phy_0 {
+ status = "ok";
+};
+
+&qusb_phy_1 {
+ status = "ok";
+};
+
+&usb2 {
+ status = "ok";
+};
+
+&usb3 {
+ status = "ok";
+};
+
+&nss_crypto {
+ status = "ok";
+};
+
+&pcie_phy {
+ status = "disabled";
+};
+
+&pcie0 {
+ status = "disabled";
+};
+
+&qpic_lcd {
+ status = "disabled";
+};
+
+&qpic_lcd_panel {
+ status = "disabled";
+};
diff --git a/target/linux/ipq807x/files/arch/arm64/boot/dts/qcom/qcom-ipq6018-hfcl-ion4xe.dts b/target/linux/ipq807x/files/arch/arm64/boot/dts/qcom/qcom-ipq6018-hfcl-ion4xe.dts
new file mode 100644
index 0000000000..a64ec25a8a
--- /dev/null
+++ b/target/linux/ipq807x/files/arch/arm64/boot/dts/qcom/qcom-ipq6018-hfcl-ion4xe.dts
@@ -0,0 +1,155 @@
+/dts-v1/;
+/*
+ * Copyright (c) 2019, The Linux Foundation. All rights reserved.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include "qcom-ipq6018-cp01-hfcl.dtsi"
+#include "qcom-ipq6018-rpm-regulator.dtsi"
+#include "qcom-ipq6018-cpr-regulator.dtsi"
+#include "qcom-ipq6018-cp-cpu.dtsi"
+
+/ {
+ model = "HFCL ION4Xe";
+ compatible = "hfcl,ion4xe", "qcom,ipq6018-cp01", "qcom,ipq6018";
+
+ /*
+ * +=========+==============+========================+
+ * | | | |
+ * | Region | Start Offset | Size |
+ * | | | |
+ * +--------+--------------+-------------------------+
+ * | | | |
+ * | | | |
+ * | | | |
+ * | | | |
+ * | Linux | 0x41000000 | 139MB |
+ * | | | |
+ * | | | |
+ * | | | |
+ * +--------+--------------+-------------------------+
+ * | TZ App | 0x49B00000 | 6MB |
+ * +--------+--------------+-------------------------+
+ *
+ * From the available 145 MB for Linux in the first 256 MB,
+ * we are reserving 6 MB for TZAPP.
+ *
+ * Refer arch/arm64/boot/dts/qcom/qcom-ipq6018-memory.dtsi
+ * for memory layout.
+ */
+
+/* TZAPP is enabled in default memory profile only */
+#if !defined(__IPQ_MEM_PROFILE_256_MB__) && !defined(__IPQ_MEM_PROFILE_512_MB__)
+ reserved-memory {
+ tzapp:tzapp@49B00000 { /* TZAPPS */
+ no-map;
+ reg = <0x0 0x49B00000 0x0 0x00600000>;
+ };
+ };
+#endif
+};
+
+&tlmm {
+ i2c_1_pins: i2c_1_pins {
+ mux {
+ pins = "gpio42", "gpio43";
+ function = "blsp2_i2c";
+ drive-strength = <8>;
+ bias-pull-down;
+ };
+ };
+
+ i2c_2_pins: i2c_2_pins {
+ mux {
+ pins = "gpio55", "gpio56";
+ function = "blsp4_i2c";
+ drive-strength = <8>;
+ bias-pull-down;
+ };
+ };
+};
+
+&i2c_1 {
+ pinctrl-0 = <&i2c_1_pins>;
+ pinctrl-names = "default";
+ status = "ok";
+
+ lm75@48 {
+ compatible = "lm75";
+ reg = <0x48>;
+ status = "okay";
+ };
+};
+
+&i2c_2 {
+ pinctrl-0 = <&i2c_2_pins>;
+ pinctrl-names = "default";
+ status = "ok";
+};
+
+&sdhc_2 {
+ pinctrl-0 = <&sd_pins>;
+ pinctrl-names = "default";
+ cd-gpios = <&tlmm 62 1>;
+ sd-ldo-gpios = <&tlmm 66 0>;
+ vqmmc-supply = <&ipq6018_l2_corner>;
+ status = "ok";
+};
+
+&soc {
+ leds {
+ compatible = "gpio-leds";
+ pinctrl-0 = <&leds_pins>;
+ pinctrl-names = "default";
+
+ led@60 {
+ label = "blue:wifi5";
+ gpios = <&tlmm 60 GPIO_ACTIVE_LOW>;
+ linux,default-trigger = "led_5g";
+ default-state = "off";
+ };
+ led@61 {
+ label = "blue:wifi2";
+ gpios = <&tlmm 61 GPIO_ACTIVE_LOW>;
+ linux,default-trigger = "led_2g";
+ default-state = "off";
+ };
+ };
+};
+
+&tlmm {
+ leds_pins: leds_pins {
+ led_5g {
+ pins = "gpio60";
+ function = "gpio";
+ drive-strength = <8>;
+ bias-pull-down;
+ };
+ led_2g {
+ pins = "gpio61";
+ function = "gpio";
+ drive-strength = <8>;
+ bias-pull-down;
+ };
+ };
+};
+
+/* TZAPP is enabled in default memory profile only */
+#if !defined(__IPQ_MEM_PROFILE_256_MB__) && !defined(__IPQ_MEM_PROFILE_512_MB__)
+&qseecom {
+ mem-start = <0x49B00000>;
+ mem-size = <0x600000>;
+ status = "ok";
+};
+#endif
diff --git a/target/linux/ipq807x/files/arch/arm64/boot/dts/qcom/qcom-ipq6018-hfcl-ion4xi.dts b/target/linux/ipq807x/files/arch/arm64/boot/dts/qcom/qcom-ipq6018-hfcl-ion4xi.dts
new file mode 100644
index 0000000000..88b609f37e
--- /dev/null
+++ b/target/linux/ipq807x/files/arch/arm64/boot/dts/qcom/qcom-ipq6018-hfcl-ion4xi.dts
@@ -0,0 +1,156 @@
+/dts-v1/;
+/*
+ * Copyright (c) 2019, The Linux Foundation. All rights reserved.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include "qcom-ipq6018-cp01-hfcl.dtsi"
+#include "qcom-ipq6018-rpm-regulator.dtsi"
+#include "qcom-ipq6018-cpr-regulator.dtsi"
+#include "qcom-ipq6018-cp-cpu.dtsi"
+
+/ {
+ model = "HFCL ION4Xi";
+ compatible = "hfcl,ion4xi", "qcom,ipq6018-cp01", "qcom,ipq6018";
+
+ /*
+ * +=========+==============+========================+
+ * | | | |
+ * | Region | Start Offset | Size |
+ * | | | |
+ * +--------+--------------+-------------------------+
+ * | | | |
+ * | | | |
+ * | | | |
+ * | | | |
+ * | Linux | 0x41000000 | 139MB |
+ * | | | |
+ * | | | |
+ * | | | |
+ * +--------+--------------+-------------------------+
+ * | TZ App | 0x49B00000 | 6MB |
+ * +--------+--------------+-------------------------+
+ *
+ * From the available 145 MB for Linux in the first 256 MB,
+ * we are reserving 6 MB for TZAPP.
+ *
+ * Refer arch/arm64/boot/dts/qcom/qcom-ipq6018-memory.dtsi
+ * for memory layout.
+ */
+
+/* TZAPP is enabled in default memory profile only */
+#if !defined(__IPQ_MEM_PROFILE_256_MB__) && !defined(__IPQ_MEM_PROFILE_512_MB__)
+ reserved-memory {
+ tzapp:tzapp@49B00000 { /* TZAPPS */
+ no-map;
+ reg = <0x0 0x49B00000 0x0 0x00600000>;
+ };
+ };
+#endif
+};
+
+&tlmm {
+ i2c_1_pins: i2c_1_pins {
+ mux {
+ pins = "gpio42", "gpio43";
+ function = "blsp2_i2c";
+ drive-strength = <8>;
+ bias-pull-down;
+ };
+ };
+
+ i2c_2_pins: i2c_2_pins {
+ mux {
+ pins = "gpio55", "gpio56";
+ function = "blsp4_i2c";
+ drive-strength = <8>;
+ bias-pull-down;
+ };
+ };
+};
+
+&i2c_1 {
+ pinctrl-0 = <&i2c_1_pins>;
+ pinctrl-names = "default";
+ status = "ok";
+
+ lm75@48 {
+ compatible = "lm75";
+ reg = <0x48>;
+ status = "okay";
+ };
+};
+
+&i2c_2 {
+ pinctrl-0 = <&i2c_2_pins>;
+ pinctrl-names = "default";
+ status = "ok";
+};
+
+&sdhc_2 {
+ pinctrl-0 = <&sd_pins>;
+ pinctrl-names = "default";
+ cd-gpios = <&tlmm 62 1>;
+ sd-ldo-gpios = <&tlmm 66 0>;
+ vqmmc-supply = <&ipq6018_l2_corner>;
+ status = "ok";
+};
+
+&soc {
+ leds {
+ compatible = "gpio-leds";
+ pinctrl-0 = <&leds_pins>;
+ pinctrl-names = "default";
+
+ led@60 {
+ label = "blue:wifi5";
+ gpios = <&tlmm 32 GPIO_ACTIVE_LOW>;
+ linux,default-trigger = "led_5g";
+ default-state = "off";
+ };
+ led@61 {
+ label = "blue:wifi2";
+ gpios = <&tlmm 31 GPIO_ACTIVE_LOW>;
+ linux,default-trigger = "led_2g";
+ default-state = "off";
+ };
+ };
+};
+
+&tlmm {
+ leds_pins: leds_pins {
+ led_5g {
+ pins = "gpio32";
+ function = "gpio";
+ drive-strength = <8>;
+ bias-pull-down;
+ };
+ led_2g {
+ pins = "gpio31";
+ function = "gpio";
+ drive-strength = <8>;
+ bias-pull-down;
+ };
+ };
+};
+
+
+/* TZAPP is enabled in default memory profile only */
+#if !defined(__IPQ_MEM_PROFILE_256_MB__) && !defined(__IPQ_MEM_PROFILE_512_MB__)
+&qseecom {
+ mem-start = <0x49B00000>;
+ mem-size = <0x600000>;
+ status = "ok";
+};
+#endif
diff --git a/target/linux/ipq807x/image/ipq60xx.mk b/target/linux/ipq807x/image/ipq60xx.mk
index e94ab22785..30ec2160bc 100644
--- a/target/linux/ipq807x/image/ipq60xx.mk
+++ b/target/linux/ipq807x/image/ipq60xx.mk
@@ -20,6 +20,24 @@ define Device/cig_wf188n
endef
TARGET_DEVICES += cig_wf188n
+define Device/hfcl_ion4xe
+ DEVICE_TITLE := HFCL ION4Xe
+ DEVICE_DTS := qcom-ipq6018-hfcl-ion4xe
+ DEVICE_DTS_CONFIG := config@cp01-c1
+ SUPPORTED_DEVICES := hfcl,ion4xe
+ DEVICE_PACKAGES := ath11k-wifi-qcom-ipq6018 uboot-envtools
+endef
+TARGET_DEVICES += hfcl_ion4xe
+
+define Device/hfcl_ion4xi
+ DEVICE_TITLE := HFCL ION4Xi
+ DEVICE_DTS := qcom-ipq6018-hfcl-ion4xi
+ DEVICE_DTS_CONFIG := config@cp01-c1
+ SUPPORTED_DEVICES := hfcl,ion4xi
+ DEVICE_PACKAGES := ath11k-wifi-qcom-ipq6018 uboot-envtools
+endef
+TARGET_DEVICES += hfcl_ion4xi
+
define Device/edgecore_eap101
DEVICE_TITLE := EdgeCore EAP101
DEVICE_DTS := qcom-ipq6018-edgecore-eap101
--
2.25.1

View File

@@ -0,0 +1,91 @@
From bbd31470429134c23f593a49c02d5413dcba352f Mon Sep 17 00:00:00 2001
From: Mark Mentovai <mark@moxienet.com>
Date: Tue, 23 Nov 2021 12:28:55 -0500
Subject: [PATCH] hostapd: allow hostapd under ujail to communicate with
hostapd_cli
When procd-ujail is available, 1f785383875a runs hostapd as user
"network", with only limited additional capabilities (CAP_NET_ADMIN and
CAP_NET_RAW).
hostapd_cli (CONFIG_PACKAGE_hostapd-utils) communicates with hostapd
over a named UNIX-domain socket. hostapd_cli is responsible for creating
this socket at /tmp/wpa_ctrl_$pid_$counter. Since it typically runs as
root, this endpoint is normally created with uid root, gid root, mode
0755. As a result, hostapd running as uid network is able to receive
control messages sent through this interface, but is not able to respond
to them. If debug-level logging is enabled (CONFIG_WPA_MSG_MIN_PRIORITY
<= 2 at build, and log_level <= 2 in /etc/config/wireless wifi-device),
this message will appear from hostapd:
CTRL: sendto failed: Permission denied
As a fix, hostapd_cli should create the socket node in the filesystem
with uid network, gid network, mode 0770. This borrows the presently
Android-only strategy already in hostapd intended to solve the same
problem on Android.
If procd-ujail is not available and hostapd falls back to running as
root, it will still be able to read from and write to the socket even if
the node in the filesystem has been restricted to the network user and
group. This matches the logic in
package/network/services/hostapd/files/wpad.init, which sets the uid and
gid of /var/run/hostapd to network regardless of whether procd-ujail is
available.
As it appears that the "network" user and group are statically allocated
uid 101 and gid 101, respectively, per
package/base-files/files/etc/passwd and USERID in
package/network/services/hostapd/Makefile, this patch also uses a
constant 101 for the uid and gid.
Signed-off-by: Mark Mentovai <mark@moxienet.com>
[refreshed patch]
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
---
.../610-hostapd_cli_ujail_permission.patch | 33 +++++++++++++++++++
1 file changed, 33 insertions(+)
create mode 100644 package/network/services/hostapd/patches/610-hostapd_cli_ujail_permission.patch
diff --git a/package/network/services/hostapd/patches/610-hostapd_cli_ujail_permission.patch b/package/network/services/hostapd/patches/610-hostapd_cli_ujail_permission.patch
new file mode 100644
index 0000000000..a03fcc9f92
--- /dev/null
+++ b/package/network/services/hostapd/patches/610-hostapd_cli_ujail_permission.patch
@@ -0,0 +1,33 @@
+--- a/src/common/wpa_ctrl.c
++++ b/src/common/wpa_ctrl.c
+@@ -135,7 +135,7 @@ try_again:
+ return NULL;
+ }
+ tries++;
+-#ifdef ANDROID
++
+ /* Set client socket file permissions so that bind() creates the client
+ * socket with these permissions and there is no need to try to change
+ * them with chmod() after bind() which would have potential issues with
+@@ -147,7 +147,7 @@ try_again:
+ * operations to allow the response to go through. Those are using the
+ * no-deference-symlinks version to avoid races. */
+ fchmod(ctrl->s, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP);
+-#endif /* ANDROID */
++
+ if (bind(ctrl->s, (struct sockaddr *) &ctrl->local,
+ sizeof(ctrl->local)) < 0) {
+ if (errno == EADDRINUSE && tries < 2) {
+@@ -165,7 +165,11 @@ try_again:
+ return NULL;
+ }
+
+-#ifdef ANDROID
++#ifndef ANDROID
++ /* Set group even if we do not have privileges to change owner */
++ lchown(ctrl->local.sun_path, -1, 101);
++ lchown(ctrl->local.sun_path, 101, 101);
++#else
+ /* Set group even if we do not have privileges to change owner */
+ lchown(ctrl->local.sun_path, -1, AID_WIFI);
+ lchown(ctrl->local.sun_path, AID_SYSTEM, AID_WIFI);
--
2.25.1

View File

@@ -0,0 +1,622 @@
From 1eb2dea202bbb22ba34130ce9802e72c1c03cf7a Mon Sep 17 00:00:00 2001
From: John Crispin <john@phrozen.org>
Date: Mon, 29 Nov 2021 10:43:53 +0100
Subject: [PATCH] ipq807x: add support fro wallytech DR6018-v4
Signed-off-by: John Crispin <john@phrozen.org>
---
.../ipq807x/base-files/etc/board.d/01_leds | 1 +
.../ipq807x/base-files/etc/board.d/02_network | 4 +
.../etc/hotplug.d/firmware/10-ath11k-caldata | 1 +
.../base-files/lib/upgrade/platform.sh | 2 +
.../dts/qcom-ipq6018-wallys-dr6018-v4.dts | 18 +
.../qcom/qcom-ipq6018-wallys-dr6018-v4.dts | 492 ++++++++++++++++++
target/linux/ipq807x/image/ipq60xx.mk | 9 +
7 files changed, 527 insertions(+)
create mode 100644 target/linux/ipq807x/files/arch/arm/boot/dts/qcom-ipq6018-wallys-dr6018-v4.dts
create mode 100755 target/linux/ipq807x/files/arch/arm64/boot/dts/qcom/qcom-ipq6018-wallys-dr6018-v4.dts
diff --git a/target/linux/ipq807x/base-files/etc/board.d/01_leds b/target/linux/ipq807x/base-files/etc/board.d/01_leds
index ab19fd0532..d47a7e55ed 100755
--- a/target/linux/ipq807x/base-files/etc/board.d/01_leds
+++ b/target/linux/ipq807x/base-files/etc/board.d/01_leds
@@ -9,6 +9,7 @@ board=$(board_name)
case "$board" in
sercomm,wallaby|\
wallys,dr6018|\
+wallys,dr6018-v4|\
cig,wf188n|\
cig,wf194c|\
cig,wf194c4)
diff --git a/target/linux/ipq807x/base-files/etc/board.d/02_network b/target/linux/ipq807x/base-files/etc/board.d/02_network
index 89db0cc5a4..7c81bb50e7 100755
--- a/target/linux/ipq807x/base-files/etc/board.d/02_network
+++ b/target/linux/ipq807x/base-files/etc/board.d/02_network
@@ -50,6 +50,10 @@ qcom_setup_interfaces()
ucidef_set_interface_lan "eth0 eth1 eth2 eth3"
ucidef_set_interface_wan "eth4"
;;
+ wallys,dr6018-v4)
+ ucidef_set_interface_lan "eth1 eth2 eth3 eth4"
+ ucidef_set_interface_wan "eth0"
+ ;;
esac
}
diff --git a/target/linux/ipq807x/base-files/etc/hotplug.d/firmware/10-ath11k-caldata b/target/linux/ipq807x/base-files/etc/hotplug.d/firmware/10-ath11k-caldata
index ba7991759e..7f081a6b5f 100755
--- a/target/linux/ipq807x/base-files/etc/hotplug.d/firmware/10-ath11k-caldata
+++ b/target/linux/ipq807x/base-files/etc/hotplug.d/firmware/10-ath11k-caldata
@@ -60,6 +60,7 @@ case "$FIRMWARE" in
hfcl,ion4xi|\
hfcl,ion4xe|\
wallys,dr6018|\
+ wallys,dr6018-v4|\
qcom,ipq6018-cp01|\
xiaomi,ax1800)
caldata_extract "0:ART" 0x1000 0x20000
diff --git a/target/linux/ipq807x/base-files/lib/upgrade/platform.sh b/target/linux/ipq807x/base-files/lib/upgrade/platform.sh
index ef8cce8614..50ba925a48 100755
--- a/target/linux/ipq807x/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ipq807x/base-files/lib/upgrade/platform.sh
@@ -25,6 +25,7 @@ platform_check_image() {
cig,wf194c|\
cig,wf194c4|\
wallys,dr6018|\
+ wallys,dr6018-v4|\
edgecore,eap101|\
edgecore,eap102|\
edgecore,eap106|\
@@ -62,6 +63,7 @@ platform_do_upgrade() {
qcom,ipq807x-hk14|\
qcom,ipq5018-mp03.3|\
wallys,dr6018|\
+ wallys,dr6018-v4|\
tplink,ex447|\
tplink,ex227)
nand_upgrade_tar "$1"
diff --git a/target/linux/ipq807x/files/arch/arm/boot/dts/qcom-ipq6018-wallys-dr6018-v4.dts b/target/linux/ipq807x/files/arch/arm/boot/dts/qcom-ipq6018-wallys-dr6018-v4.dts
new file mode 100644
index 0000000000..470e437e41
--- /dev/null
+++ b/target/linux/ipq807x/files/arch/arm/boot/dts/qcom-ipq6018-wallys-dr6018-v4.dts
@@ -0,0 +1,18 @@
+/*
+ * Copyright (c) 2020, The Linux Foundation. All rights reserved.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include "../../../arm64/boot/dts/qcom/qcom-ipq6018-wallys-dr6018-v4.dts"
+#include "qcom-ipq6018.dtsi"
diff --git a/target/linux/ipq807x/files/arch/arm64/boot/dts/qcom/qcom-ipq6018-wallys-dr6018-v4.dts b/target/linux/ipq807x/files/arch/arm64/boot/dts/qcom/qcom-ipq6018-wallys-dr6018-v4.dts
new file mode 100755
index 0000000000..a00c106adc
--- /dev/null
+++ b/target/linux/ipq807x/files/arch/arm64/boot/dts/qcom/qcom-ipq6018-wallys-dr6018-v4.dts
@@ -0,0 +1,492 @@
+/dts-v1/;
+/*
+ * Copyright (c) 2019, The Linux Foundation. All rights reserved.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include "qcom-ipq6018.dtsi"
+#include "qcom-ipq6018-rpm-regulator.dtsi"
+#include "qcom-ipq6018-cpr-regulator.dtsi"
+#include "qcom-ipq6018-cp-cpu.dtsi"
+#include <dt-bindings/input/input.h>
+#include <dt-bindings/gpio/gpio.h>
+
+/ {
+ #address-cells = <0x2>;
+ #size-cells = <0x2>;
+ model = "Wallys DR6018 V4";
+ compatible = "wallys,dr6018-v4", "qcom,ipq6018-cp01", "qcom,ipq6018";
+ interrupt-parent = <&intc>;
+
+ aliases {
+ serial0 = &blsp1_uart3;
+ serial1 = &blsp1_uart2;
+
+ /*
+ * Aliases as required by u-boot
+ * to patch MAC addresses
+ */
+ ethernet0 = "/soc/dp1";
+ ethernet1 = "/soc/dp2";
+ ethernet2 = "/soc/dp3";
+ ethernet3 = "/soc/dp4";
+ ethernet4 = "/soc/dp5";
+
+ sdhc2 = "/soc/sdhci_sd@7804000";
+
+ led-boot = &led_power;
+ led-failsafe = &led_power;
+ led-running = &led_power;
+ led-upgrade = &led_power;
+ };
+
+ chosen {
+ bootargs = "console=ttyMSM0,115200,n8 rw init=/init";
+ bootargs-append = " console=ttyMSM0,115200,n8 swiotlb=1 coherent_pool=2M";
+ };
+
+ /*
+ * +=========+==============+========================+
+ * | | | |
+ * | Region | Start Offset | Size |
+ * | | | |
+ * +--------+--------------+-------------------------+
+ * | | | |
+ * | | | |
+ * | | | |
+ * | | | |
+ * | Linux | 0x41000000 | 139MB |
+ * | | | |
+ * | | | |
+ * | | | |
+ * +--------+--------------+-------------------------+
+ * | TZ App | 0x49B00000 | 6MB |
+ * +--------+--------------+-------------------------+
+ *
+ * From the available 145 MB for Linux in the first 256 MB,
+ * we are reserving 6 MB for TZAPP.
+ *
+ * Refer arch/arm64/boot/dts/qcom/qcom-ipq6018-memory.dtsi
+ * for memory layout.
+ */
+
+/* TZAPP is enabled only in default memory profile */
+#if !defined(__IPQ_MEM_PROFILE_256_MB__) && !defined(__IPQ_MEM_PROFILE_512_MB__)
+ reserved-memory {
+ tzapp:tzapp@49B00000 { /* TZAPPS */
+ no-map;
+ reg = <0x0 0x49B00000 0x0 0x00600000>;
+ };
+ };
+#endif
+};
+
+&tlmm {
+ uart_pins: uart_pins {
+ mux {
+ pins = "gpio44", "gpio45";
+ function = "blsp2_uart";
+ drive-strength = <8>;
+ bias-pull-down;
+ };
+ };
+
+ sd_pins: sd_pins {
+ mux {
+ pins = "gpio62";
+ function = "sd_card";
+ drive-strength = <8>;
+ bias-pull-up;
+ };
+ };
+
+ spi_0_pins: spi_0_pins {
+ mux {
+ pins = "gpio38", "gpio39", "gpio40", "gpio41";
+ function = "blsp0_spi";
+ drive-strength = <8>;
+ bias-pull-down;
+ };
+ };
+
+ qpic_pins: qpic_pins {
+ data_0 {
+ pins = "gpio15";
+ function = "qpic_pad0";
+ drive-strength = <8>;
+ bias-pull-down;
+ };
+ data_1 {
+ pins = "gpio12";
+ function = "qpic_pad1";
+ drive-strength = <8>;
+ bias-pull-down;
+ };
+ data_2 {
+ pins = "gpio13";
+ function = "qpic_pad2";
+ drive-strength = <8>;
+ bias-pull-down;
+ };
+ data_3 {
+ pins = "gpio14";
+ function = "qpic_pad3";
+ drive-strength = <8>;
+ bias-pull-down;
+ };
+ data_4 {
+ pins = "gpio5";
+ function = "qpic_pad4";
+ drive-strength = <8>;
+ bias-pull-down;
+ };
+ data_5 {
+ pins = "gpio6";
+ function = "qpic_pad5";
+ drive-strength = <8>;
+ bias-pull-down;
+ };
+ data_6 {
+ pins = "gpio7";
+ function = "qpic_pad6";
+ drive-strength = <8>;
+ bias-pull-down;
+ };
+ data_7 {
+ pins = "gpio8";
+ function = "qpic_pad7";
+ drive-strength = <8>;
+ bias-pull-down;
+ };
+ qpic_pad {
+ pins = "gpio1", "gpio3", "gpio4",
+ "gpio10", "gpio11", "gpio17";
+ function = "qpic_pad";
+ drive-strength = <8>;
+ bias-pull-down;
+ };
+ };
+
+ extcon_usb_pins: extcon_usb_pins {
+ mux {
+ pins = "gpio26";
+ function = "gpio";
+ drive-strength = <2>;
+ bias-pull-down;
+ };
+ };
+
+ button_pins: button_pins {
+ wps_button {
+ pins = "gpio19";
+ function = "gpio";
+ drive-strength = <8>;
+ bias-pull-up;
+ };
+ };
+
+ mdio_pins: mdio_pinmux {
+ mux_0 {
+ pins = "gpio64";
+ function = "mdc";
+ drive-strength = <8>;
+ bias-pull-up;
+ };
+ mux_1 {
+ pins = "gpio65";
+ function = "mdio";
+ drive-strength = <8>;
+ bias-pull-up;
+ };
+ mux_2 {
+ pins = "gpio75";
+ function = "gpio";
+ bias-pull-up;
+ };
+ };
+
+ leds_pins: leds_pins {
+ led_pwr {
+ pins = "gpio74";
+ function = "gpio";
+ drive-strength = <8>;
+ bias-pull-down;
+ };
+ led_5g {
+ pins = "gpio35";
+ function = "gpio";
+ drive-strength = <8>;
+ bias-pull-down;
+ };
+ led_2g {
+ pins = "gpio37";
+ function = "gpio";
+ drive-strength = <8>;
+ bias-pull-down;
+ };
+ };
+ uart2_pins: uart2_pins {
+ mux {
+ pins = "gpio57", "gpio58";
+ function = "blsp4_uart";
+ drive-strength = <8>;
+ bias-pull-down;
+ };
+ };
+};
+
+&soc {
+ extcon_usb: extcon_usb {
+ pinctrl-0 = <&extcon_usb_pins>;
+ pinctrl-names = "default";
+ id-gpio = <&tlmm 26 GPIO_ACTIVE_LOW>;
+ status = "ok";
+ };
+
+ mdio: mdio@90000 {
+ pinctrl-0 = <&mdio_pins>;
+ pinctrl-names = "default";
+ phy-reset-gpio = <&tlmm 75 0 &tlmm 77 1>;
+ status = "ok";
+ ethernet-phy@3 {
+ reg = <0x03>;
+ };
+
+ ethernet-phy@4 {
+ reg = <0x18>;
+ };
+
+ ethernet-phy@1 {
+ reg = <0x01>;
+ };
+
+ ethernet-phy@2 {
+ reg = <0x02>;
+ };
+
+ ethernet-phy@0 {
+ reg = <0x00>;
+ };
+ };
+
+ dp1 {
+ device_type = "network";
+ compatible = "qcom,nss-dp";
+ qcom,id = <1>;
+ reg = <0x3a001000 0x200>;
+ qcom,mactype = <0>;
+ local-mac-address = [000000000000];
+ qcom,link-poll = <1>;
+ qcom,phy-mdio-addr = <0>;
+ phy-mode = "sgmii";
+ };
+
+ dp2 {
+ device_type = "network";
+ compatible = "qcom,nss-dp";
+ qcom,id = <2>;
+ reg = <0x3a001200 0x200>;
+ qcom,mactype = <0>;
+ local-mac-address = [000000000000];
+ qcom,link-poll = <1>;
+ qcom,phy-mdio-addr = <1>;
+ phy-mode = "sgmii";
+ };
+
+ dp3 {
+ device_type = "network";
+ compatible = "qcom,nss-dp";
+ qcom,id = <3>;
+ reg = <0x3a001400 0x200>;
+ qcom,mactype = <0>;
+ local-mac-address = [000000000000];
+ qcom,link-poll = <1>;
+ qcom,phy-mdio-addr = <2>;
+ phy-mode = "sgmii";
+ };
+
+ dp4 {
+ device_type = "network";
+ compatible = "qcom,nss-dp";
+ qcom,id = <4>;
+ reg = <0x3a001600 0x200>;
+ qcom,mactype = <0>;
+ local-mac-address = [000000000000];
+ qcom,link-poll = <1>;
+ qcom,phy-mdio-addr = <3>;
+ phy-mode = "sgmii";
+ };
+
+ dp5 {
+ device_type = "network";
+ compatible = "qcom,nss-dp";
+ qcom,id = <5>;
+ reg = <0x3a001800 0x200>;
+ qcom,mactype = <0>;
+ local-mac-address = [000000000000];
+ qcom,link-poll = <1>;
+ qcom,phy-mdio-addr = <0x18>;
+ phy-mode = "sgmii";
+ };
+
+ ess-switch@3a000000 {
+ switch_cpu_bmp = <0x1>; /* cpu port bitmap */
+ switch_lan_bmp = <0x3c>; /* lan port bitmap */
+ switch_wan_bmp = <0x2>; /* wan port bitmap */
+ switch_inner_bmp = <0xc0>; /*inner port bitmap*/
+ switch_mac_mode = <0x0>; /* mac mode for uniphy instance0*/
+ switch_mac_mode1 = <0xf>; /* mac mode for uniphy instance1*/
+ switch_mac_mode2 = <0xff>; /* mac mode for uniphy instance2*/
+ qcom,port_phyinfo {
+ port@1 {
+ phy_address = <0x01>;
+ port_id = <0x02>;
+ };
+
+ port@0 {
+ phy_address = <0x00>;
+ port_id = <0x01>;
+ };
+
+ port@2 {
+ phy_address = <0x02>;
+ port_id = <0x03>;
+ };
+
+ port@3 {
+ phy_address = <0x03>;
+ port_id = <0x04>;
+ };
+
+ port@4 {
+ phy_address = <0x18>;
+ port_id = <0x05>;
+ port_mac_sel = "QGMAC_PORT";
+ };
+ };
+ };
+
+ gpio_keys {
+ compatible = "gpio-keys";
+ pinctrl-0 = <&button_pins>;
+ pinctrl-names = "default";
+
+ reset {
+ label = "reset";
+ linux,code = <KEY_RESTART>;
+ gpios = <&tlmm 19 GPIO_ACTIVE_LOW>;
+ linux,input-type = <1>;
+ debounce-interval = <60>;
+ };
+ };
+
+ leds {
+ compatible = "gpio-leds";
+ pinctrl-0 = <&leds_pins>;
+ pinctrl-names = "default";
+
+ led@25 {
+ label = "green:wifi5";
+ gpios = <&tlmm 35 GPIO_ACTIVE_HIGH>;
+ linux,default-trigger = "green:5g";
+ default-state = "off";
+ };
+ led@24 {
+ label = "green:wifi2";
+ gpios = <&tlmm 37 GPIO_ACTIVE_HIGH>;
+ linux,default-trigger = "green:2g";
+ default-state = "off";
+ };
+ led_power: led@16 {
+ label = "green:led_pwr";
+ gpios = <&tlmm 50 GPIO_ACTIVE_HIGH>;
+ linux,default-trigger = "green:power";
+ default-state = "off";
+ };
+ };
+};
+
+&blsp1_uart3 {
+ pinctrl-0 = <&uart_pins>;
+ pinctrl-names = "default";
+ status = "ok";
+};
+
+&spi_0 {
+ pinctrl-0 = <&spi_0_pins>;
+ pinctrl-names = "default";
+ cs-select = <0>;
+ status = "ok";
+
+ m25p80@0 {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ reg = <0>;
+ compatible = "n25q128a11";
+ linux,modalias = "m25p80", "n25q128a11";
+ spi-max-frequency = <50000000>;
+ use-default-sizes;
+ };
+};
+
+&blsp1_uart2 {
+ pinctrl-0 = <&uart2_pins>;
+ pinctrl-names = "default";
+ dmas = <&blsp_dma 2>,
+ <&blsp_dma 3>;
+ dma-names = "tx", "rx";
+ status = "ok";
+};
+&qpic_bam {
+ status = "ok";
+};
+
+&nand {
+ pinctrl-0 = <&qpic_pins>;
+ pinctrl-names = "default";
+ status = "ok";
+};
+
+&ssphy_0 {
+ status = "ok";
+};
+
+&qusb_phy_0 {
+ status = "ok";
+};
+
+&qusb_phy_1 {
+ status = "ok";
+};
+
+&usb2 {
+ status = "ok";
+};
+
+&usb3 {
+ status = "ok";
+};
+
+&nss_crypto {
+ status = "ok";
+};
+
+&sdhc_2 {
+ pinctrl-0 = <&sd_pins>;
+ pinctrl-names = "default";
+ cd-gpios = <&tlmm 62 1>;
+ sd-ldo-gpios = <&tlmm 66 0>;
+ //vqmmc-supply = <&ipq6018_l2_corner>;
+ status = "ok";
+};
diff --git a/target/linux/ipq807x/image/ipq60xx.mk b/target/linux/ipq807x/image/ipq60xx.mk
index 30ec2160bc..4c779435f5 100644
--- a/target/linux/ipq807x/image/ipq60xx.mk
+++ b/target/linux/ipq807x/image/ipq60xx.mk
@@ -56,6 +56,15 @@ define Device/wallys_dr6018
endef
TARGET_DEVICES += wallys_dr6018
+define Device/wallys_dr6018_v4
+ DEVICE_TITLE := Wallys DR6018 V4
+ DEVICE_DTS := qcom-ipq6018-wallys-dr6018-v4
+ DEVICE_DTS_CONFIG := config@cp01-c4
+ SUPPORTED_DEVICES := wallys,dr6018-v4
+ DEVICE_PACKAGES := ath11k-wifi-wallys-dr6018-v4 uboot-envtools
+endef
+TARGET_DEVICES += wallys_dr6018_v4
+
define Device/qcom_cp01_c1
DEVICE_TITLE := Qualcomm Cypress C1
DEVICE_DTS := qcom-ipq6018-cp01-c1
--
2.25.1

12
profiles/hfcl_ion4xe.yml Normal file
View File

@@ -0,0 +1,12 @@
---
profile: hfcl_ion4xe
target: ipq807x
subtarget: ipq60xx
description: Build image for the HFCL ION 4XE
image: bin/targets/ipq807x/ipq60xx/openwrt-ipq807x-hfcl_ion4xe-squashfs-sysupgrade.tar
feeds:
- name: ipq807x
path: ../../feeds/ipq807x
include:
- wifi-ax
- ucentral-ap

12
profiles/hfcl_ion4xi.yml Normal file
View File

@@ -0,0 +1,12 @@
---
profile: hfcl_ion4xi
target: ipq807x
subtarget: ipq60xx
description: Build image for the HFCL ION 4XI
image: bin/targets/ipq807x/ipq60xx/openwrt-ipq807x-hfcl_ion4xi-squashfs-sysupgrade.tar
feeds:
- name: ipq807x
path: ../../feeds/ipq807x
include:
- wifi-ax
- ucentral-ap

23
profiles/qosify.yml Normal file
View File

@@ -0,0 +1,23 @@
---
description: Add qosify package
packages:
- qosify
host_dependecies:
- name: llvm/clang-12
warning: >
Building llvm/clang, this will take 1hr+, please install clang/llvm-12+
on your system
which:
- clang-13
- clang-12
success_diffconfig: |
CONFIG_DEVEL=y
CONFIG_BPF_TOOLCHAIN_HOST=y
fallback_diffconfig: |
CONFIG_DEVEL=y
CONFIG_BPF_TOOLCHAIN_BUILD_LLVM=y

View File

@@ -10,3 +10,5 @@ feeds:
include:
- wifi-ax
- ucentral-ap
diffconfig: |
CONFIG_KERNEL_IPQ_MEM_PROFILE=0

View File

@@ -10,3 +10,5 @@ feeds:
include:
- wifi-ax
- ucentral-ap
diffconfig: |
CONFIG_KERNEL_IPQ_MEM_PROFILE=0

View File

@@ -8,6 +8,7 @@ feeds:
include:
- webui
- qosify
packages:
- kmod-batman-adv
@@ -16,7 +17,6 @@ packages:
- ip-bridge
- maverick
- ratelimit
- qosify
- tip-defaults
- ucentral-client
- ucentral-event

View File

@@ -8,6 +8,7 @@ feeds:
include:
- webui
- qosify
packages:
- firstcontact
@@ -16,7 +17,6 @@ packages:
- maverick
- ratelimit
- rtty-openssl
- qosify
- tip-defaults
- ucentral-client
- ucentral-event

View File

@@ -11,8 +11,10 @@ include:
- openflow
- fbwifi
- chilli-redirect
- qosify
packages:
- atfpolicy
- kmod-batman-adv
- batctl-default
- cJSON
@@ -28,7 +30,6 @@ packages:
- lldpd
- maverick
- opennds
- qosify
- radsecproxy
- ratelimit
- rtty-openssl
@@ -43,6 +44,7 @@ packages:
- ucentral-tools
- ucode
- udhcpsnoop
- udnssnoop
- usteer
- ustp
- libustream-openssl

View File

@@ -0,0 +1,14 @@
---
profile: wallys_dr6018_v4
target: ipq807x
subtarget: ipq60xx
description: Build image for the Wallys DR6018 V4
image: bin/targets/ipq807x/ipq60xx/openwrt-ipq807x-wallys_dr6018_v4-squashfs-sysupgrade.tar
feeds:
- name: ipq807x
path: ../../feeds/ipq807x
include:
- wifi-ax
- ucentral-ap
diffconfig: |
CONFIG_KERNEL_IPQ_MEM_PROFILE=0

12
profiles/x64_vmware.yml Normal file
View File

@@ -0,0 +1,12 @@
---
profile: x64_vmware
target: x86
subtarget: 64
description: Vmware build image for x64
image: bin/targets/x86/64/openwrt-x86-64-generic-ext4-combined-efi.img.gz
include:
- ucentral-ap
diffconfig: |
CONFIG_VMDK_IMAGES=y
CONFIG_ISO_IMAGES=y
CONFIG_VDI_IMAGES=y