mirror of
				https://github.com/Telecominfraproject/wlan-ap.git
				synced 2025-10-31 02:17:58 +00:00 
			
		
		
		
	Compare commits
	
		
			64 Commits
		
	
	
		
			v2.3.0-rc3
			...
			v2.4.0-rc2
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|   | 769e8c5c0b | ||
|   | 04c3325710 | ||
|   | 7c1fd79ceb | ||
|   | 1e950be127 | ||
|   | 5fc7ac166a | ||
|   | 87be030169 | ||
|   | b0688f097b | ||
|   | ae77be4e5c | ||
|   | efac512c90 | ||
|   | bcde3ee6d7 | ||
|   | 7b0ef7f265 | ||
|   | 670f9fee14 | ||
|   | 4c7ee4bf6d | ||
|   | 90868338c7 | ||
|   | 7a20f558e1 | ||
|   | 9b8c1f8449 | ||
|   | 002880c3fa | ||
|   | 3de5c91e6c | ||
|   | 679e20af39 | ||
|   | 191081e46f | ||
|   | 8f7a66f1ac | ||
|   | c93b14ca7a | ||
|   | 16176a1cc3 | ||
|   | a4806f740d | ||
|   | 35740f321d | ||
|   | 74c148e905 | ||
|   | a77d881147 | ||
|   | 065539bbb3 | ||
|   | e2d90a7b06 | ||
|   | 8bb9816e2b | ||
|   | 9673329c07 | ||
|   | 2571ae5210 | ||
|   | 8caffe46b4 | ||
|   | 25641d5199 | ||
|   | 2b3cc2a5cf | ||
|   | 12cc29265c | ||
|   | 34a6f06bd9 | ||
|   | c343d5e629 | ||
|   | 501907eeda | ||
|   | ba406fe01b | ||
|   | d61d5cd35e | ||
|   | 68d544c9af | ||
|   | 5d86871253 | ||
|   | 460785cbe3 | ||
|   | 1cace058c5 | ||
|   | 5aaf734732 | ||
|   | 9d3768a68d | ||
|   | 975aae507b | ||
|   | cc0576886a | ||
|   | 9c36b155f6 | ||
|   | 28ac14ccc4 | ||
|   | e18e7fc8f6 | ||
|   | 04d78d3334 | ||
|   | a9fd11ed8a | ||
|   | 839f43c010 | ||
|   | f599a42618 | ||
|   | 8bc7bee3bc | ||
|   | 53004cc39c | ||
|   | 9a1c8cff9f | ||
|   | 2d0e2bccbf | ||
|   | 70c2c36e0f | ||
|   | 11ed0b089c | ||
|   | 29058df59b | ||
|   | e840bab8cc | 
							
								
								
									
										2
									
								
								.github/workflows/build-dev.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.github/workflows/build-dev.yml
									
									
									
									
										vendored
									
									
								
							| @@ -11,7 +11,7 @@ jobs: | |||||||
|     strategy: |     strategy: | ||||||
|       fail-fast: false |       fail-fast: false | ||||||
|       matrix: |       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: |     steps: | ||||||
|     - uses: actions/checkout@v2 |     - uses: actions/checkout@v2 | ||||||
|   | |||||||
| @@ -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> | From: John Crispin <john@phrozen.org> | ||||||
| Date: Tue, 18 May 2021 10:46:43 +0200 | 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> | 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(-) |  1 file changed, 4 insertions(+), 4 deletions(-) | ||||||
|  |  | ||||||
| diff --git a/package/libs/libubox/Makefile b/package/libs/libubox/Makefile | 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 | --- a/package/libs/libubox/Makefile | ||||||
| +++ b/package/libs/libubox/Makefile | +++ b/package/libs/libubox/Makefile | ||||||
| @@ -5,9 +5,9 @@ PKG_RELEASE=2 | @@ -5,9 +5,9 @@ PKG_RELEASE=2 | ||||||
| @@ -19,9 +19,9 @@ index d2c07783e1..33aa73eef7 100644 | |||||||
| -PKG_MIRROR_HASH:=7dd1db1e0074a9c7c722db654cce3111b3bd3cff0bfd791c4497cb0f6c22d3ca | -PKG_MIRROR_HASH:=7dd1db1e0074a9c7c722db654cce3111b3bd3cff0bfd791c4497cb0f6c22d3ca | ||||||
| -PKG_SOURCE_DATE:=2021-05-16 | -PKG_SOURCE_DATE:=2021-05-16 | ||||||
| -PKG_SOURCE_VERSION:=b14c4688612c05c78ce984d7bde633bce8703b1e | -PKG_SOURCE_VERSION:=b14c4688612c05c78ce984d7bde633bce8703b1e | ||||||
| +PKG_MIRROR_HASH:=1cdb91ac0ee925f133ee9f70eac131a99def312fe7cf0aed44df84eb1762e30b | +PKG_MIRROR_HASH:=82d84fb97e725b0a18ceac639cae0c17d922754bb648ff58c62069d92798a6cd | ||||||
| +PKG_SOURCE_DATE:=2021-08-19 | +PKG_SOURCE_DATE:=2021-08-19 | ||||||
| +PKG_SOURCE_VERSION:=d716ac4bc4236031d4c3cc1ed362b502e20e3787 | +PKG_SOURCE_VERSION:=c86a894ec63d83ecf2c373bbf9dc8fba9713d942 | ||||||
|  PKG_ABI_VERSION:=$(call abi_version_str,$(PKG_SOURCE_DATE)) |  PKG_ABI_VERSION:=$(call abi_version_str,$(PKG_SOURCE_DATE)) | ||||||
|  CMAKE_INSTALL:=1 |  CMAKE_INSTALL:=1 | ||||||
|   |   | ||||||
|   | |||||||
| @@ -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> | From: John Crispin <john@phrozen.org> | ||||||
| Date: Thu, 27 May 2021 13:24:47 +0200 | 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> | Signed-off-by: John Crispin <john@phrozen.org> | ||||||
| --- | --- | ||||||
|  package/network/config/netifd/Makefile        |  8 ++-- |  package/network/config/netifd/Makefile        |  8 ++-- | ||||||
|  .../netifd/patches/002-fix-dhcp-issue.patch   | 17 +++++++++ |  | ||||||
|  .../config/netifd/patches/100-script.patch    | 21 +++++++++++ |  .../config/netifd/patches/100-script.patch    | 21 +++++++++++ | ||||||
|  .../config/netifd/patches/hairpin.patch       | 37 +++++++++++++++++++ |  .../config/netifd/patches/hairpin.patch       | 37 +++++++++++++++++++ | ||||||
|  4 files changed, 78 insertions(+), 5 deletions(-) |  3 files changed, 61 insertions(+), 5 deletions(-) | ||||||
|  create mode 100644 package/network/config/netifd/patches/002-fix-dhcp-issue.patch |  | ||||||
|  create mode 100644 package/network/config/netifd/patches/100-script.patch |  create mode 100644 package/network/config/netifd/patches/100-script.patch | ||||||
|  create mode 100644 package/network/config/netifd/patches/hairpin.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)/package.mk | ||||||
|  include $(INCLUDE_DIR)/cmake.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 | diff --git a/package/network/config/netifd/patches/100-script.patch b/package/network/config/netifd/patches/100-script.patch | ||||||
| new file mode 100644 | new file mode 100644 | ||||||
| index 0000000000..e7ba83f4bb | index 0000000000..e7ba83f4bb | ||||||
|   | |||||||
| @@ -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> | From: John Crispin <john@phrozen.org> | ||||||
| Date: Sat, 4 Sep 2021 05:47:27 +0200 | 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> | 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/ath.mk                |    5 +- | ||||||
|  package/kernel/mac80211/broadcom.mk           |    4 +- |  package/kernel/mac80211/broadcom.mk           |    4 +- | ||||||
|  .../mac80211/files/lib/netifd/mac80211.sh     |   36 - |  .../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 +- |  .../mac80211/files/lib/wifi/mac80211.sh       |  110 +- | ||||||
|  .../patches/ath/120-owl-loader-compat.patch   |   53 - |  .../patches/ath/120-owl-loader-compat.patch   |   53 - | ||||||
|  .../patches/ath/402-ath_regd_optional.patch   |    2 +- |  .../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 + |  ...eck-per-vif-offload_flags-in-Tx-path.patch |   26 + | ||||||
|  .../500-mac80211_configure_antenna_gain.patch |   16 +- |  .../500-mac80211_configure_antenna_gain.patch |   16 +- | ||||||
|  ...the-dst-buffer-to-of_get_mac_address.patch |  237 +++ |  ...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/files/lib/netifd/mac80211.sh | ||||||
|  delete mode 100644 package/kernel/mac80211/patches/ath/120-owl-loader-compat.patch |  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%) |  rename package/kernel/mac80211/patches/{ath => ath10k}/080-ath10k_thermal_config.patch (97%) | ||||||
| @@ -286,7 +286,7 @@ index 92e5c0e395..0000000000 | |||||||
| -	done | -	done | ||||||
| -} | -} | ||||||
| diff --git a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh | 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 | --- a/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh | ||||||
| +++ b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh | +++ b/package/kernel/mac80211/files/lib/netifd/wireless/mac80211.sh | ||||||
| @@ -1,7 +1,6 @@ | @@ -1,7 +1,6 @@ | ||||||
| @@ -310,7 +310,7 @@ index 9a9c35fb5f..a25e4ff9b2 100644 | |||||||
|  	config_add_boolean noscan ht_coex acs_exclude_dfs |  	config_add_boolean noscan ht_coex acs_exclude_dfs | ||||||
|  	config_add_array ht_capab |  	config_add_array ht_capab | ||||||
|  	config_add_array channels |  	config_add_array channels | ||||||
| @@ -44,11 +43,24 @@ drv_mac80211_init_device_config() { | @@ -44,11 +43,26 @@ drv_mac80211_init_device_config() { | ||||||
|  		su_beamformee \ |  		su_beamformee \ | ||||||
|  		mu_beamformer \ |  		mu_beamformer \ | ||||||
|  		mu_beamformee \ |  		mu_beamformee \ | ||||||
| @@ -326,6 +326,8 @@ index 9a9c35fb5f..a25e4ff9b2 100644 | |||||||
| +		he_spr_sr_control \ | +		he_spr_sr_control \ | ||||||
| +		he_twt_required | +		he_twt_required | ||||||
| +	config_add_int \ | +	config_add_int \ | ||||||
|  | +		beamformer_antennas \ | ||||||
|  | +		beamformee_antennas \ | ||||||
| +		vht_max_a_mpdu_len_exp \ | +		vht_max_a_mpdu_len_exp \ | ||||||
| +		vht_max_mpdu \ | +		vht_max_mpdu \ | ||||||
| +		vht_link_adapt \ | +		vht_link_adapt \ | ||||||
| @@ -337,7 +339,7 @@ index 9a9c35fb5f..a25e4ff9b2 100644 | |||||||
|  	config_add_boolean \ |  	config_add_boolean \ | ||||||
|  		ldpc \ |  		ldpc \ | ||||||
|  		greenfield \ |  		greenfield \ | ||||||
| @@ -96,6 +108,23 @@ mac80211_add_capabilities() { | @@ -96,6 +110,23 @@ mac80211_add_capabilities() { | ||||||
|  	export -n -- "$__var=$__out" |  	export -n -- "$__var=$__out" | ||||||
|  } |  } | ||||||
|   |   | ||||||
| @@ -361,7 +363,7 @@ index 9a9c35fb5f..a25e4ff9b2 100644 | |||||||
|  mac80211_hostapd_setup_base() { |  mac80211_hostapd_setup_base() { | ||||||
|  	local phy="$1" |  	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 |  	[ "$noscan" -gt 0 ] && hostapd_noscan=1 | ||||||
|  	[ "$tx_burst" = 0 ] && tx_burst= |  	[ "$tx_burst" = 0 ] && tx_burst= | ||||||
|   |   | ||||||
| @@ -371,7 +373,7 @@ index 9a9c35fb5f..a25e4ff9b2 100644 | |||||||
|  	ieee80211n=1 |  	ieee80211n=1 | ||||||
|  	ht_capab= |  	ht_capab= | ||||||
|  	case "$htmode" in |  	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) |  		HT40*|VHT40|VHT80|VHT160|HE40|HE80|HE160) | ||||||
|  			case "$hwmode" in |  			case "$hwmode" in | ||||||
|  				a) |  				a) | ||||||
| @@ -380,7 +382,7 @@ index 9a9c35fb5f..a25e4ff9b2 100644 | |||||||
|  						1) ht_capab="[HT40+]";; |  						1) ht_capab="[HT40+]";; | ||||||
|  						0) ht_capab="[HT40-]";; |  						0) ht_capab="[HT40-]";; | ||||||
|  					esac |  					esac | ||||||
| @@ -200,7 +232,7 @@ mac80211_hostapd_setup_base() { | @@ -200,7 +234,7 @@ mac80211_hostapd_setup_base() { | ||||||
|  	case "$htmode" in |  	case "$htmode" in | ||||||
|  		VHT20|HE20) enable_ac=1;; |  		VHT20|HE20) enable_ac=1;; | ||||||
|  		VHT40|HE40) |  		VHT40|HE40) | ||||||
| @@ -389,7 +391,7 @@ index 9a9c35fb5f..a25e4ff9b2 100644 | |||||||
|  				1) idx=$(($channel + 2));; |  				1) idx=$(($channel + 2));; | ||||||
|  				0) idx=$(($channel - 2));; |  				0) idx=$(($channel - 2));; | ||||||
|  			esac |  			esac | ||||||
| @@ -208,7 +240,7 @@ mac80211_hostapd_setup_base() { | @@ -208,7 +242,7 @@ mac80211_hostapd_setup_base() { | ||||||
|  			vht_center_seg0=$idx |  			vht_center_seg0=$idx | ||||||
|  		;; |  		;; | ||||||
|  		VHT80|HE80) |  		VHT80|HE80) | ||||||
| @@ -398,7 +400,7 @@ index 9a9c35fb5f..a25e4ff9b2 100644 | |||||||
|  				1) idx=$(($channel + 6));; |  				1) idx=$(($channel + 6));; | ||||||
|  				2) idx=$(($channel + 2));; |  				2) idx=$(($channel + 2));; | ||||||
|  				3) 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 |  			vht_center_seg0=$idx | ||||||
|  		;; |  		;; | ||||||
|  		VHT160|HE160) |  		VHT160|HE160) | ||||||
| @@ -438,7 +440,35 @@ index 9a9c35fb5f..a25e4ff9b2 100644 | |||||||
|  	[ "$hwmode" = "a" ] || enable_ac=0 |  	[ "$hwmode" = "a" ] || enable_ac=0 | ||||||
|   |   | ||||||
|  	if [ "$enable_ac" != "0" ]; then |  	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 |  	esac | ||||||
|   |   | ||||||
|  	if [ "$enable_ax" != "0" ]; then |  	if [ "$enable_ax" != "0" ]; then | ||||||
| @@ -504,9 +534,23 @@ index 9a9c35fb5f..a25e4ff9b2 100644 | |||||||
|  	fi |  	fi | ||||||
|   |   | ||||||
|  	hostapd_prepare_device_config "$hostapd_conf_file" nl80211 |  	hostapd_prepare_device_config "$hostapd_conf_file" nl80211 | ||||||
| @@ -426,7 +524,11 @@ mac80211_generate_mac() { | @@ -401,6 +515,7 @@ mac80211_get_addr() { | ||||||
|  	local oIFS="$IFS"; IFS=":"; set -- $ref; IFS="$oIFS" |  | ||||||
|   |   | ||||||
|  |  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)) |  	macidx=$(($id + 1)) | ||||||
| -	[ "$((0x$mask1))" -gt 0 ] && { | -	[ "$((0x$mask1))" -gt 0 ] && { | ||||||
| + | + | ||||||
| @@ -517,7 +561,7 @@ index 9a9c35fb5f..a25e4ff9b2 100644 | |||||||
|  		b1="0x$1" |  		b1="0x$1" | ||||||
|  		[ "$id" -gt 0 ] && \ |  		[ "$id" -gt 0 ] && \ | ||||||
|  			b1=$(($b1 ^ ((($id - !($b1 & 2)) << 2)) | 0x2)) |  			b1=$(($b1 ^ ((($id - !($b1 & 2)) << 2)) | 0x2)) | ||||||
| @@ -434,7 +536,7 @@ mac80211_generate_mac() { | @@ -434,7 +556,7 @@ mac80211_generate_mac() { | ||||||
|  		return |  		return | ||||||
|  	} |  	} | ||||||
|   |   | ||||||
| @@ -526,7 +570,7 @@ index 9a9c35fb5f..a25e4ff9b2 100644 | |||||||
|  		printf "%s:%s:%s:%s:%s:%02x" $1 $2 $3 $4 $5 $(( 0x$6 ^ $id )) |  		printf "%s:%s:%s:%s:%s:%02x" $1 $2 $3 $4 $5 $(( 0x$6 ^ $id )) | ||||||
|  		return |  		return | ||||||
|  	} |  	} | ||||||
| @@ -449,7 +551,7 @@ mac80211_generate_mac() { | @@ -449,7 +571,7 @@ mac80211_generate_mac() { | ||||||
|  find_phy() { |  find_phy() { | ||||||
|  	[ -n "$phy" -a -d /sys/class/ieee80211/$phy ] && return 0 |  	[ -n "$phy" -a -d /sys/class/ieee80211/$phy ] && return 0 | ||||||
|  	[ -n "$path" ] && { |  	[ -n "$path" ] && { | ||||||
| @@ -535,7 +579,7 @@ index 9a9c35fb5f..a25e4ff9b2 100644 | |||||||
|  		[ -n "$phy" ] && return 0 |  		[ -n "$phy" ] && return 0 | ||||||
|  	} |  	} | ||||||
|  	[ -n "$macaddr" ] && { |  	[ -n "$macaddr" ] && { | ||||||
| @@ -528,7 +630,7 @@ mac80211_iw_interface_add() { | @@ -528,11 +650,12 @@ mac80211_iw_interface_add() { | ||||||
|  		rc="$?" |  		rc="$?" | ||||||
|  	} |  	} | ||||||
|   |   | ||||||
| @@ -544,7 +588,21 @@ index 9a9c35fb5f..a25e4ff9b2 100644 | |||||||
|  	return $rc |  	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 |  	case "$htmode" in | ||||||
|  		VHT20|HT20) iw_htmode=HT20;; |  		VHT20|HT20) iw_htmode=HT20;; | ||||||
|  		HT40*|VHT40|VHT160) |  		HT40*|VHT40|VHT160) | ||||||
| @@ -561,7 +619,7 @@ index 9a9c35fb5f..a25e4ff9b2 100644 | |||||||
|  					case "$htmode" in |  					case "$htmode" in | ||||||
|  						HT40+) iw_htmode="HT40+";; |  						HT40+) iw_htmode="HT40+";; | ||||||
|  						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 |  					esac | ||||||
|  				;; |  				;; | ||||||
| @@ -574,7 +632,7 @@ index 9a9c35fb5f..a25e4ff9b2 100644 | |||||||
|  			esac |  			esac | ||||||
|  			[ "$auto_channel" -gt 0 ] && iw_htmode="HT40+" |  			[ "$auto_channel" -gt 0 ] && iw_htmode="HT40+" | ||||||
|  		;; |  		;; | ||||||
| @@ -818,7 +920,6 @@ mac80211_setup_vif() { | @@ -818,7 +941,6 @@ mac80211_setup_vif() { | ||||||
|  		mesh) |  		mesh) | ||||||
|  			wireless_vif_parse_encryption |  			wireless_vif_parse_encryption | ||||||
|  			[ -z "$htmode" ] && htmode="NOHT"; |  			[ -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 |  			if [ "$wpa" -gt 0 -o "$auto_channel" -gt 0 ] || chan_is_dfs "$phy" "$channel"; then | ||||||
|  				mac80211_setup_supplicant $vif_enable || failed=1 |  				mac80211_setup_supplicant $vif_enable || failed=1 | ||||||
|  			else |  			else | ||||||
| @@ -832,7 +933,6 @@ mac80211_setup_vif() { | @@ -832,7 +954,6 @@ mac80211_setup_vif() { | ||||||
|  		adhoc) |  		adhoc) | ||||||
|  			wireless_vif_parse_encryption |  			wireless_vif_parse_encryption | ||||||
|  			if [ "$wpa" -gt 0 -o "$auto_channel" -gt 0 ]; then |  			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 |  				mac80211_setup_supplicant_noctl $vif_enable || failed=1 | ||||||
|  			else |  			else | ||||||
|  				mac80211_setup_adhoc $vif_enable |  				mac80211_setup_adhoc $vif_enable | ||||||
| @@ -849,10 +949,30 @@ mac80211_setup_vif() { | @@ -849,10 +970,30 @@ mac80211_setup_vif() { | ||||||
|   |   | ||||||
|  get_freq() { |  get_freq() { | ||||||
|  	local phy="$1" |  	local phy="$1" | ||||||
| @@ -623,17 +681,18 @@ index 9a9c35fb5f..a25e4ff9b2 100644 | |||||||
|  chan_is_dfs() { |  chan_is_dfs() { | ||||||
|  	local phy="$1" |  	local phy="$1" | ||||||
|  	local chan="$2" |  	local chan="$2" | ||||||
| @@ -896,7 +1016,8 @@ drv_mac80211_setup() { | @@ -896,7 +1037,9 @@ drv_mac80211_setup() { | ||||||
|  		country chanbw distance \ |  		country chanbw distance \ | ||||||
|  		txpower antenna_gain \ |  		txpower antenna_gain \ | ||||||
|  		rxantenna txantenna \ |  		rxantenna txantenna \ | ||||||
| -		frag rts beacon_int:100 htmode | -		frag rts beacon_int:100 htmode | ||||||
| +		frag rts beacon_int:100 htmode \ | +		frag rts beacon_int:100 htmode \ | ||||||
|  | +		multiple_bssid:0 \ | ||||||
| +		num_global_macaddr | +		num_global_macaddr | ||||||
|  	json_get_values basic_rate_list basic_rate |  	json_get_values basic_rate_list basic_rate | ||||||
|  	json_get_values scan_list scan_list |  	json_get_values scan_list scan_list | ||||||
|  	json_select .. |  	json_select .. | ||||||
| @@ -933,7 +1054,7 @@ drv_mac80211_setup() { | @@ -933,7 +1076,7 @@ drv_mac80211_setup() { | ||||||
|  	done |  	done | ||||||
|   |   | ||||||
|  	# convert channel to frequency |  	# convert channel to frequency | ||||||
| @@ -642,7 +701,7 @@ index 9a9c35fb5f..a25e4ff9b2 100644 | |||||||
|   |   | ||||||
|  	[ -n "$country" ] && { |  	[ -n "$country" ] && { | ||||||
|  		iw reg get | grep -q "^country $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 txantenna 0xffffffff | ||||||
|  	set_default distance 0 |  	set_default distance 0 | ||||||
|  	set_default antenna_gain 0 |  	set_default antenna_gain 0 | ||||||
| @@ -650,6 +709,15 @@ index 9a9c35fb5f..a25e4ff9b2 100644 | |||||||
|   |   | ||||||
|  	[ "$txantenna" = "all" ] && txantenna=0xffffffff |  	[ "$txantenna" = "all" ] && txantenna=0xffffffff | ||||||
|  	[ "$rxantenna" = "all" ] && rxantenna=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 | diff --git a/package/kernel/mac80211/files/lib/wifi/mac80211.sh b/package/kernel/mac80211/files/lib/wifi/mac80211.sh | ||||||
| index 3e99f06693..6aa46b0c74 100644 | index 3e99f06693..6aa46b0c74 100644 | ||||||
| --- a/package/kernel/mac80211/files/lib/wifi/mac80211.sh | --- a/package/kernel/mac80211/files/lib/wifi/mac80211.sh | ||||||
|   | |||||||
| @@ -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> | From: John Crispin <john@phrozen.org> | ||||||
| Date: Sat, 4 Sep 2021 05:48:27 +0200 | 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> | Signed-off-by: John Crispin <john@phrozen.org> | ||||||
| --- | --- | ||||||
|  package/network/services/hostapd/Makefile     |  15 +- |  package/network/services/hostapd/Makefile     |  15 +- | ||||||
|  .../hostapd/files/hostapd-basic.config        |   2 +- |  .../hostapd/files/hostapd-basic.config        |   2 +- | ||||||
|  .../hostapd/files/hostapd-full.config         |   4 +- |  .../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 ------------- |  ...-fix-frequency-setup-with-HE-enabled.patch | 196 ------------- | ||||||
|  ...> 001-wolfssl-init-RNG-with-ECC-key.patch} |  11 +- |  ...> 001-wolfssl-init-RNG-with-ECC-key.patch} |  11 +- | ||||||
|  ...-init-order-disable-pri-sec-channel-.patch | 126 -------- |  ...-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.c        | 214 +++++++++++++- | ||||||
|  .../services/hostapd/src/src/ap/ubus.h        |  16 + |  .../services/hostapd/src/src/ap/ubus.h        |  16 + | ||||||
|  .../hostapd/src/src/utils/build_features.h    |   2 - |  .../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 |  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%) |  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 |  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 |  # EAP-SAKE for the integrated EAP server | ||||||
|  #CONFIG_EAP_SAKE=y |  #CONFIG_EAP_SAKE=y | ||||||
| diff --git a/package/network/services/hostapd/files/hostapd.sh b/package/network/services/hostapd/files/hostapd.sh | 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 | --- a/package/network/services/hostapd/files/hostapd.sh | ||||||
| +++ b/package/network/services/hostapd/files/hostapd.sh | +++ b/package/network/services/hostapd/files/hostapd.sh | ||||||
| @@ -48,13 +48,17 @@ hostapd_append_wpa_key_mgmt() { | @@ -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' |  	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_int iw_ipaddr_type_availability iw_gas_address3 | ||||||
|  	config_add_string iw_hessid iw_network_auth_type iw_qos_map_set |  	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 |  	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_int eap_server | ||||||
| +	config_add_string eap_user_file ca_cert server_cert private_key private_key_passwd server_id | +	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() { |  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 |  	if [ -z "$iw_anqp_3gpp_cell_net_conf" ]; then | ||||||
|  		iw_anqp_3gpp_cell_net_conf="$1" |  		iw_anqp_3gpp_cell_net_conf="$1" | ||||||
|  	else |  	else | ||||||
| @@ -322,7 +324,7 @@ index aa72e09eba..0265c0518a 100644 | |||||||
|  	fi |  	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" |  	[ -n "$1" ] && append bss_conf "nai_realm=$1" "$N" | ||||||
|  } |  } | ||||||
|   |   | ||||||
| @@ -345,7 +347,7 @@ index aa72e09eba..0265c0518a 100644 | |||||||
|  append_osu_provider_service_desc() { |  append_osu_provider_service_desc() { | ||||||
|  	append bss_conf "osu_service_desc=$1" "$N" |  	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" |  	append bss_conf "osu_method_list=$osu_method_list" "$N" | ||||||
|   |   | ||||||
|  	config_list_foreach "$1" osu_service_desc append_osu_provider_service_desc |  	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 |  	config_list_foreach "$1" osu_icon append_osu_icon | ||||||
|   |   | ||||||
|  	append bss_conf "$N" |  	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" |  	[ -n "$1" ] && append bss_conf "hs20_conn_capab=$1" "$N" | ||||||
|  } |  } | ||||||
|   |   | ||||||
| @@ -368,7 +370,7 @@ index aa72e09eba..0265c0518a 100644 | |||||||
|  append_airtime_sta_weight() { |  append_airtime_sta_weight() { | ||||||
|  	[ -n "$1" ] && append bss_conf "airtime_sta_weight=$1" "$N" |  	[ -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 \ |  		macfilter ssid utf8_ssid wmm uapsd hidden short_preamble rsn_preauth \ | ||||||
|  		iapp_interface eapol_version dynamic_vlan ieee80211w nasid \ |  		iapp_interface eapol_version dynamic_vlan ieee80211w nasid \ | ||||||
|  		acct_server acct_secret acct_port acct_interval \ |  		acct_server acct_secret acct_port acct_interval \ | ||||||
| @@ -383,7 +385,7 @@ index aa72e09eba..0265c0518a 100644 | |||||||
|   |   | ||||||
|  	set_default isolate 0 |  	set_default isolate 0 | ||||||
|  	set_default maxassoc 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 multi_ap 0 | ||||||
|  	set_default airtime_bss_weight 0 |  	set_default airtime_bss_weight 0 | ||||||
|  	set_default airtime_bss_limit 0 |  	set_default airtime_bss_limit 0 | ||||||
| @@ -391,7 +393,7 @@ index aa72e09eba..0265c0518a 100644 | |||||||
|   |   | ||||||
|  	append bss_conf "ctrl_interface=/var/run/hostapd" |  	append bss_conf "ctrl_interface=/var/run/hostapd" | ||||||
|  	if [ "$isolate" -gt 0 ]; then |  	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 "uapsd_advertisement_enabled=$uapsd" "$N" | ||||||
|  	append bss_conf "utf8_ssid=$utf8_ssid" "$N" |  	append bss_conf "utf8_ssid=$utf8_ssid" "$N" | ||||||
|  	append bss_conf "multi_ap=$multi_ap" "$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" |  	[ "$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" |  			append bss_conf "acct_server_shared_secret=$acct_secret" "$N" | ||||||
|  		[ -n "$acct_interval" ] && \ |  		[ -n "$acct_interval" ] && \ | ||||||
|  			append bss_conf "radius_acct_interim_interval=$acct_interval" "$N" |  			append bss_conf "radius_acct_interim_interval=$acct_interval" "$N" | ||||||
| @@ -423,7 +425,7 @@ index aa72e09eba..0265c0518a 100644 | |||||||
|   |   | ||||||
|  	local vlan_possible="" |  	local vlan_possible="" | ||||||
|   |   | ||||||
| @@ -599,12 +653,12 @@ hostapd_set_bss_options() { | @@ -599,12 +655,12 @@ hostapd_set_bss_options() { | ||||||
|  			vlan_possible=1 |  			vlan_possible=1 | ||||||
|  			wps_possible=1 |  			wps_possible=1 | ||||||
|  		;; |  		;; | ||||||
| @@ -438,7 +440,7 @@ index aa72e09eba..0265c0518a 100644 | |||||||
|   |   | ||||||
|  			# radius can provide VLAN ID for clients |  			# radius can provide VLAN ID for clients | ||||||
|  			vlan_possible=1 |  			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 auth_port 1812 | ||||||
|  			set_default dae_port 3799 |  			set_default dae_port 3799 | ||||||
| @@ -465,7 +467,7 @@ index aa72e09eba..0265c0518a 100644 | |||||||
|   |   | ||||||
|  			[ -n "$ownip" ] && append bss_conf "own_ip_addr=$ownip" "$N" |  			[ -n "$ownip" ] && append bss_conf "own_ip_addr=$ownip" "$N" | ||||||
|  			[ -n "$radius_client_addr" ] && append bss_conf "radius_client_addr=$radius_client_addr" "$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" |  	append bss_conf "ssid=$ssid" "$N" | ||||||
| @@ -475,7 +477,7 @@ index aa72e09eba..0265c0518a 100644 | |||||||
|  	[ -n "$iapp_interface" ] && { |  	[ -n "$iapp_interface" ] && { | ||||||
|  		local ifname |  		local ifname | ||||||
|  		network_get_device ifname "$iapp_interface" || ifname="$iapp_interface" |  		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" |  			append bss_conf "ftm_responder=1" "$N" | ||||||
|  			[ "$stationary_ap" -eq "1" ] && append bss_conf "stationary_ap=1" "$N" |  			[ "$stationary_ap" -eq "1" ] && append bss_conf "stationary_ap=1" "$N" | ||||||
|  			[ -n "$lci" ] && append bss_conf "lci=$lci" "$N" |  			[ -n "$lci" ] && append bss_conf "lci=$lci" "$N" | ||||||
| @@ -484,7 +486,7 @@ index aa72e09eba..0265c0518a 100644 | |||||||
|  		} |  		} | ||||||
|  	fi |  	fi | ||||||
|   |   | ||||||
| @@ -764,6 +823,7 @@ hostapd_set_bss_options() { | @@ -764,6 +825,7 @@ hostapd_set_bss_options() { | ||||||
|  				;; |  				;; | ||||||
|  			esac |  			esac | ||||||
|   |   | ||||||
| @@ -492,7 +494,7 @@ index aa72e09eba..0265c0518a 100644 | |||||||
|  			append bss_conf "mobility_domain=$mobility_domain" "$N" |  			append bss_conf "mobility_domain=$mobility_domain" "$N" | ||||||
|  			append bss_conf "ft_psk_generate_local=$ft_psk_generate_local" "$N" |  			append bss_conf "ft_psk_generate_local=$ft_psk_generate_local" "$N" | ||||||
|  			append bss_conf "ft_over_ds=$ft_over_ds" "$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 r0_key_lifetime 10000 | ||||||
|  				set_default pmk_r1_push 0 |  				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" |  				[ -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 "r0_key_lifetime=$r0_key_lifetime" "$N" | ||||||
|  				append bss_conf "pmk_r1_push=$pmk_r1_push" "$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 |  				json_get_vars ieee80211w_mgmt_cipher ieee80211w_max_timeout ieee80211w_retry_timeout | ||||||
|  				append bss_conf "ieee80211w=$ieee80211w" "$N" |  				append bss_conf "ieee80211w=$ieee80211w" "$N" | ||||||
|  				[ "$ieee80211w" -gt "0" ] && { |  				[ "$ieee80211w" -gt "0" ] && { | ||||||
| @@ -524,7 +526,7 @@ index aa72e09eba..0265c0518a 100644 | |||||||
|  					[ -n "$ieee80211w_max_timeout" ] && \ |  					[ -n "$ieee80211w_max_timeout" ] && \ | ||||||
|  						append bss_conf "assoc_sa_query_max_timeout=$ieee80211w_max_timeout" "$N" |  						append bss_conf "assoc_sa_query_max_timeout=$ieee80211w_max_timeout" "$N" | ||||||
|  					[ -n "$ieee80211w_retry_timeout" ] && \ |  					[ -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" ] && { |  	[ -n "$vlan_possible" -a -n "$dynamic_vlan" ] && { | ||||||
| @@ -544,7 +546,7 @@ index aa72e09eba..0265c0518a 100644 | |||||||
|  		[ -n "$vlan_tagged_interface" ] && \ |  		[ -n "$vlan_tagged_interface" ] && \ | ||||||
|  			append bss_conf "vlan_tagged_interface=$vlan_tagged_interface" "$N" |  			append bss_conf "vlan_tagged_interface=$vlan_tagged_interface" "$N" | ||||||
|  		[ -n "$vlan_file" ] && { |  		[ -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_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_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 |  	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 |  	set_default iw_enabled 0 | ||||||
|  	if [ "$iw_enabled" = "1" ]; then |  	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" ] && \ |  		[ -n "$iw_network_auth_type" ] && \ | ||||||
|  			append bss_conf "network_auth_type=$iw_network_auth_type" "$N" |  			append bss_conf "network_auth_type=$iw_network_auth_type" "$N" | ||||||
|  		[ -n "$iw_gas_address3" ] && append bss_conf "gas_address3=$iw_gas_address3" "$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= |  		iw_domain_name_conf= | ||||||
|  		json_for_each_item append_iw_domain_name iw_domain_name |  		json_for_each_item append_iw_domain_name iw_domain_name | ||||||
| @@ -921,14 +1003,18 @@ hostapd_set_bss_options() { | @@ -922,13 +1006,22 @@ 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" |  			append bss_conf "anqp_3gpp_cell_net=$iw_anqp_3gpp_cell_net_conf" "$N" | ||||||
|  	fi |  	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 \ |  	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 | -		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 disable_dgaf $hs20 | ||||||
|  	set_default osen 0 |  	set_default osen 0 | ||||||
|  	set_default anqp_domain_id 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 |  	if [ "$hs20" = "1" ]; then | ||||||
|  		append bss_conf "hs20=1" "$N" |  		append bss_conf "hs20=1" "$N" | ||||||
|  		append_hs20_icons |  		append_hs20_icons | ||||||
| @@ -595,7 +601,7 @@ index aa72e09eba..0265c0518a 100644 | |||||||
|  		append bss_conf "disable_dgaf=$disable_dgaf" "$N" |  		append bss_conf "disable_dgaf=$disable_dgaf" "$N" | ||||||
|  		append bss_conf "osen=$osen" "$N" |  		append bss_conf "osen=$osen" "$N" | ||||||
|  		append bss_conf "anqp_domain_id=$anqp_domain_id" "$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_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_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" |  		[ -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 |  	set_default per_sta_vif 0 | ||||||
|  	if [ "$per_sta_vif" -gt 0 ]; then |  	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" |  	append network_data "frequency=$freq" "$N$T" | ||||||
|  	case "$htmode" in |  	case "$htmode" in | ||||||
|  		NOHT) append network_data "disable_ht=1" "$N$T";; |  		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";; |  		*) append network_data "disable_vht=1" "$N$T";; | ||||||
|  	esac |  	esac | ||||||
|  } |  } | ||||||
| @@ -1106,19 +1208,21 @@ wpa_supplicant_add_network() { | @@ -1106,19 +1215,21 @@ wpa_supplicant_add_network() { | ||||||
|  		ssid bssid key \ |  		ssid bssid key \ | ||||||
|  		basic_rate mcast_rate \ |  		basic_rate mcast_rate \ | ||||||
|  		ieee80211w ieee80211r \ |  		ieee80211w ieee80211r \ | ||||||
| @@ -674,7 +680,7 @@ index aa72e09eba..0265c0518a 100644 | |||||||
|   |   | ||||||
|  	local key_mgmt='NONE' |  	local key_mgmt='NONE' | ||||||
|  	local network_data= |  	local network_data= | ||||||
| @@ -1150,7 +1254,10 @@ wpa_supplicant_add_network() { | @@ -1150,7 +1261,10 @@ wpa_supplicant_add_network() { | ||||||
|  		scan_ssid="" |  		scan_ssid="" | ||||||
|  	} |  	} | ||||||
|   |   | ||||||
| @@ -686,7 +692,7 @@ index aa72e09eba..0265c0518a 100644 | |||||||
|   |   | ||||||
|  	case "$auth_type" in |  	case "$auth_type" in | ||||||
|  		none) ;; |  		none) ;; | ||||||
| @@ -1186,7 +1293,7 @@ wpa_supplicant_add_network() { | @@ -1186,7 +1300,7 @@ wpa_supplicant_add_network() { | ||||||
|  			fi |  			fi | ||||||
|  			append network_data "$passphrase" "$N$T" |  			append network_data "$passphrase" "$N$T" | ||||||
|  		;; |  		;; | ||||||
|   | |||||||
| @@ -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> | From: John Crispin <john@phrozen.org> | ||||||
| Date: Sun, 25 Jul 2021 13:32:37 +0200 | 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> | 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/procd.sh | 79 +++++++++++++++++++++++++++++ | ||||||
|  package/system/procd/files/uxc.init |  4 ++ |  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 | 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 | --- a/package/system/procd/Makefile | ||||||
| +++ b/package/system/procd/Makefile | +++ b/package/system/procd/Makefile | ||||||
| @@ -12,9 +12,9 @@ PKG_RELEASE:=$(AUTORELEASE) | @@ -12,9 +12,9 @@ PKG_RELEASE:=$(AUTORELEASE) | ||||||
| @@ -21,9 +21,9 @@ index 30d5adf427..98f1ed1775 100644 | |||||||
| -PKG_SOURCE_DATE:=2021-02-23 | -PKG_SOURCE_DATE:=2021-02-23 | ||||||
| -PKG_SOURCE_VERSION:=37eed131e9967a35f47bacb3437a9d3c8a57b3f4 | -PKG_SOURCE_VERSION:=37eed131e9967a35f47bacb3437a9d3c8a57b3f4 | ||||||
| -PKG_MIRROR_HASH:=2b0131ff9055ccf987cbeb5f36c2c2585dc780999df6be312fbbbcd61ce676d4 | -PKG_MIRROR_HASH:=2b0131ff9055ccf987cbeb5f36c2c2585dc780999df6be312fbbbcd61ce676d4 | ||||||
| +PKG_SOURCE_DATE:=2021-08-15 | +PKG_MIRROR_HASH:=0d51642d82d7bb4150355a6986e54504dce171c6fcb7eeff312d20a5d106bad8 | ||||||
| +PKG_SOURCE_VERSION:=104b49d6ab25a8cf067e6d8d1f2da7defb9876d4 | +PKG_SOURCE_DATE:=2021-11-04 | ||||||
| +PKG_MIRROR_HASH:=d13b566a14e84f6babe8b7d3dfb88e34c3dff0e97d7770d6fe71174685bca628 | +PKG_SOURCE_VERSION:=0ee8e734a7f67220cf4a3412b60ff674b5fb20dd | ||||||
|  CMAKE_INSTALL:=1 |  CMAKE_INSTALL:=1 | ||||||
|   |   | ||||||
|  PKG_LICENSE:=GPL-2.0 |  PKG_LICENSE:=GPL-2.0 | ||||||
| @@ -36,21 +36,30 @@ index 30d5adf427..98f1ed1775 100644 | |||||||
|  endif |  endif | ||||||
|   |   | ||||||
|  CMAKE_OPTIONS += -DEARLY_PATH="$(TARGET_INIT_PATH)" |  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 |  define Package/procd-seccomp | ||||||
|    SECTION:=base |    SECTION:=base | ||||||
|    CATEGORY:=Base system |    CATEGORY:=Base system | ||||||
| -  DEPENDS:=@(arm||armeb||mips||mipsel||i386||powerpc||x86_64) @!TARGET_uml \ | -  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 |    TITLE:=OpenWrt process seccomp helper + utrace | ||||||
|  endef |  endef | ||||||
| @@ -90,7 +90,7 @@ endef |   | ||||||
|  define Package/uxc |  define Package/uxc | ||||||
|    SECTION:=base |    SECTION:=base | ||||||
|    CATEGORY:=Base system |    CATEGORY:=Base system | ||||||
| -  DEPENDS:=+procd-ujail +libubus +libubox +libblobmsg-json | -  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 |    TITLE:=OpenWrt container management | ||||||
|    MAINTAINER:=Daniel Golle <daniel@makrotopia.org> |    MAINTAINER:=Daniel Golle <daniel@makrotopia.org> | ||||||
|  endef |  endef | ||||||
|   | |||||||
							
								
								
									
										35
									
								
								backports/0031-ubus-update-to-the-latest-version.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								backports/0031-ubus-update-to-the-latest-version.patch
									
									
									
									
									
										Normal 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 | ||||||
|  |  | ||||||
							
								
								
									
										34
									
								
								backports/0032-rpcd-bump-to-git-HEAD.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								backports/0032-rpcd-bump-to-git-HEAD.patch
									
									
									
									
									
										Normal 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 | ||||||
|  |  | ||||||
| @@ -1,7 +1,8 @@ | |||||||
| From 705ea724f1dc4083665746a1cf4c9b0f317667ec Mon Sep 17 00:00:00 2001 | From 3937223beab0c3e4284fd916c0c3b6548c287e03 Mon Sep 17 00:00:00 2001 | ||||||
| From: Felix Fietkau <nbd@nbd.name> | From: Felix Fietkau <nbd@nbd.name> | ||||||
| Date: Tue, 26 Oct 2021 20:41:22 +0200 | 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 | 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 | 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> | Signed-off-by: Felix Fietkau <nbd@nbd.name> | ||||||
| ---
 | ---
 | ||||||
|  include/bpf.mk                                | 60 +++++++++++ |  include/bpf.mk                                | 65 ++++++++++++ | ||||||
|  package/kernel/bpf-headers/Makefile           | 99 +++++++++++++++++++ |  package/kernel/bpf-headers/Makefile           | 99 +++++++++++++++++++ | ||||||
|  .../src/include/generated/bounds.h            | 14 +++ |  .../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 include/bpf.mk | ||||||
|  create mode 100644 package/kernel/bpf-headers/Makefile |  create mode 100644 package/kernel/bpf-headers/Makefile | ||||||
|  create mode 100644 package/kernel/bpf-headers/src/include/generated/bounds.h |  create mode 100644 package/kernel/bpf-headers/src/include/generated/bounds.h | ||||||
| 
 | 
 | ||||||
| diff --git a/include/bpf.mk b/include/bpf.mk
 | diff --git a/include/bpf.mk b/include/bpf.mk
 | ||||||
| new file mode 100644 | new file mode 100644 | ||||||
| index 0000000000..4e227a11d0
 | index 0000000000..3dc65c7685
 | ||||||
| --- /dev/null
 | --- /dev/null
 | ||||||
| +++ b/include/bpf.mk
 | +++ b/include/bpf.mk
 | ||||||
| @@ -0,0 +1,60 @@
 | @@ -0,0 +1,65 @@
 | ||||||
| +ifeq ($(CONFIG_BUILD_LLVM_BPF),)
 | +ifneq ($(CONFIG_BPF_TOOLCHAIN_HOST),)
 | ||||||
| +export PATH:=/usr/local/opt/llvm/bin:$(PATH)
 | +  BPF_TOOLCHAIN_HOST_PATH:=$(call qstrip,$(CONFIG_BPF_TOOLCHAIN_HOST_PATH))
 | ||||||
| +CLANG:=$(firstword $(shell PATH='$(PATH)' which clang clang-13 clang-12 clang-11 clang-10 clang-9))
 | +  ifneq ($(BPF_TOOLCHAIN_HOST_PATH),)
 | ||||||
| +LLVM_VER:=$(subst clang,,$(notdir $(CLANG)))
 | +    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
 | +else
 | ||||||
| +CLANG:=$(STAGING_DIR_HOST)/bin/clang
 | +  CLANG:=$(STAGING_DIR_HOST)/bin/clang
 | ||||||
| +LLVM_VER:=
 | +  LLVM_VER:=
 | ||||||
| +endif
 | +endif
 | ||||||
| +
 | +
 | ||||||
| +LLVM_PATH:=$(dir $(CLANG))
 | +LLVM_PATH:=$(dir $(CLANG))
 | ||||||
							
								
								
									
										29
									
								
								backports/0051-bpf-headers-unset-PKG_CONFIG_PATH.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										29
									
								
								backports/0051-bpf-headers-unset-PKG_CONFIG_PATH.patch
									
									
									
									
									
										Normal 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 | ||||||
|  |  | ||||||
| @@ -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 | ||||||
|  |  | ||||||
| @@ -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 | ||||||
|  |  | ||||||
| @@ -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 | ||||||
|  |  | ||||||
							
								
								
									
										26
									
								
								backports/0055-include-bpf.mk-fix-typo.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								backports/0055-include-bpf.mk-fix-typo.patch
									
									
									
									
									
										Normal 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 | ||||||
|  |  | ||||||
| @@ -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 | ||||||
|  |  | ||||||
							
								
								
									
										34
									
								
								backports/0057-include-bpf.mk-add-LD_LIBRARY_PATH.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								backports/0057-include-bpf.mk-add-LD_LIBRARY_PATH.patch
									
									
									
									
									
										Normal 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 | ||||||
|  |  | ||||||
| @@ -6,6 +6,7 @@ RUN apt-get update \ | |||||||
|             time git-core build-essential gcc-multilib clang \ |             time git-core build-essential gcc-multilib clang \ | ||||||
|             libncurses5-dev zlib1g-dev gawk flex gettext wget unzip python \ |             libncurses5-dev zlib1g-dev gawk flex gettext wget unzip python \ | ||||||
|             python3 python3-pip python3-yaml libssl-dev rsync llvm llvm-12 \ |             python3 python3-pip python3-yaml libssl-dev rsync llvm llvm-12 \ | ||||||
|  |             clang-12 \ | ||||||
|     && apt-get clean |     && apt-get clean | ||||||
| RUN git config --global user.email "you@example.com" | RUN git config --global user.email "you@example.com" | ||||||
| RUN git config --global user.name "Your Name" | RUN git config --global user.name "Your Name" | ||||||
|   | |||||||
| @@ -230,6 +230,8 @@ IN_SFP_PHY=TRUE | |||||||
| IN_MALIBU_PHY=TRUE | IN_MALIBU_PHY=TRUE | ||||||
| else ifeq (CPPE, $(CHIP_TYPE)) | else ifeq (CPPE, $(CHIP_TYPE)) | ||||||
| IN_QCA808X_PHY=TRUE | IN_QCA808X_PHY=TRUE | ||||||
|  | IN_QCA803X_PHY=TRUE | ||||||
|  | IN_SFP_PHY=TRUE | ||||||
| IN_PHY_I2C_MODE=TRUE | IN_PHY_I2C_MODE=TRUE | ||||||
| IN_MALIBU_PHY=TRUE | IN_MALIBU_PHY=TRUE | ||||||
| else ifeq (DESS, $(CHIP_TYPE)) | else ifeq (DESS, $(CHIP_TYPE)) | ||||||
|   | |||||||
| @@ -17,7 +17,7 @@ include ./openvswitch.mk | |||||||
| # | # | ||||||
| PKG_NAME:=openvswitch | PKG_NAME:=openvswitch | ||||||
| PKG_VERSION:=$(ovs_version) | PKG_VERSION:=$(ovs_version) | ||||||
| PKG_RELEASE:=9 | PKG_RELEASE:=10 | ||||||
| PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz | PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz | ||||||
| PKG_SOURCE_URL:=https://www.openvswitch.org/releases/ | PKG_SOURCE_URL:=https://www.openvswitch.org/releases/ | ||||||
| PKG_HASH:=5c7baed537364d43af36c15dde298c95d35cb2cb3204b4d3fe9b0fc73c97f16d | PKG_HASH:=5c7baed537364d43af36c15dde298c95d35cb2cb3204b4d3fe9b0fc73c97f16d | ||||||
|   | |||||||
| @@ -121,6 +121,7 @@ ovs_bridge_port_add() { | |||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	ovs-vsctl --may-exist add-port "$name" "$port" ${type:+ -- set interface "$port" type="$type"} | 	ovs-vsctl --may-exist add-port "$name" "$port" ${type:+ -- set interface "$port" type="$type"} | ||||||
|  | 	ovs_bridge_port_up "$port" | ||||||
| 	__port_list="$__port_list ${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"} \ | 	ovs-vsctl --may-exist add-port "$bridge" "$port" ${tag:+tag="$tag"} \ | ||||||
| 		${ofport:+ -- set interface "$port" ofport_request="$ofport"} \ | 		${ofport:+ -- set interface "$port" ofport_request="$ofport"} \ | ||||||
| 		${type:+ -- set interface "$port" type="$type"} | 		${type:+ -- set interface "$port" type="$type"} | ||||||
|  | 	ovs_bridge_port_up "$port" | ||||||
| 	__port_list="$__port_list ${port} " | 	__port_list="$__port_list ${port} " | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -174,6 +176,12 @@ ovs_bridge_port_cleanup() { | |||||||
| 	done | 	done | ||||||
| } | } | ||||||
|  |  | ||||||
|  | ovs_bridge_port_up() { | ||||||
|  | 	local port="$1" | ||||||
|  |  | ||||||
|  | 	ip link set dev "$port" up | ||||||
|  | } | ||||||
|  |  | ||||||
| ovs_bridge_validate_datapath_id() { | ovs_bridge_validate_datapath_id() { | ||||||
| 	local dpid="$1" | 	local dpid="$1" | ||||||
|  |  | ||||||
|   | |||||||
| @@ -79,9 +79,10 @@ return view.extend({ | |||||||
|  |  | ||||||
| 				var cntbtn = E('button', { | 				var cntbtn = E('button', { | ||||||
| 					'class': 'btn cbi-button-action important', | 					'class': 'btn cbi-button-action important', | ||||||
| 					'click': ui.createHandlerFn(this, 'handleSysupgradeConfirm', btn), | 					'click': ui.createHandlerFn(this, 'handleSysupgradeConfirm', btn) | ||||||
| 					'disabled': !is_valid |  | ||||||
| 				}, [ _('Continue') ]); | 				}, [ _('Continue') ]); | ||||||
|  | 				if (!is_valid) | ||||||
|  | 					cntbtn.disabled = true; | ||||||
|  |  | ||||||
| 				body.push(E('div', { 'class': 'right' }, [ | 				body.push(E('div', { 'class': 'right' }, [ | ||||||
| 					E('button', { | 					E('button', { | ||||||
|   | |||||||
| @@ -43,6 +43,7 @@ return view.extend({ | |||||||
| 		o.value('dhcp', _('Address configuration via DHCP')); | 		o.value('dhcp', _('Address configuration via DHCP')); | ||||||
| 		o.value('pppoe', _('Address configuration via PPPoE')); | 		o.value('pppoe', _('Address configuration via PPPoE')); | ||||||
| 		o.value('wwan', _('Cellular network connection')); | 		o.value('wwan', _('Cellular network connection')); | ||||||
|  | 		o.value('wds', _('WiFi WDS uplink')); | ||||||
|  |  | ||||||
| 		o = s.option(form.ListValue, 'modem-type', _('Modem type')); | 		o = s.option(form.ListValue, 'modem-type', _('Modem type')); | ||||||
| 		o.depends('protocol', 'wwan'); | 		o.depends('protocol', 'wwan'); | ||||||
| @@ -105,6 +106,25 @@ return view.extend({ | |||||||
| 		o.depends('protocol', 'static'); | 		o.depends('protocol', 'static'); | ||||||
| 		o.datatype = 'ipaddr("nomask")'; | 		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++) | 		for (var i = 0; i < s.children.length; i++) | ||||||
| 			data.broadband[s.children[i].option] = profile.broadband[s.children[i].option]; | 			data.broadband[s.children[i].option] = profile.broadband[s.children[i].option]; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -45,8 +45,6 @@ config_foreach delete_forwarding forwarding | |||||||
|  |  | ||||||
| uci commit | uci commit | ||||||
|  |  | ||||||
| /etc/init.d/uhttpd enable |  | ||||||
| /etc/init.d/uhttpd start | /etc/init.d/uhttpd start | ||||||
| /etc/init.d/ucentral stop |  | ||||||
|  |  | ||||||
| reload_config | reload_config | ||||||
|   | |||||||
							
								
								
									
										36
									
								
								feeds/ucentral/atfpolicy/Makefile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								feeds/ucentral/atfpolicy/Makefile
									
									
									
									
									
										Normal 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)) | ||||||
							
								
								
									
										8
									
								
								feeds/ucentral/atfpolicy/files/atfpolicy.conf
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								feeds/ucentral/atfpolicy/files/atfpolicy.conf
									
									
									
									
									
										Normal 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 | ||||||
							
								
								
									
										57
									
								
								feeds/ucentral/atfpolicy/files/atfpolicy.init
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										57
									
								
								feeds/ucentral/atfpolicy/files/atfpolicy.init
									
									
									
									
									
										Normal 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 | ||||||
|  | } | ||||||
							
								
								
									
										15
									
								
								feeds/ucentral/atfpolicy/src/CMakeLists.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								feeds/ucentral/atfpolicy/src/CMakeLists.txt
									
									
									
									
									
										Normal 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} | ||||||
|  | ) | ||||||
							
								
								
									
										90
									
								
								feeds/ucentral/atfpolicy/src/atf.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										90
									
								
								feeds/ucentral/atfpolicy/src/atf.h
									
									
									
									
									
										Normal 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 | ||||||
							
								
								
									
										108
									
								
								feeds/ucentral/atfpolicy/src/interface.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										108
									
								
								feeds/ucentral/atfpolicy/src/interface.c
									
									
									
									
									
										Normal 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); | ||||||
|  | } | ||||||
							
								
								
									
										62
									
								
								feeds/ucentral/atfpolicy/src/main.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										62
									
								
								feeds/ucentral/atfpolicy/src/main.c
									
									
									
									
									
										Normal 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; | ||||||
|  | } | ||||||
							
								
								
									
										174
									
								
								feeds/ucentral/atfpolicy/src/nl80211.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										174
									
								
								feeds/ucentral/atfpolicy/src/nl80211.c
									
									
									
									
									
										Normal 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"); | ||||||
|  | } | ||||||
							
								
								
									
										164
									
								
								feeds/ucentral/atfpolicy/src/ubus.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										164
									
								
								feeds/ucentral/atfpolicy/src/ubus.c
									
									
									
									
									
										Normal 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); | ||||||
|  | } | ||||||
| @@ -1,10 +1,12 @@ | |||||||
| config defaults | config defaults | ||||||
| 	list defaults /etc/qosify-defaults.conf | 	list defaults /etc/qosify-defaults.conf | ||||||
| 	option dscp_prio CS5 | 	option dscp_prio CS5 | ||||||
|  | 	option dscp_icmp CS6 | ||||||
| 	option dscp_bulk CS0 | 	option dscp_bulk CS0 | ||||||
| 	option dscp_default_udp	CS4 | 	option dscp_default_udp	CS4 | ||||||
| 	option bulk_trigger_timeout 5 | 	option bulk_trigger_timeout 5 | ||||||
| 	option bulk_trigger_pps	0 | 	option bulk_trigger_pps	100 | ||||||
|  | 	option prio_max_avg_pkt_len 500 | ||||||
|  |  | ||||||
| config interface wan | config interface wan | ||||||
| 	option name wan | 	option name wan | ||||||
|   | |||||||
| @@ -30,10 +30,12 @@ add_defaults() { | |||||||
| 	add_option int timeout | 	add_option int timeout | ||||||
| 	add_option string dscp_prio | 	add_option string dscp_prio | ||||||
| 	add_option string dscp_bulk | 	add_option string dscp_bulk | ||||||
|  | 	add_option string dscp_icmp | ||||||
| 	add_option string dscp_default_udp | 	add_option string dscp_default_udp | ||||||
| 	add_option string dscp_default_tcp | 	add_option string dscp_default_tcp | ||||||
| 	add_option int bulk_trigger_timeout  | 	add_option int bulk_trigger_timeout  | ||||||
| 	add_option int bulk_trigger_pps | 	add_option int bulk_trigger_pps | ||||||
|  | 	add_option int prio_max_avg_pkt_len | ||||||
| } | } | ||||||
|  |  | ||||||
| add_interface() { | add_interface() { | ||||||
|   | |||||||
							
								
								
									
										112
									
								
								feeds/ucentral/qosify/src/README
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										112
									
								
								feeds/ucentral/qosify/src/README
									
									
									
									
									
										Normal 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 | ||||||
| @@ -1,3 +1,7 @@ | |||||||
|  | // SPDX-License-Identifier: GPL-2.0+ | ||||||
|  | /* | ||||||
|  |  * Copyright (C) 2021 Felix Fietkau <nbd@nbd.name> | ||||||
|  |  */ | ||||||
| #include <sys/types.h> | #include <sys/types.h> | ||||||
| #include <sys/socket.h> | #include <sys/socket.h> | ||||||
| #include <sys/wait.h> | #include <sys/wait.h> | ||||||
| @@ -130,8 +134,9 @@ static const char *check_str(struct blob_attr *attr) | |||||||
| } | } | ||||||
|  |  | ||||||
| static void | 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 *tb[__IFACE_ATTR_MAX]; | ||||||
| 	struct blob_attr *cur; | 	struct blob_attr *cur; | ||||||
|  |  | ||||||
| @@ -145,6 +150,7 @@ iface_config_set(struct qosify_iface_config *cfg, struct blob_attr *attr) | |||||||
| 	cfg->egress = true; | 	cfg->egress = true; | ||||||
| 	cfg->host_isolate = true; | 	cfg->host_isolate = true; | ||||||
| 	cfg->autorate_ingress = true; | 	cfg->autorate_ingress = true; | ||||||
|  | 	cfg->nat = !iface->device; | ||||||
|  |  | ||||||
| 	if ((cur = tb[IFACE_ATTR_BW_UP]) != NULL) | 	if ((cur = tb[IFACE_ATTR_BW_UP]) != NULL) | ||||||
| 		cfg->bandwidth_up = check_str(cur); | 		cfg->bandwidth_up = check_str(cur); | ||||||
| @@ -386,7 +392,7 @@ static void | |||||||
| interface_set_config(struct qosify_iface *iface, struct blob_attr *config) | interface_set_config(struct qosify_iface *iface, struct blob_attr *config) | ||||||
| { | { | ||||||
| 	iface->config_data = blob_memdup(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); | 	interface_start(iface); | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,3 +1,7 @@ | |||||||
|  | // SPDX-License-Identifier: GPL-2.0+ | ||||||
|  | /* | ||||||
|  |  * Copyright (C) 2021 Felix Fietkau <nbd@nbd.name> | ||||||
|  |  */ | ||||||
| #include <sys/resource.h> | #include <sys/resource.h> | ||||||
| #include <sys/stat.h> | #include <sys/stat.h> | ||||||
| #include <arpa/inet.h> | #include <arpa/inet.h> | ||||||
| @@ -35,24 +39,17 @@ static void qosify_fill_rodata(struct bpf_object *obj, uint32_t flags) | |||||||
| } | } | ||||||
|  |  | ||||||
| static int | 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, | 	DECLARE_LIBBPF_OPTS(bpf_object_open_opts, opts, | ||||||
| 		.pin_root_path = CLASSIFY_DATA_PATH, | 		.pin_root_path = CLASSIFY_DATA_PATH, | ||||||
| 	); | 	); | ||||||
| 	struct bpf_program *prog; | 	struct bpf_program *prog; | ||||||
| 	struct bpf_object *obj; | 	struct bpf_object *obj; | ||||||
| 	struct stat st; |  | ||||||
| 	char path[256]; | 	char path[256]; | ||||||
| 	int err; | 	int err; | ||||||
|  |  | ||||||
| 	snprintf(path, sizeof(path), CLASSIFY_PIN_PATH "_" "%s", suffix); | 	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); | 	obj = bpf_object__open_file(CLASSIFY_PROG_PATH, &opts); | ||||||
| 	err = libbpf_get_error(obj); | 	err = libbpf_get_error(obj); | ||||||
| @@ -91,7 +88,7 @@ qosify_create_program(const char *suffix, uint32_t flags, bool *force_init) | |||||||
| 	return 0; | 	return 0; | ||||||
| } | } | ||||||
|  |  | ||||||
| int qosify_loader_init(bool force_init) | int qosify_loader_init(void) | ||||||
| { | { | ||||||
| 	static const struct { | 	static const struct { | ||||||
| 		const char *suffix; | 		const char *suffix; | ||||||
| @@ -105,8 +102,7 @@ int qosify_loader_init(bool force_init) | |||||||
| 	glob_t g; | 	glob_t g; | ||||||
| 	int i; | 	int i; | ||||||
|  |  | ||||||
| 	if (force_init && | 	if (glob(CLASSIFY_DATA_PATH "/*", 0, NULL, &g) == 0) { | ||||||
| 	    glob(CLASSIFY_DATA_PATH "/*", 0, NULL, &g) == 0) { |  | ||||||
| 		for (i = 0; i < g.gl_pathc; i++) | 		for (i = 0; i < g.gl_pathc; i++) | ||||||
| 			unlink(g.gl_pathv[i]); | 			unlink(g.gl_pathv[i]); | ||||||
| 	} | 	} | ||||||
| @@ -117,8 +113,7 @@ int qosify_loader_init(bool force_init) | |||||||
| 	qosify_init_env(); | 	qosify_init_env(); | ||||||
|  |  | ||||||
| 	for (i = 0; i < ARRAY_SIZE(progs); i++) { | 	for (i = 0; i < ARRAY_SIZE(progs); i++) { | ||||||
| 		if (qosify_create_program(progs[i].suffix, progs[i].flags, | 		if (qosify_create_program(progs[i].suffix, progs[i].flags)) | ||||||
| 				      &force_init)) |  | ||||||
| 			return -1; | 			return -1; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,3 +1,7 @@ | |||||||
|  | // SPDX-License-Identifier: GPL-2.0+ | ||||||
|  | /* | ||||||
|  |  * Copyright (C) 2021 Felix Fietkau <nbd@nbd.name> | ||||||
|  |  */ | ||||||
| #include <stdio.h> | #include <stdio.h> | ||||||
| #include <unistd.h> | #include <unistd.h> | ||||||
| #include <stdint.h> | #include <stdint.h> | ||||||
| @@ -10,7 +14,6 @@ static int usage(const char *progname) | |||||||
| { | { | ||||||
| 	fprintf(stderr, "Usage: %s [options]\n" | 	fprintf(stderr, "Usage: %s [options]\n" | ||||||
| 		"Options:\n" | 		"Options:\n" | ||||||
| 		"	-f:		force reload of BPF programs\n" |  | ||||||
| 		"	-l <file>	Load defaults from <file>\n" | 		"	-l <file>	Load defaults from <file>\n" | ||||||
| 		"	-o		only load program/maps without running as daemon\n" | 		"	-o		only load program/maps without running as daemon\n" | ||||||
| 		"\n", progname); | 		"\n", progname); | ||||||
| @@ -21,14 +24,12 @@ static int usage(const char *progname) | |||||||
| int main(int argc, char **argv) | int main(int argc, char **argv) | ||||||
| { | { | ||||||
| 	const char *load_file = NULL; | 	const char *load_file = NULL; | ||||||
| 	bool force_init = false; |  | ||||||
| 	bool oneshot = false; | 	bool oneshot = false; | ||||||
| 	int ch; | 	int ch; | ||||||
|  |  | ||||||
| 	while ((ch = getopt(argc, argv, "fl:o")) != -1) { | 	while ((ch = getopt(argc, argv, "fl:o")) != -1) { | ||||||
| 		switch (ch) { | 		switch (ch) { | ||||||
| 		case 'f': | 		case 'f': | ||||||
| 			force_init = true; |  | ||||||
| 			break; | 			break; | ||||||
| 		case 'l': | 		case 'l': | ||||||
| 			load_file = optarg; | 			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; | 		return 2; | ||||||
|  |  | ||||||
| 	if (qosify_map_init()) | 	if (qosify_map_init()) | ||||||
|   | |||||||
| @@ -1,3 +1,7 @@ | |||||||
|  | // SPDX-License-Identifier: GPL-2.0+ | ||||||
|  | /* | ||||||
|  |  * Copyright (C) 2021 Felix Fietkau <nbd@nbd.name> | ||||||
|  |  */ | ||||||
| #include <arpa/inet.h> | #include <arpa/inet.h> | ||||||
|  |  | ||||||
| #include <errno.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 LIST_HEAD(map_files); | ||||||
| static uint32_t next_timeout; | static uint32_t next_timeout; | ||||||
| static uint8_t qosify_dscp_default[2] = { 0xff, 0xff }; | 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_config config; | ||||||
|  |  | ||||||
| struct qosify_map_file { | struct qosify_map_file { | ||||||
| @@ -34,6 +39,37 @@ static const struct { | |||||||
| 	[CL_MAP_IPV4_ADDR] = { "ipv4_map", "ipv4_addr" }, | 	[CL_MAP_IPV4_ADDR] = { "ipv4_map", "ipv4_addr" }, | ||||||
| 	[CL_MAP_IPV6_ADDR] = { "ipv6_map", "ipv6_addr" }, | 	[CL_MAP_IPV6_ADDR] = { "ipv6_map", "ipv6_addr" }, | ||||||
| 	[CL_MAP_CONFIG] = { "config", "config" }, | 	[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) | 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 fd = qosify_map_fds[id]; | ||||||
| 	int i; | 	int i; | ||||||
|  |  | ||||||
|  | 	val |= QOSIFY_DSCP_DEFAULT_FLAG; | ||||||
|  |  | ||||||
| 	for (i = 0; i < (1 << 16); i++) { | 	for (i = 0; i < (1 << 16); i++) { | ||||||
| 		data.addr.port = htons(i); | 		data.addr.port = htons(i); | ||||||
| 		if (avl_find(&map_data, &data)) | 		if (avl_find(&map_data, &data)) | ||||||
| @@ -135,7 +173,7 @@ int qosify_map_init(void) | |||||||
| { | { | ||||||
| 	int i; | 	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); | 		qosify_map_fds[i] = qosify_map_get_fd(i); | ||||||
| 		if (qosify_map_fds[i] < 0) | 		if (qosify_map_fds[i] < 0) | ||||||
| 			return -1; | 			return -1; | ||||||
| @@ -159,38 +197,11 @@ static char *str_skip(char *str, bool space) | |||||||
| static int | static int | ||||||
| qosify_map_codepoint(const char *val) | 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; | 	int i; | ||||||
|  |  | ||||||
| 	for (i = 0; i < ARRAY_SIZE(cp); i++) | 	for (i = 0; i < ARRAY_SIZE(codepoints); i++) | ||||||
| 		if (!strcmp(cp[i].name, val)) | 		if (!strcmp(codepoints[i].name, val)) | ||||||
| 			return cp[i].val; | 			return codepoints[i].val; | ||||||
|  |  | ||||||
| 	return 0xff; | 	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) | 	if (d1->id != d2->id) | ||||||
| 		return d2->id - d1->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)); | 	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) | static void __qosify_map_set_entry(struct qosify_map_data *data) | ||||||
| { | { | ||||||
| 	int fd = qosify_map_fds[data->id]; | 	int fd = qosify_map_fds[data->id]; | ||||||
| @@ -220,10 +259,12 @@ static void __qosify_map_set_entry(struct qosify_map_data *data) | |||||||
| 		if (!add) | 		if (!add) | ||||||
| 			return; | 			return; | ||||||
|  |  | ||||||
| 		e = calloc(1, sizeof(*e)); | 		e = __qosify_map_alloc_entry(data); | ||||||
|  | 		if (!e) | ||||||
|  | 			return; | ||||||
|  |  | ||||||
| 		e->avl.key = &e->data; | 		e->avl.key = &e->data; | ||||||
| 		e->data.id = data->id; | 		e->data.id = data->id; | ||||||
| 		memcpy(&e->data.addr, &data->addr, sizeof(e->data.addr)); |  | ||||||
| 		avl_insert(&map_data, &e->avl); | 		avl_insert(&map_data, &e->avl); | ||||||
| 	} else { | 	} else { | ||||||
| 		prev_dscp = e->data.dscp; | 		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; | 		e->data.dscp = e->data.file_dscp; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	if (e->data.dscp != prev_dscp) | 	if (e->data.dscp != prev_dscp && data->id < CL_MAP_DNS) { | ||||||
| 		bpf_map_update_elem(fd, &data->addr, &e->data.dscp, BPF_ANY); | 		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 (add) { | ||||||
| 		if (qosify_map_timeout == ~0 || file) { | 		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) { | 	switch (id) { | ||||||
|  | 	case CL_MAP_DNS: | ||||||
|  | 		data.addr.dns.pattern = str; | ||||||
|  | 		break; | ||||||
| 	case CL_MAP_TCP_PORTS: | 	case CL_MAP_TCP_PORTS: | ||||||
| 	case CL_MAP_UDP_PORTS: | 	case CL_MAP_UDP_PORTS: | ||||||
| 		return qosify_map_set_port(&data, str); | 		return qosify_map_set_port(&data, str); | ||||||
| @@ -351,6 +401,28 @@ int qosify_map_dscp_value(const char *val) | |||||||
| 	return dscp + (fallback << 6); | 	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 | static void | ||||||
| qosify_map_parse_line(char *str) | qosify_map_parse_line(char *str) | ||||||
| { | { | ||||||
| @@ -372,6 +444,8 @@ qosify_map_parse_line(char *str) | |||||||
| 	if (dscp < 0) | 	if (dscp < 0) | ||||||
| 		return; | 		return; | ||||||
|  |  | ||||||
|  | 	if (!strncmp(key, "dns:", 4)) | ||||||
|  | 		qosify_map_set_entry(CL_MAP_DNS, true, key + 4, dscp); | ||||||
| 	if (!strncmp(key, "tcp:", 4)) | 	if (!strncmp(key, "tcp:", 4)) | ||||||
| 		qosify_map_set_entry(CL_MAP_TCP_PORTS, true, key + 4, dscp); | 		qosify_map_set_entry(CL_MAP_TCP_PORTS, true, key + 4, dscp); | ||||||
| 	else if (!strncmp(key, "udp:", 4)) | 	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_TCP_PORTS, 0); | ||||||
| 	qosify_map_set_dscp_default(CL_MAP_UDP_PORTS, 0); | 	qosify_map_set_dscp_default(CL_MAP_UDP_PORTS, 0); | ||||||
| 	qosify_map_timeout = 3600; | 	qosify_map_timeout = 3600; | ||||||
|  | 	qosify_active_timeout = 300; | ||||||
|  |  | ||||||
| 	memset(&config, 0, sizeof(config)); | 	memset(&config, 0, sizeof(config)); | ||||||
| 	config.dscp_prio = 0xff; | 	config.dscp_prio = 0xff; | ||||||
| @@ -477,12 +552,44 @@ void qosify_map_reload(void) | |||||||
| 	qosify_map_gc(); | 	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) | void qosify_map_gc(void) | ||||||
| { | { | ||||||
| 	struct qosify_map_entry *e, *tmp; | 	struct qosify_map_entry *e, *tmp; | ||||||
| 	int32_t timeout = 0; | 	int32_t timeout = 0; | ||||||
| 	uint32_t cur_time = qosify_gettime(); | 	uint32_t cur_time = qosify_gettime(); | ||||||
| 	int fd; |  | ||||||
|  |  | ||||||
| 	next_timeout = 0; | 	next_timeout = 0; | ||||||
| 	avl_for_each_element_safe(&map_data, e, avl, tmp) { | 	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) { | 		if (e->data.user && e->timeout != ~0) { | ||||||
| 			cur_timeout = e->timeout - cur_time; | 			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) { | 			if (cur_timeout <= 0) { | ||||||
| 				e->data.user = false; | 				e->data.user = false; | ||||||
| 				e->data.dscp = e->data.file_dscp; | 				e->data.dscp = e->data.file_dscp; | ||||||
| @@ -502,10 +612,7 @@ void qosify_map_gc(void) | |||||||
| 		if (e->data.file || e->data.user) | 		if (e->data.file || e->data.user) | ||||||
| 			continue; | 			continue; | ||||||
|  |  | ||||||
| 		avl_delete(&map_data, &e->avl); | 		qosify_map_free_entry(e); | ||||||
| 		fd = qosify_map_fds[e->data.id]; |  | ||||||
| 		bpf_map_delete_elem(fd, &e->data.addr); |  | ||||||
| 		free(e); |  | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	if (!timeout) | 	if (!timeout) | ||||||
| @@ -514,6 +621,52 @@ void qosify_map_gc(void) | |||||||
| 	uloop_timeout_set(&qosify_map_timer, timeout * 1000); | 	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) | void qosify_map_dump(struct blob_buf *b) | ||||||
| { | { | ||||||
| 	struct qosify_map_entry *e; | 	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, "file", e->data.file); | ||||||
| 		blobmsg_add_u8(b, "user", e->data.user); | 		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); | 		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) { | 		switch (e->data.id) { | ||||||
| 		case CL_MAP_TCP_PORTS: | 		case CL_MAP_TCP_PORTS: | ||||||
| 		case CL_MAP_UDP_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; | 			break; | ||||||
| 		case CL_MAP_IPV4_ADDR: | 		case CL_MAP_IPV4_ADDR: | ||||||
| 		case CL_MAP_IPV6_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; | 			af = e->data.id == CL_MAP_IPV6_ADDR ? AF_INET6 : AF_INET; | ||||||
| 			inet_ntop(af, &e->data.addr, buf, buf_len); | 			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; | 			break; | ||||||
| 		default: | 		default: | ||||||
| 			*buf = 0; | 			*buf = 0; | ||||||
| 			break; | 			break; | ||||||
| 		} | 		} | ||||||
| 		blobmsg_add_string_buffer(b); |  | ||||||
| 		blobmsg_close_table(b, c); | 		blobmsg_close_table(b, c); | ||||||
| 	} | 	} | ||||||
| 	blobmsg_close_array(b, a); | 	blobmsg_close_array(b, a); | ||||||
|   | |||||||
| @@ -1,3 +1,7 @@ | |||||||
|  | // SPDX-License-Identifier: GPL-2.0+ | ||||||
|  | /* | ||||||
|  |  * Copyright (C) 2021 Felix Fietkau <nbd@nbd.name> | ||||||
|  |  */ | ||||||
| #define KBUILD_MODNAME "foo" | #define KBUILD_MODNAME "foo" | ||||||
| #include <uapi/linux/bpf.h> | #include <uapi/linux/bpf.h> | ||||||
| #include <uapi/linux/if_ether.h> | #include <uapi/linux/if_ether.h> | ||||||
| @@ -16,7 +20,6 @@ | |||||||
| #include "qosify-bpf.h" | #include "qosify-bpf.h" | ||||||
|  |  | ||||||
| #define INET_ECN_MASK 3 | #define INET_ECN_MASK 3 | ||||||
| #define DSCP_FALLBACK_FLAG	BIT(6) |  | ||||||
|  |  | ||||||
| #define FLOW_CHECK_INTERVAL	((u32)((1000000000ULL) >> 24)) | #define FLOW_CHECK_INTERVAL	((u32)((1000000000ULL) >> 24)) | ||||||
| #define FLOW_TIMEOUT		((u32)((30ULL * 1000000000ULL) >> 24)) | #define FLOW_TIMEOUT		((u32)((30ULL * 1000000000ULL) >> 24)) | ||||||
| @@ -65,7 +68,7 @@ struct { | |||||||
| 	__uint(type, BPF_MAP_TYPE_HASH); | 	__uint(type, BPF_MAP_TYPE_HASH); | ||||||
| 	__uint(pinning, 1); | 	__uint(pinning, 1); | ||||||
| 	__uint(key_size, sizeof(struct in_addr)); | 	__uint(key_size, sizeof(struct in_addr)); | ||||||
| 	__type(value, __u8); | 	__type(value, struct qosify_ip_map_val); | ||||||
| 	__uint(max_entries, 100000); | 	__uint(max_entries, 100000); | ||||||
| 	__uint(map_flags, BPF_F_NO_PREALLOC); | 	__uint(map_flags, BPF_F_NO_PREALLOC); | ||||||
| } ipv4_map SEC(".maps"); | } ipv4_map SEC(".maps"); | ||||||
| @@ -74,7 +77,7 @@ struct { | |||||||
| 	__uint(type, BPF_MAP_TYPE_HASH); | 	__uint(type, BPF_MAP_TYPE_HASH); | ||||||
| 	__uint(pinning, 1); | 	__uint(pinning, 1); | ||||||
| 	__uint(key_size, sizeof(struct in6_addr)); | 	__uint(key_size, sizeof(struct in6_addr)); | ||||||
| 	__type(value, __u8); | 	__type(value, struct qosify_ip_map_val); | ||||||
| 	__uint(max_entries, 100000); | 	__uint(max_entries, 100000); | ||||||
| 	__uint(map_flags, BPF_F_NO_PREALLOC); | 	__uint(map_flags, BPF_F_NO_PREALLOC); | ||||||
| } ipv6_map SEC(".maps"); | } ipv6_map SEC(".maps"); | ||||||
| @@ -211,33 +214,37 @@ static void | |||||||
| parse_l4proto(struct qosify_config *config, struct __sk_buff *skb, | parse_l4proto(struct qosify_config *config, struct __sk_buff *skb, | ||||||
| 	      __u32 offset, __u8 proto, __u8 *dscp_out) | 	      __u32 offset, __u8 proto, __u8 *dscp_out) | ||||||
| { | { | ||||||
| 	struct udphdr *udp = skb_ptr(skb, offset); | 	struct udphdr *udp; | ||||||
| 	__u32 key; | 	__u32 src, dest, key; | ||||||
| 	__u8 *value; | 	__u8 *value; | ||||||
|  |  | ||||||
|  | 	udp = skb_ptr(skb, offset); | ||||||
| 	if (skb_check(skb, &udp->len)) | 	if (skb_check(skb, &udp->len)) | ||||||
| 		return; | 		return; | ||||||
|  |  | ||||||
| 	if (module_flags & QOSIFY_INGRESS) | 	if (config && (proto == IPPROTO_ICMP || proto == IPPROTO_ICMPV6)) { | ||||||
| 		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; | 		*dscp_out = config->dscp_icmp; | ||||||
| 		return; | 		return; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	if (!value) | 	src = udp->source; | ||||||
| 		return; | 	dest = udp->dest; | ||||||
|  |  | ||||||
| 	if ((*value & DSCP_FALLBACK_FLAG) && *dscp_out) | 	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; | 		return; | ||||||
|  |  | ||||||
| 	*dscp_out = *value; | 	*dscp_out = *value; | ||||||
| @@ -253,9 +260,16 @@ check_flow(struct qosify_config *config, struct __sk_buff *skb, | |||||||
| 	__u32 hash; | 	__u32 hash; | ||||||
| 	__u32 time; | 	__u32 time; | ||||||
|  |  | ||||||
|  | 	if (!(*dscp & QOSIFY_DSCP_DEFAULT_FLAG)) | ||||||
|  | 		return; | ||||||
|  |  | ||||||
| 	if (!config) | 	if (!config) | ||||||
| 		return; | 		return; | ||||||
|  |  | ||||||
|  | 	if (!config->bulk_trigger_pps && | ||||||
|  | 	    !config->prio_max_avg_pkt_len) | ||||||
|  | 		return; | ||||||
|  |  | ||||||
| 	time = cur_time(); | 	time = cur_time(); | ||||||
| 	hash = bpf_get_hash_recalc(skb); | 	hash = bpf_get_hash_recalc(skb); | ||||||
| 	flow = bpf_map_lookup_elem(&flow_map, &hash); | 	flow = bpf_map_lookup_elem(&flow_map, &hash); | ||||||
| @@ -287,7 +301,8 @@ check_flow(struct qosify_config *config, struct __sk_buff *skb, | |||||||
| 	if (flow->pkt_count < 0xffff) | 	if (flow->pkt_count < 0xffff) | ||||||
| 		flow->pkt_count++; | 		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->dscp = config->dscp_bulk; | ||||||
| 		flow->bulk_timeout = config->bulk_trigger_timeout; | 		flow->bulk_timeout = config->bulk_trigger_timeout; | ||||||
| 	} | 	} | ||||||
| @@ -302,8 +317,7 @@ out: | |||||||
| 			flow->dscp = 0xff; | 			flow->dscp = 0xff; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	if (flow->dscp != 0xff && | 	if (flow->dscp != 0xff) | ||||||
| 	    !(*dscp && (flow->dscp & DSCP_FALLBACK_FLAG))) |  | ||||||
| 		*dscp = flow->dscp; | 		*dscp = flow->dscp; | ||||||
|  |  | ||||||
| 	return; | 	return; | ||||||
| @@ -322,10 +336,12 @@ static __always_inline void | |||||||
| parse_ipv4(struct __sk_buff *skb, __u32 *offset) | parse_ipv4(struct __sk_buff *skb, __u32 *offset) | ||||||
| { | { | ||||||
| 	struct qosify_config *config; | 	struct qosify_config *config; | ||||||
|  | 	struct qosify_ip_map_val *ip_val; | ||||||
| 	const __u32 zero_port = 0; | 	const __u32 zero_port = 0; | ||||||
| 	struct iphdr *iph; | 	struct iphdr *iph; | ||||||
| 	__u8 dscp = 0; | 	__u8 dscp = 0xff; | ||||||
| 	__u8 *value; | 	__u8 *value; | ||||||
|  | 	__u8 ipproto; | ||||||
| 	int hdr_len; | 	int hdr_len; | ||||||
| 	void *key; | 	void *key; | ||||||
| 	bool force; | 	bool force; | ||||||
| @@ -337,7 +353,7 @@ parse_ipv4(struct __sk_buff *skb, __u32 *offset) | |||||||
| 		return; | 		return; | ||||||
|  |  | ||||||
| 	hdr_len = iph->ihl * 4; | 	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; | 		return; | ||||||
|  |  | ||||||
| 	iph = skb_ptr(skb, *offset); | 	iph = skb_ptr(skb, *offset); | ||||||
| @@ -346,23 +362,29 @@ parse_ipv4(struct __sk_buff *skb, __u32 *offset) | |||||||
| 	if (skb_check(skb, (void *)(iph + 1))) | 	if (skb_check(skb, (void *)(iph + 1))) | ||||||
| 		return; | 		return; | ||||||
|  |  | ||||||
| 	parse_l4proto(config, skb, *offset, iph->protocol, &dscp); | 	ipproto = iph->protocol; | ||||||
|  | 	parse_l4proto(config, skb, *offset, ipproto, &dscp); | ||||||
|  |  | ||||||
| 	if (module_flags & QOSIFY_INGRESS) | 	if (module_flags & QOSIFY_INGRESS) | ||||||
| 		key = &iph->saddr; | 		key = &iph->saddr; | ||||||
| 	else | 	else | ||||||
| 		key = &iph->daddr; | 		key = &iph->daddr; | ||||||
|  |  | ||||||
| 	value = bpf_map_lookup_elem(&ipv4_map, key); | 	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 */ | 		/* use udp port 0 entry as fallback for non-tcp/udp */ | ||||||
| 	if (!value) |  | ||||||
| 		value = bpf_map_lookup_elem(&udp_ports, &zero_port); | 		value = bpf_map_lookup_elem(&udp_ports, &zero_port); | ||||||
| 		if (value) | 		if (value) | ||||||
| 			dscp = *value; | 			dscp = *value; | ||||||
|  | 	} | ||||||
|  |  | ||||||
| 	check_flow(config, skb, &dscp); | 	check_flow(config, skb, &dscp); | ||||||
|  |  | ||||||
| 	force = !(dscp & DSCP_FALLBACK_FLAG); | 	force = !(dscp & QOSIFY_DSCP_FALLBACK_FLAG); | ||||||
| 	dscp &= GENMASK(5, 0); | 	dscp &= GENMASK(5, 0); | ||||||
|  |  | ||||||
| 	ipv4_change_dsfield(iph, INET_ECN_MASK, dscp << 2, force); | 	ipv4_change_dsfield(iph, INET_ECN_MASK, dscp << 2, force); | ||||||
| @@ -372,16 +394,18 @@ static __always_inline void | |||||||
| parse_ipv6(struct __sk_buff *skb, __u32 *offset) | parse_ipv6(struct __sk_buff *skb, __u32 *offset) | ||||||
| { | { | ||||||
| 	struct qosify_config *config; | 	struct qosify_config *config; | ||||||
|  | 	struct qosify_ip_map_val *ip_val; | ||||||
| 	const __u32 zero_port = 0; | 	const __u32 zero_port = 0; | ||||||
| 	struct ipv6hdr *iph; | 	struct ipv6hdr *iph; | ||||||
| 	__u8 dscp = 0; | 	__u8 dscp = 0; | ||||||
| 	__u8 *value; | 	__u8 *value; | ||||||
|  | 	__u8 ipproto; | ||||||
| 	void *key; | 	void *key; | ||||||
| 	bool force; | 	bool force; | ||||||
|  |  | ||||||
| 	config = get_config(); | 	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; | 		return; | ||||||
|  |  | ||||||
| 	iph = skb_ptr(skb, *offset); | 	iph = skb_ptr(skb, *offset); | ||||||
| @@ -390,24 +414,29 @@ parse_ipv6(struct __sk_buff *skb, __u32 *offset) | |||||||
| 	if (skb_check(skb, (void *)(iph + 1))) | 	if (skb_check(skb, (void *)(iph + 1))) | ||||||
| 		return; | 		return; | ||||||
|  |  | ||||||
|  | 	ipproto = iph->nexthdr; | ||||||
| 	if (module_flags & QOSIFY_INGRESS) | 	if (module_flags & QOSIFY_INGRESS) | ||||||
| 		key = &iph->saddr; | 		key = &iph->saddr; | ||||||
| 	else | 	else | ||||||
| 		key = &iph->daddr; | 		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); |  | ||||||
|  |  | ||||||
|  | 	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 */ | 		/* use udp port 0 entry as fallback for non-tcp/udp */ | ||||||
| 	if (!value) |  | ||||||
| 		value = bpf_map_lookup_elem(&udp_ports, &zero_port); | 		value = bpf_map_lookup_elem(&udp_ports, &zero_port); | ||||||
| 		if (value) | 		if (value) | ||||||
| 			dscp = *value; | 			dscp = *value; | ||||||
|  | 	} | ||||||
|  |  | ||||||
| 	check_flow(config, skb, &dscp); | 	check_flow(config, skb, &dscp); | ||||||
|  |  | ||||||
| 	force = !(dscp & DSCP_FALLBACK_FLAG); | 	force = !(dscp & QOSIFY_DSCP_FALLBACK_FLAG); | ||||||
| 	dscp &= GENMASK(5, 0); | 	dscp &= GENMASK(5, 0); | ||||||
|  |  | ||||||
| 	ipv6_change_dsfield(iph, INET_ECN_MASK, dscp << 2, force); | 	ipv6_change_dsfield(iph, INET_ECN_MASK, dscp << 2, force); | ||||||
|   | |||||||
| @@ -1,3 +1,7 @@ | |||||||
|  | // SPDX-License-Identifier: GPL-2.0+ | ||||||
|  | /* | ||||||
|  |  * Copyright (C) 2021 Felix Fietkau <nbd@nbd.name> | ||||||
|  |  */ | ||||||
| #ifndef __BPF_QOSIFY_H | #ifndef __BPF_QOSIFY_H | ||||||
| #define __BPF_QOSIFY_H | #define __BPF_QOSIFY_H | ||||||
|  |  | ||||||
| @@ -11,6 +15,10 @@ | |||||||
| #define QOSIFY_INGRESS			(1 << 0) | #define QOSIFY_INGRESS			(1 << 0) | ||||||
| #define QOSIFY_IP_ONLY			(1 << 1) | #define QOSIFY_IP_ONLY			(1 << 1) | ||||||
|  |  | ||||||
|  |  | ||||||
|  | #define QOSIFY_DSCP_FALLBACK_FLAG	(1 << 6) | ||||||
|  | #define QOSIFY_DSCP_DEFAULT_FLAG	(1 << 7) | ||||||
|  |  | ||||||
| /* global config data */ | /* global config data */ | ||||||
| struct qosify_config { | struct qosify_config { | ||||||
| 	uint8_t dscp_prio; | 	uint8_t dscp_prio; | ||||||
| @@ -23,4 +31,9 @@ struct qosify_config { | |||||||
| 	uint16_t prio_max_avg_pkt_len; | 	uint16_t prio_max_avg_pkt_len; | ||||||
| }; | }; | ||||||
|  |  | ||||||
|  | struct qosify_ip_map_val { | ||||||
|  | 	uint8_t dscp; /* must be first */ | ||||||
|  | 	uint8_t seen; | ||||||
|  | }; | ||||||
|  |  | ||||||
| #endif | #endif | ||||||
|   | |||||||
| @@ -1,7 +1,12 @@ | |||||||
|  | // SPDX-License-Identifier: GPL-2.0+ | ||||||
|  | /* | ||||||
|  |  * Copyright (C) 2021 Felix Fietkau <nbd@nbd.name> | ||||||
|  |  */ | ||||||
| #ifndef __QOS_CLASSIFY_H | #ifndef __QOS_CLASSIFY_H | ||||||
| #define __QOS_CLASSIFY_H | #define __QOS_CLASSIFY_H | ||||||
|  |  | ||||||
| #include <stdbool.h> | #include <stdbool.h> | ||||||
|  | #include <regex.h> | ||||||
|  |  | ||||||
| #include <bpf/bpf.h> | #include <bpf/bpf.h> | ||||||
| #include <bpf/libbpf.h> | #include <bpf/libbpf.h> | ||||||
| @@ -25,6 +30,7 @@ enum qosify_map_id { | |||||||
| 	CL_MAP_IPV4_ADDR, | 	CL_MAP_IPV4_ADDR, | ||||||
| 	CL_MAP_IPV6_ADDR, | 	CL_MAP_IPV6_ADDR, | ||||||
| 	CL_MAP_CONFIG, | 	CL_MAP_CONFIG, | ||||||
|  | 	CL_MAP_DNS, | ||||||
| 	__CL_MAP_MAX, | 	__CL_MAP_MAX, | ||||||
| }; | }; | ||||||
|  |  | ||||||
| @@ -41,6 +47,10 @@ struct qosify_map_data { | |||||||
| 		uint32_t port; | 		uint32_t port; | ||||||
| 		struct in_addr ip; | 		struct in_addr ip; | ||||||
| 		struct in6_addr ip6; | 		struct in6_addr ip6; | ||||||
|  | 		struct { | ||||||
|  | 			const char *pattern; | ||||||
|  | 			regex_t regex; | ||||||
|  | 		} dns; | ||||||
| 	} addr; | 	} addr; | ||||||
| }; | }; | ||||||
|  |  | ||||||
| @@ -54,9 +64,10 @@ struct qosify_map_entry { | |||||||
|  |  | ||||||
|  |  | ||||||
| extern int qosify_map_timeout; | extern int qosify_map_timeout; | ||||||
|  | extern int qosify_active_timeout; | ||||||
| extern struct qosify_config config; | 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_init(void); | ||||||
| int qosify_map_dscp_value(const char *val); | 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_set_dscp_default(enum qosify_map_id id, uint8_t val); | ||||||
| void qosify_map_reset_config(void); | void qosify_map_reset_config(void); | ||||||
| void qosify_map_update_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); | int qosify_iface_init(void); | ||||||
| void qosify_iface_config_update(struct blob_attr *ifaces, struct blob_attr *devs); | void qosify_iface_config_update(struct blob_attr *ifaces, struct blob_attr *devs); | ||||||
|   | |||||||
| @@ -1,3 +1,7 @@ | |||||||
|  | // SPDX-License-Identifier: GPL-2.0+ | ||||||
|  | /* | ||||||
|  |  * Copyright (C) 2021 Felix Fietkau <nbd@nbd.name> | ||||||
|  |  */ | ||||||
| #include <libubus.h> | #include <libubus.h> | ||||||
|  |  | ||||||
| #include "qosify.h" | #include "qosify.h" | ||||||
| @@ -46,6 +50,7 @@ enum { | |||||||
| 	CL_ADD_IPV6, | 	CL_ADD_IPV6, | ||||||
| 	CL_ADD_TCP_PORT, | 	CL_ADD_TCP_PORT, | ||||||
| 	CL_ADD_UDP_PORT, | 	CL_ADD_UDP_PORT, | ||||||
|  | 	CL_ADD_DNS, | ||||||
| 	__CL_ADD_MAX | 	__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_IPV6] = { "ipv6", BLOBMSG_TYPE_ARRAY }, | ||||||
| 	[CL_ADD_TCP_PORT] = { "tcp_port", BLOBMSG_TYPE_ARRAY }, | 	[CL_ADD_TCP_PORT] = { "tcp_port", BLOBMSG_TYPE_ARRAY }, | ||||||
| 	[CL_ADD_UDP_PORT] = { "udp_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)) | 	    (ret = qosify_ubus_add_array(cur, dscp, CL_MAP_UDP_PORTS) != 0)) | ||||||
| 		return ret; | 		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; | 	qosify_map_timeout = prev_timemout; | ||||||
|  |  | ||||||
| 	return 0; | 	return 0; | ||||||
| @@ -254,12 +264,6 @@ qosify_ubus_status(struct ubus_context *ctx, struct ubus_object *obj, | |||||||
| 	return 0; | 	return 0; | ||||||
| } | } | ||||||
|  |  | ||||||
| enum { |  | ||||||
| 	CL_DEV_EVENT_NAME, |  | ||||||
| 	CL_DEV_EVENT_ADD, |  | ||||||
| 	__CL_DEV_EVENT_MAX, |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| static int | static int | ||||||
| qosify_ubus_check_devices(struct ubus_context *ctx, struct ubus_object *obj, | qosify_ubus_check_devices(struct ubus_context *ctx, struct ubus_object *obj, | ||||||
| 			  struct ubus_request_data *req, const char *method, | 			  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; | 	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[] = { | static const struct ubus_method qosify_methods[] = { | ||||||
| 	UBUS_METHOD_NOARG("reload", qosify_ubus_reload), | 	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("config", qosify_ubus_config, qosify_config_policy), | ||||||
| 	UBUS_METHOD_NOARG("dump", qosify_ubus_dump), | 	UBUS_METHOD_NOARG("dump", qosify_ubus_dump), | ||||||
| 	UBUS_METHOD_NOARG("status", qosify_ubus_status), | 	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), | 	UBUS_METHOD_NOARG("check_devices", qosify_ubus_check_devices), | ||||||
| }; | }; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -39,8 +39,8 @@ delclient() { | |||||||
| 	TC class del dev $ifb parent 1:1 classid 1:$id | 	TC class del dev $ifb parent 1:1 classid 1:$id | ||||||
| } | } | ||||||
|  |  | ||||||
| ingress= | ingress=0 | ||||||
| egress= | egress=0 | ||||||
|  |  | ||||||
| getrate() { | getrate() { | ||||||
| 	config_get ssid $1 ssid | 	config_get ssid $1 ssid | ||||||
| @@ -55,12 +55,17 @@ addclient() { | |||||||
| 	local mac=$2 | 	local mac=$2 | ||||||
| 	local ssid=$(cat /tmp/ratelimit.$iface) | 	local ssid=$(cat /tmp/ratelimit.$iface) | ||||||
|  |  | ||||||
|  | 	egress=$3 | ||||||
|  | 	ingress=$4 | ||||||
|  |  | ||||||
| 	logger "ratelimit: adding client" | 	logger "ratelimit: adding client" | ||||||
|  |  | ||||||
|  | 	[ "$egress" -eq 0 -o $ingress -eq 0 ] && { | ||||||
| 		config_load ratelimit | 		config_load ratelimit | ||||||
| 		config_foreach getrate rate $ssid | 		config_foreach getrate rate $ssid | ||||||
|  | 	} | ||||||
|  |  | ||||||
| 	[ -z "$egress" -o -z $ingress ] && { | 	[ "$egress" -eq 0 -o $ingress -eq 0 ] && { | ||||||
| 		logger "ratelimit: no valid rates" | 		logger "ratelimit: no valid rates" | ||||||
| 		exit 1 | 		exit 1 | ||||||
| 	} | 	} | ||||||
| @@ -146,7 +151,7 @@ addiface() { | |||||||
| waitiface() { | waitiface() { | ||||||
| 	local iface=$1 | 	local iface=$1 | ||||||
|  |  | ||||||
| 	ubus -t 75 wait_for hostapd.$1 | 	ubus -t 120 wait_for hostapd.$1 | ||||||
|  |  | ||||||
| 	[ $? -eq 0 ] || exit 0 | 	[ $? -eq 0 ] || exit 0 | ||||||
|  |  | ||||||
|   | |||||||
| @@ -2,7 +2,7 @@ | |||||||
|  |  | ||||||
| case $2 in | case $2 in | ||||||
| AP-STA-CONNECTED) | AP-STA-CONNECTED) | ||||||
| 	ratelimit addclient $1 $3 | 	ratelimit addclient $1 $3 $4 $5 | ||||||
| 	;; | 	;; | ||||||
| AP-STA-DISCONNECTED) | AP-STA-DISCONNECTED) | ||||||
| 	ratelimit delclient $1 $3 | 	ratelimit delclient $1 $3 | ||||||
|   | |||||||
| @@ -6,7 +6,7 @@ PKG_RELEASE:=1 | |||||||
| PKG_SOURCE_URL=https://github.com/blogic/ucentral-client.git | PKG_SOURCE_URL=https://github.com/blogic/ucentral-client.git | ||||||
| PKG_SOURCE_PROTO:=git | PKG_SOURCE_PROTO:=git | ||||||
| PKG_SOURCE_DATE:=2021-02-15 | PKG_SOURCE_DATE:=2021-02-15 | ||||||
| PKG_SOURCE_VERSION:=0179c0f98039b0fe6492b6f98e321c7e80dff42d | PKG_SOURCE_VERSION:=e27356216c6baecda9424b81ad90242505e16f08 | ||||||
|  |  | ||||||
| PKG_LICENSE:=BSD-3-Clause | PKG_LICENSE:=BSD-3-Clause | ||||||
| PKG_MAINTAINER:=John Crispin <john@phrozen.org> | PKG_MAINTAINER:=John Crispin <john@phrozen.org> | ||||||
|   | |||||||
							
								
								
									
										14
									
								
								feeds/ucentral/ucentral-client/files/etc/init.d/ucentral-wdt
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										14
									
								
								feeds/ucentral/ucentral-client/files/etc/init.d/ucentral-wdt
									
									
									
									
									
										Executable 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 | ||||||
|  | } | ||||||
							
								
								
									
										16
									
								
								feeds/ucentral/ucentral-client/files/usr/libexec/ucentral-wdt.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										16
									
								
								feeds/ucentral/ucentral-client/files/usr/libexec/ucentral-wdt.sh
									
									
									
									
									
										Executable 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 | ||||||
| @@ -6,7 +6,7 @@ PKG_RELEASE:=1 | |||||||
| PKG_SOURCE_URL=https://github.com/blogic/ucentral-schema.git | PKG_SOURCE_URL=https://github.com/blogic/ucentral-schema.git | ||||||
| PKG_SOURCE_PROTO:=git | PKG_SOURCE_PROTO:=git | ||||||
| PKG_SOURCE_DATE:=2021-02-15 | PKG_SOURCE_DATE:=2021-02-15 | ||||||
| PKG_SOURCE_VERSION:=1bdc8de73f66d5b846cc07c2697959c0cfda6aee | PKG_SOURCE_VERSION:=6d321d65047e1582fffad6034679ecb7aeabed71 | ||||||
|  |  | ||||||
| PKG_MAINTAINER:=John Crispin <john@phrozen.org> | PKG_MAINTAINER:=John Crispin <john@phrozen.org> | ||||||
| PKG_LICENSE:=BSD-3-Clause | PKG_LICENSE:=BSD-3-Clause | ||||||
|   | |||||||
| @@ -102,10 +102,6 @@ | |||||||
| 					"encryption": { | 					"encryption": { | ||||||
| 						"proto": "none", | 						"proto": "none", | ||||||
| 						"ieee80211w": "optional" | 						"ieee80211w": "optional" | ||||||
| 					}, |  | ||||||
| 					"roaming": { |  | ||||||
| 						"message-exchange": "ds", |  | ||||||
| 						"generate-psk": true |  | ||||||
| 					} | 					} | ||||||
| 				} | 				} | ||||||
| 			] | 			] | ||||||
|   | |||||||
| @@ -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 | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
|  | } | ||||||
| @@ -2,14 +2,7 @@ | |||||||
| 	"uuid": 2, | 	"uuid": 2, | ||||||
| 	"globals": { | 	"globals": { | ||||||
| 		"wireless-multimedia": { | 		"wireless-multimedia": { | ||||||
| 			"UP0": [ "DF"], | 			"profile": "rfc8325" | ||||||
| 			"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" ] |  | ||||||
| 		} | 		} | ||||||
| 	}, | 	}, | ||||||
| 	"radios": [ | 	"radios": [ | ||||||
| @@ -110,27 +103,36 @@ | |||||||
| 			"select-ports": [ "WAN" ], | 			"select-ports": [ "WAN" ], | ||||||
| 			"bandwidth_up": 1000, | 			"bandwidth_up": 1000, | ||||||
| 			"bandwidth_down": 1000, | 			"bandwidth_down": 1000, | ||||||
|  | 			"bulk-detection": { | ||||||
|  | 				"dscp": "CS1", | ||||||
|  | 				"packets-per-second": 500 | ||||||
|  | 			}, | ||||||
| 			"classifier": [ | 			"classifier": [ | ||||||
| 				{ | 				{ | ||||||
| 					"dscp":  "CS0", | 					"dscp":  "CS1", | ||||||
| 					"ports": [ | 					"ports": [ | ||||||
| 						{ "protocol": "any", "port": 53 }, | 						{ "protocol": "any", "port": 53 }, | ||||||
| 						{ "protocol": "tcp", "port": 80 } | 						{ "protocol": "tcp", "port": 80 } | ||||||
| 					], | 					], | ||||||
| 					"dns": [ | 					"dns": [ | ||||||
| 						"telecominfraproject.com" | 						{ "fqdn": "telecominfraproject.com", "suffix-matching": false } | ||||||
| 					] | 					] | ||||||
| 				}, { | 				}, { | ||||||
| 					"dscp":  "CS1", | 					"dscp":  "AF41", | ||||||
| 					"ports": [ |  | ||||||
| 						{ "protocol": "any", "port": 53, "range-end": 80 }, |  | ||||||
| 						{ "protocol": "udp", "port": 80, "reclassify": true } |  | ||||||
| 					], |  | ||||||
| 					"dns": [ | 					"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 | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|   | |||||||
| @@ -5,6 +5,11 @@ | |||||||
| 			"band": "2G", | 			"band": "2G", | ||||||
| 			"country": "CA", | 			"country": "CA", | ||||||
| 			"channel-mode": "HE", | 			"channel-mode": "HE", | ||||||
|  | 			"channel-width": 40 | ||||||
|  | 		}, { | ||||||
|  | 			"band": "5G", | ||||||
|  | 			"country": "CA", | ||||||
|  | 			"channel-mode": "HE", | ||||||
| 			"channel-width": 80 | 			"channel-width": 80 | ||||||
| 		} | 		} | ||||||
| 	], | 	], | ||||||
|   | |||||||
| @@ -6,7 +6,7 @@ PKG_RELEASE:=1 | |||||||
| PKG_SOURCE_URL=https://github.com/blogic/ucentral-wifi.git | PKG_SOURCE_URL=https://github.com/blogic/ucentral-wifi.git | ||||||
| PKG_SOURCE_PROTO:=git | PKG_SOURCE_PROTO:=git | ||||||
| PKG_SOURCE_DATE:=2021-04-13 | PKG_SOURCE_DATE:=2021-04-13 | ||||||
| PKG_SOURCE_VERSION:=b6dd24f79b14346e767fdda7206ad8c9d851ab35 | PKG_SOURCE_VERSION:=b64cd4149388bd6b49852ba37296cb76acaff537 | ||||||
| #PKG_MIRROR_HASH:=a8000b3cf43ce9ebfa7305661475fec98ec1dba2dc7b062028c2e17d7c2ec50b | #PKG_MIRROR_HASH:=a8000b3cf43ce9ebfa7305661475fec98ec1dba2dc7b062028c2e17d7c2ec50b | ||||||
|  |  | ||||||
| PKG_MAINTAINER:=John Crispin <john@phrozen.org> | PKG_MAINTAINER:=John Crispin <john@phrozen.org> | ||||||
|   | |||||||
							
								
								
									
										30
									
								
								feeds/ucentral/udnssnoop/Makefile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								feeds/ucentral/udnssnoop/Makefile
									
									
									
									
									
										Normal 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)) | ||||||
							
								
								
									
										24
									
								
								feeds/ucentral/udnssnoop/files/etc/init.d/dnssnoop
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										24
									
								
								feeds/ucentral/udnssnoop/files/etc/init.d/dnssnoop
									
									
									
									
									
										Executable 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 | ||||||
|  | } | ||||||
| @@ -32,6 +32,7 @@ ALLWIFIBOARDS:= \ | |||||||
| 	sercomm-wallaby \ | 	sercomm-wallaby \ | ||||||
| 	edgecore-eap102 \ | 	edgecore-eap102 \ | ||||||
| 	wallys-dr6018 \ | 	wallys-dr6018 \ | ||||||
|  | 	wallys-dr6018-v4 \ | ||||||
| 	tplink-ex227 \ | 	tplink-ex227 \ | ||||||
| 	tplink-ex447 | 	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,cig-wf194c4,Cigtech WF194c4)) | ||||||
| $(eval $(call generate-ath11k-wifi-package,sercomm-wallaby,Sercomm Kiwi)) | $(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,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-eap101,EdgeCore EAP101)) | ||||||
| $(eval $(call generate-ath11k-wifi-package,edgecore-eap102,Edgecore EAP102)) | $(eval $(call generate-ath11k-wifi-package,edgecore-eap102,Edgecore EAP102)) | ||||||
| $(eval $(call generate-ath11k-wifi-package,tplink-ex227,TP-Link EX227)) | $(eval $(call generate-ath11k-wifi-package,tplink-ex227,TP-Link EX227)) | ||||||
|   | |||||||
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								feeds/wifi-ax/ath11k-wifi/board-cig-wf196.bin.IPQ8074
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								feeds/wifi-ax/ath11k-wifi/board-cig-wf196.bin.IPQ8074
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								feeds/wifi-ax/ath11k-wifi/board-wallys-dr6018-v4.bin.IPQ6018
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								feeds/wifi-ax/ath11k-wifi/board-wallys-dr6018-v4.bin.IPQ6018
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							| @@ -114,6 +114,7 @@ hostapd_common_add_device_config() { | |||||||
|  |  | ||||||
| 	config_add_int airtime_mode | 	config_add_int airtime_mode | ||||||
|  |  | ||||||
|  | 	config_add_boolean multiple_bssid rnr_beacon he_co_locate ema | ||||||
| 	hostapd_add_log_config | 	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 \ | 	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 \ | 		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 | 	hostapd_set_log_options base_cfg | ||||||
|  |  | ||||||
| @@ -135,6 +137,10 @@ hostapd_prepare_device_config() { | |||||||
| 	set_default legacy_rates 0 | 	set_default legacy_rates 0 | ||||||
| 	set_default airtime_mode 0 | 	set_default airtime_mode 0 | ||||||
| 	set_default cell_density 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" ] && { | 	[ -n "$country" ] && { | ||||||
| 		append base_cfg "country_code=$country" "$N" | 		append base_cfg "country_code=$country" "$N" | ||||||
| @@ -227,6 +233,10 @@ hostapd_prepare_device_config() { | |||||||
| 	append base_cfg "dtim_period=$dtim_period" "$N" | 	append base_cfg "dtim_period=$dtim_period" "$N" | ||||||
| 	[ "$airtime_mode" -gt 0 ] && append base_cfg "airtime_mode=$airtime_mode" "$N" | 	[ "$airtime_mode" -gt 0 ] && append base_cfg "airtime_mode=$airtime_mode" "$N" | ||||||
| 	[ -n "$maxassoc" ] && append base_cfg "iface_max_num_sta=$maxassoc" "$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 | 	json_get_values opts hostapd_options | ||||||
| 	for val in $opts; do | 	for val in $opts; do | ||||||
| @@ -363,6 +373,8 @@ hostapd_common_add_bss_config() { | |||||||
|  |  | ||||||
| 	config_add_int eap_server | 	config_add_int eap_server | ||||||
| 	config_add_string eap_user_file ca_cert server_cert private_key private_key_passwd server_id | 	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() { | hostapd_set_vlan_file() { | ||||||
| @@ -1003,8 +1015,13 @@ hostapd_set_bss_options() { | |||||||
| 		[ -n "$iw_anqp_3gpp_cell_net_conf" ] && \ | 		[ -n "$iw_anqp_3gpp_cell_net_conf" ] && \ | ||||||
| 			append bss_conf "anqp_3gpp_cell_net=$iw_anqp_3gpp_cell_net_conf" "$N" | 			append bss_conf "anqp_3gpp_cell_net=$iw_anqp_3gpp_cell_net_conf" "$N" | ||||||
| 	fi | 	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 \ | 	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 \ | 		osu_ssid hs20_wan_metrics hs20_operating_class hs20_t_c_filename hs20_t_c_timestamp \ | ||||||
|   | |||||||
							
								
								
									
										126
									
								
								feeds/wifi-ax/hostapd/patches/750-wispr.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										126
									
								
								feeds/wifi-ax/hostapd/patches/750-wispr.patch
									
									
									
									
									
										Normal 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, | ||||||
| @@ -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) += ATH11K ATH11K_AHB ATH11K_SPECTRAL ATH11K_DEBUG | ||||||
| config-$(call config_package,ath11k-pci) += ATH11K_PCI | config-$(call config_package,ath11k-pci) += ATH11K_PCI | ||||||
|  |  | ||||||
| ifeq ($(CONFIG_KERNEL_IPQ_MEM_PROFILE),512) | #ifeq ($(CONFIG_KERNEL_IPQ_MEM_PROFILE),512) | ||||||
| #config-y += ATH11K_MEM_PROFILE_512M | config-y += ATH11K_MEM_PROFILE_512M | ||||||
| endif | #endif | ||||||
|  |  | ||||||
| config-$(call config_package,ath5k) += ATH5K | config-$(call config_package,ath5k) += ATH5K | ||||||
| ifdef CONFIG_TARGET_ath25 | ifdef CONFIG_TARGET_ath25 | ||||||
|   | |||||||
| @@ -53,6 +53,8 @@ drv_mac80211_init_device_config() { | |||||||
| 		he_spr_sr_control \ | 		he_spr_sr_control \ | ||||||
| 		he_twt_required | 		he_twt_required | ||||||
| 	config_add_int \ | 	config_add_int \ | ||||||
|  | 		beamformer_antennas \ | ||||||
|  | 		beamformee_antennas \ | ||||||
| 		vht_max_a_mpdu_len_exp \ | 		vht_max_a_mpdu_len_exp \ | ||||||
| 		vht_max_mpdu \ | 		vht_max_mpdu \ | ||||||
| 		vht_link_adapt \ | 		vht_link_adapt \ | ||||||
| @@ -294,6 +296,8 @@ mac80211_hostapd_setup_base() { | |||||||
| 			mu_beamformee:1 \ | 			mu_beamformee:1 \ | ||||||
| 			vht_txop_ps:1 \ | 			vht_txop_ps:1 \ | ||||||
| 			htc_vht:1 \ | 			htc_vht:1 \ | ||||||
|  | 			beamformee_antennas:4 \ | ||||||
|  | 			beamformer_antennas:4 \ | ||||||
| 			rx_antenna_pattern:1 \ | 			rx_antenna_pattern:1 \ | ||||||
| 			tx_antenna_pattern:1 \ | 			tx_antenna_pattern:1 \ | ||||||
| 			vht_max_a_mpdu_len_exp:7 \ | 			vht_max_a_mpdu_len_exp:7 \ | ||||||
| @@ -334,6 +338,18 @@ mac80211_hostapd_setup_base() { | |||||||
| 			RX-STBC-123:0x700:0x300:1 \ | 			RX-STBC-123:0x700:0x300:1 \ | ||||||
| 			RX-STBC-1234:0x700:0x400: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 | 		# supported Channel widths | ||||||
| 		vht160_hw=0 | 		vht160_hw=0 | ||||||
| 		[ "$(($vht_cap & 12))" -eq 4 -a 1 -le "$vht160" ] && \ | 		[ "$(($vht_cap & 12))" -eq 4 -a 1 -le "$vht160" ] && \ | ||||||
| @@ -499,6 +515,7 @@ mac80211_get_addr() { | |||||||
|  |  | ||||||
| mac80211_generate_mac() { | mac80211_generate_mac() { | ||||||
| 	local phy="$1" | 	local phy="$1" | ||||||
|  | 	local multiple_bssid="$2" | ||||||
| 	local id="${macidx:-0}" | 	local id="${macidx:-0}" | ||||||
|  |  | ||||||
| 	local ref="$(cat /sys/class/ieee80211/${phy}/macaddress)" | 	local ref="$(cat /sys/class/ieee80211/${phy}/macaddress)" | ||||||
| @@ -522,7 +539,10 @@ mac80211_generate_mac() { | |||||||
| 	local mask6=$6 | 	local mask6=$6 | ||||||
|  |  | ||||||
| 	local oIFS="$IFS"; IFS=":"; set -- $ref; IFS="$oIFS" | 	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)) | 	macidx=$(($id + 1)) | ||||||
|  |  | ||||||
| 	local use_global=0 | 	local use_global=0 | ||||||
| @@ -635,6 +655,7 @@ mac80211_iw_interface_add() { | |||||||
| } | } | ||||||
|  |  | ||||||
| mac80211_prepare_vif() { | mac80211_prepare_vif() { | ||||||
|  | 	local multiple_bssid=$1 | ||||||
| 	json_select config | 	json_select config | ||||||
|  |  | ||||||
| 	json_get_vars ifname mode ssid wds powersave macaddr enable wpa_psk_file vlan_file | 	json_get_vars ifname mode ssid wds powersave macaddr enable wpa_psk_file vlan_file | ||||||
| @@ -648,7 +669,7 @@ mac80211_prepare_vif() { | |||||||
| 	json_select .. | 	json_select .. | ||||||
|  |  | ||||||
| 	[ -n "$macaddr" ] || { | 	[ -n "$macaddr" ] || { | ||||||
| 		macaddr="$(mac80211_generate_mac $phy)" | 		macaddr="$(mac80211_generate_mac $phy $multiple_bssid)" | ||||||
| 		macidx="$(($macidx + 1))" | 		macidx="$(($macidx + 1))" | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| @@ -1017,6 +1038,7 @@ drv_mac80211_setup() { | |||||||
| 		txpower antenna_gain \ | 		txpower antenna_gain \ | ||||||
| 		rxantenna txantenna \ | 		rxantenna txantenna \ | ||||||
| 		frag rts beacon_int:100 htmode \ | 		frag rts beacon_int:100 htmode \ | ||||||
|  | 		multiple_bssid:0 \ | ||||||
| 		num_global_macaddr | 		num_global_macaddr | ||||||
| 	json_get_values basic_rate_list basic_rate | 	json_get_values basic_rate_list basic_rate | ||||||
| 	json_get_values scan_list scan_list | 	json_get_values scan_list scan_list | ||||||
| @@ -1111,7 +1133,7 @@ drv_mac80211_setup() { | |||||||
| 	mac80211_prepare_iw_htmode | 	mac80211_prepare_iw_htmode | ||||||
| 	for_each_interface "sta adhoc mesh monitor" mac80211_prepare_vif | 	for_each_interface "sta adhoc mesh monitor" mac80211_prepare_vif | ||||||
| 	NEWAPLIST= | 	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}) | 	NEW_MD5=$(test -e "${hostapd_conf_file}" && md5sum ${hostapd_conf_file}) | ||||||
| 	OLD_MD5=$(uci -q -P /var/state get wireless._${phy}.md5) | 	OLD_MD5=$(uci -q -P /var/state get wireless._${phy}.md5) | ||||||
| 	if [ "${NEWAPLIST}" != "${OLDAPLIST}" ]; then | 	if [ "${NEWAPLIST}" != "${OLDAPLIST}" ]; then | ||||||
|   | |||||||
| @@ -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"); | ||||||
| @@ -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; | ||||||
| @@ -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 | ||||||
							
								
								
									
										278
									
								
								feeds/wifi-ax/mac80211/patches/pending/0009-regdb.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										278
									
								
								feeds/wifi-ax/mac80211/patches/pending/0009-regdb.patch
									
									
									
									
									
										Normal 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; | ||||||
|  |  } | ||||||
| @@ -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"); |  | ||||||
| @@ -1,7 +1,7 @@ | |||||||
| From 640973dcc794f43d99df7674209d9532711c49b4 Mon Sep 17 00:00:00 2001 | From 19c481164dc772e49e173e08d1bfd266a5f458dd Mon Sep 17 00:00:00 2001 | ||||||
| From: John Crispin <john@phrozen.org> | From: John Crispin <john@phrozen.org> | ||||||
| Date: Sat, 18 Jul 2020 08:53:44 +0200 | 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> | 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/109-logspam.patch        |    24 + | ||||||
|  target/linux/ipq807x/Makefile                 |    22 + |  target/linux/ipq807x/Makefile                 |    22 + | ||||||
|  .../ipq807x/base-files/etc/board.d/01_leds    |    38 + |  .../ipq807x/base-files/etc/board.d/01_leds    |    38 + | ||||||
|  .../ipq807x/base-files/etc/board.d/02_network |    82 + |  .../ipq807x/base-files/etc/board.d/02_network |    81 + | ||||||
|  .../etc/hotplug.d/firmware/10-ath11k-caldata  |    95 + |  .../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/aq_phy      |    16 + | ||||||
|  .../ipq807x/base-files/etc/init.d/bootcount   |    12 + |  .../ipq807x/base-files/etc/init.d/bootcount   |    12 + | ||||||
|  .../linux/ipq807x/base-files/etc/init.d/wdt   |    14 + |  .../linux/ipq807x/base-files/etc/init.d/wdt   |    14 + | ||||||
|  ...G4_v5.4.B-AQR_CIG_WIFI_ID44715_VER1673.cld |   Bin 0 -> 391170 bytes |  ...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 + |  target/linux/ipq807x/config-4.4               |   828 + | ||||||
|  .../arm/boot/dts/qcom-ipq6018-cig-wf188.dts   |    18 + |  .../arm/boot/dts/qcom-ipq6018-cig-wf188.dts   |    18 + | ||||||
|  .../arm/boot/dts/qcom-ipq6018-cig-wf188n.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 + |  .../ipq807x/patches/110-add-esmt-nand.patch   |    37 + | ||||||
|  target/linux/ipq807x/patches/111-eap106.patch |   765 + |  target/linux/ipq807x/patches/111-eap106.patch |   765 + | ||||||
|  target/linux/ipq807x/patches/112-pstore.patch |   147 + |  target/linux/ipq807x/patches/112-pstore.patch |   147 + | ||||||
|  .../ipq807x/patches/200-bpf_backport.patch    | 44763 ++++++++++++++++ |  .../ipq807x/patches/200-bpf_backport.patch    | 44780 ++++++++++++++++ | ||||||
|  toolchain/kernel-headers/Makefile             |     8 + |  toolchain/kernel-headers/Makefile             |     8 + | ||||||
|  60 files changed, 56667 insertions(+), 2 deletions(-) |  61 files changed, 56703 insertions(+), 2 deletions(-) | ||||||
|  create mode 100644 package/boot/uboot-envtools/files/ipq807x |  create mode 100644 package/boot/uboot-envtools/files/ipq807x | ||||||
|  create mode 100644 target/linux/ipq807x/109-logspam.patch |  create mode 100644 target/linux/ipq807x/109-logspam.patch | ||||||
|  create mode 100644 target/linux/ipq807x/Makefile |  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/01_leds | ||||||
|  create mode 100755 target/linux/ipq807x/base-files/etc/board.d/02_network |  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 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/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/bootcount | ||||||
|  create mode 100755 target/linux/ipq807x/base-files/etc/init.d/wdt |  create mode 100755 target/linux/ipq807x/base-files/etc/init.d/wdt | ||||||
| @@ -342,10 +344,10 @@ index 0000000000..1f1797b0c6 | |||||||
| +exit 0
 | +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
 | 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 | new file mode 100755 | ||||||
| index 0000000000..2c30b01aab
 | index 0000000000..7772e309a3
 | ||||||
| --- /dev/null
 | --- /dev/null
 | ||||||
| +++ b/target/linux/ipq807x/base-files/etc/board.d/02_network
 | +++ b/target/linux/ipq807x/base-files/etc/board.d/02_network
 | ||||||
| @@ -0,0 +1,82 @@
 | @@ -0,0 +1,81 @@
 | ||||||
| +#!/bin/sh
 | +#!/bin/sh
 | ||||||
| +
 | +
 | ||||||
| +. /lib/functions.sh
 | +. /lib/functions.sh
 | ||||||
| @@ -408,8 +410,7 @@ index 0000000000..2c30b01aab | |||||||
| +		lan_mac=$(macaddr_add "$wan_mac" 1)
 | +		lan_mac=$(macaddr_add "$wan_mac" 1)
 | ||||||
| +		ucidef_set_network_device_mac eth0 $lan_mac
 | +		ucidef_set_network_device_mac eth0 $lan_mac
 | ||||||
| +		ucidef_set_network_device_mac eth1 $wan_mac
 | +		ucidef_set_network_device_mac eth1 $wan_mac
 | ||||||
| +		ip link set eth0 address $lan_mac
 | +		ucidef_set_label_macaddr $wan_mac
 | ||||||
| +		ip link set eth1 address $wan_mac
 |  | ||||||
| +		;;
 | +		;;
 | ||||||
| +	*)
 | +	*)
 | ||||||
| +		wan_mac=$(cat /sys/class/net/eth0/address)
 | +		wan_mac=$(cat /sys/class/net/eth0/address)
 | ||||||
| @@ -430,10 +431,10 @@ index 0000000000..2c30b01aab | |||||||
| +exit 0
 | +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
 | 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 | new file mode 100755 | ||||||
| index 0000000000..1788908ab0
 | index 0000000000..016416c089
 | ||||||
| --- /dev/null
 | --- /dev/null
 | ||||||
| +++ b/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
 | ||||||
| @@ -0,0 +1,95 @@
 | @@ -0,0 +1,111 @@
 | ||||||
| +#!/bin/sh
 | +#!/bin/sh
 | ||||||
| +
 | +
 | ||||||
| +[ -e /lib/firmware/$FIRMWARE ] && exit 0
 | +[ -e /lib/firmware/$FIRMWARE ] && exit 0
 | ||||||
| @@ -452,6 +453,18 @@ index 0000000000..1788908ab0 | |||||||
| +	echo -ne \\x${mac3//:/\\x} >> /lib/firmware/ath11k-macs
 | +	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() {
 | +caldata_die() {
 | ||||||
| +        echo "caldata: " "$*"
 | +        echo "caldata: " "$*"
 | ||||||
| +        exit 1
 | +        exit 1
 | ||||||
| @@ -523,12 +536,25 @@ index 0000000000..1788908ab0 | |||||||
| +	cig,wf188n)
 | +	cig,wf188n)
 | ||||||
| +		ath11k_generate_macs
 | +		ath11k_generate_macs
 | ||||||
| +		;;
 | +		;;
 | ||||||
|  | +	cig,wf194c|\
 | ||||||
|  | +	cig,wf194c)
 | ||||||
|  | +		ath11k_generate_macs_wf194
 | ||||||
|  | +		;;
 | ||||||
| +	esac
 | +	esac
 | ||||||
| +	;;
 | +	;;
 | ||||||
| +*)
 | +*)
 | ||||||
| +	exit 1
 | +	exit 1
 | ||||||
| +	;;
 | +	;;
 | ||||||
| +esac
 | +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
 | 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 | new file mode 100755 | ||||||
| index 0000000000..e64755b5d6
 | 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
 | 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 | new file mode 100755 | ||||||
| index 0000000000..407db099f6
 | index 0000000000..2c6b682178
 | ||||||
| --- /dev/null
 | --- /dev/null
 | ||||||
| +++ b/target/linux/ipq807x/base-files/lib/upgrade/platform.sh
 | +++ b/target/linux/ipq807x/base-files/lib/upgrade/platform.sh
 | ||||||
| @@ -0,0 +1,72 @@
 | @@ -0,0 +1,73 @@
 | ||||||
| +. /lib/functions/system.sh
 | +. /lib/functions/system.sh
 | ||||||
| +
 | +
 | ||||||
| +qca_do_upgrade() {
 | +qca_do_upgrade() {
 | ||||||
| @@ -4842,6 +4868,7 @@ index 0000000000..407db099f6 | |||||||
| +	edgecore,eap102|\
 | +	edgecore,eap102|\
 | ||||||
| +	edgecore,eap101)
 | +	edgecore,eap101)
 | ||||||
| +		CI_UBIPART="rootfs1"
 | +		CI_UBIPART="rootfs1"
 | ||||||
|  | +		[ "$(find_mtd_chardev rootfs)" ] && CI_UBIPART="rootfs"
 | ||||||
| +		nand_upgrade_tar "$1"
 | +		nand_upgrade_tar "$1"
 | ||||||
| +		;;
 | +		;;
 | ||||||
| +	esac
 | +	esac
 | ||||||
| @@ -16570,10 +16597,10 @@ index 0000000000..dc3960306d | |||||||
| +  * The following routines scan a subtree and registers a device for
 | +  * 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
 | diff --git a/target/linux/ipq807x/patches/200-bpf_backport.patch b/target/linux/ipq807x/patches/200-bpf_backport.patch
 | ||||||
| new file mode 100644 | new file mode 100644 | ||||||
| index 0000000000..915f965fa0
 | index 0000000000..4357369c29
 | ||||||
| --- /dev/null
 | --- /dev/null
 | ||||||
| +++ b/target/linux/ipq807x/patches/200-bpf_backport.patch
 | +++ b/target/linux/ipq807x/patches/200-bpf_backport.patch
 | ||||||
| @@ -0,0 +1,44763 @@
 | @@ -0,0 +1,44780 @@
 | ||||||
| +--- a/arch/arm/Kconfig
 | +--- a/arch/arm/Kconfig
 | ||||||
| ++++ b/arch/arm/Kconfig
 | ++++ b/arch/arm/Kconfig
 | ||||||
| +@@ -38,7 +38,7 @@ config ARM
 | +@@ -38,7 +38,7 @@ config ARM
 | ||||||
| @@ -61337,6 +61364,23 @@ index 0000000000..915f965fa0 | |||||||
| + 	} else {
 | + 	} else {
 | ||||||
| + 		if (unlikely((skb->protocol != htons(ETH_P_8021Q) &&
 | + 		if (unlikely((skb->protocol != htons(ETH_P_8021Q) &&
 | ||||||
| + 			      skb->protocol != htons(ETH_P_8021AD)) ||
 | + 			      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
 | diff --git a/toolchain/kernel-headers/Makefile b/toolchain/kernel-headers/Makefile
 | ||||||
| index c33f26d46d..06236b5a47 100644
 | index c33f26d46d..06236b5a47 100644
 | ||||||
| --- a/toolchain/kernel-headers/Makefile
 | --- a/toolchain/kernel-headers/Makefile
 | ||||||
|   | |||||||
| @@ -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 | ||||||
|  |  | ||||||
| @@ -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 | ||||||
|  |  | ||||||
							
								
								
									
										146
									
								
								patches/0049-hostapd-add-wispr-bandwidth-patch.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										146
									
								
								patches/0049-hostapd-add-wispr-bandwidth-patch.patch
									
									
									
									
									
										Normal 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 | ||||||
|  |  | ||||||
							
								
								
									
										992
									
								
								patches/0051-ipq807x-add-hfcl-ion4xe-i.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										992
									
								
								patches/0051-ipq807x-add-hfcl-ion4xe-i.patch
									
									
									
									
									
										Normal 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 | ||||||
|  |  | ||||||
| @@ -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 | ||||||
|  |  | ||||||
							
								
								
									
										622
									
								
								patches/0053-ipq807x-add-support-fro-wallytech-DR6018-v4.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										622
									
								
								patches/0053-ipq807x-add-support-fro-wallytech-DR6018-v4.patch
									
									
									
									
									
										Normal 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
									
								
							
							
						
						
									
										12
									
								
								profiles/hfcl_ion4xe.yml
									
									
									
									
									
										Normal 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
									
								
							
							
						
						
									
										12
									
								
								profiles/hfcl_ion4xi.yml
									
									
									
									
									
										Normal 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
									
								
							
							
						
						
									
										23
									
								
								profiles/qosify.yml
									
									
									
									
									
										Normal 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 | ||||||
| @@ -10,3 +10,5 @@ feeds: | |||||||
| include: | include: | ||||||
|   - wifi-ax |   - wifi-ax | ||||||
|   - ucentral-ap |   - ucentral-ap | ||||||
|  | diffconfig: | | ||||||
|  |   CONFIG_KERNEL_IPQ_MEM_PROFILE=0 | ||||||
|   | |||||||
| @@ -10,3 +10,5 @@ feeds: | |||||||
| include: | include: | ||||||
|   - wifi-ax |   - wifi-ax | ||||||
|   - ucentral-ap |   - ucentral-ap | ||||||
|  | diffconfig: | | ||||||
|  |   CONFIG_KERNEL_IPQ_MEM_PROFILE=0 | ||||||
|   | |||||||
| @@ -8,6 +8,7 @@ feeds: | |||||||
|  |  | ||||||
| include: | include: | ||||||
|   - webui |   - webui | ||||||
|  |   - qosify | ||||||
|  |  | ||||||
| packages: | packages: | ||||||
|   - kmod-batman-adv |   - kmod-batman-adv | ||||||
| @@ -16,7 +17,6 @@ packages: | |||||||
|   - ip-bridge |   - ip-bridge | ||||||
|   - maverick |   - maverick | ||||||
|   - ratelimit |   - ratelimit | ||||||
|   - qosify |  | ||||||
|   - tip-defaults |   - tip-defaults | ||||||
|   - ucentral-client |   - ucentral-client | ||||||
|   - ucentral-event |   - ucentral-event | ||||||
|   | |||||||
| @@ -8,6 +8,7 @@ feeds: | |||||||
|  |  | ||||||
| include: | include: | ||||||
|   - webui |   - webui | ||||||
|  |   - qosify | ||||||
|  |  | ||||||
| packages: | packages: | ||||||
|   - firstcontact |   - firstcontact | ||||||
| @@ -16,7 +17,6 @@ packages: | |||||||
|   - maverick |   - maverick | ||||||
|   - ratelimit |   - ratelimit | ||||||
|   - rtty-openssl |   - rtty-openssl | ||||||
|   - qosify |  | ||||||
|   - tip-defaults |   - tip-defaults | ||||||
|   - ucentral-client |   - ucentral-client | ||||||
|   - ucentral-event |   - ucentral-event | ||||||
|   | |||||||
| @@ -11,8 +11,10 @@ include: | |||||||
|   - openflow |   - openflow | ||||||
|   - fbwifi |   - fbwifi | ||||||
|   - chilli-redirect |   - chilli-redirect | ||||||
|  |   - qosify | ||||||
|  |  | ||||||
| packages: | packages: | ||||||
|  |   - atfpolicy | ||||||
|   - kmod-batman-adv |   - kmod-batman-adv | ||||||
|   - batctl-default |   - batctl-default | ||||||
|   - cJSON |   - cJSON | ||||||
| @@ -28,7 +30,6 @@ packages: | |||||||
|   - lldpd |   - lldpd | ||||||
|   - maverick |   - maverick | ||||||
|   - opennds |   - opennds | ||||||
|   - qosify |  | ||||||
|   - radsecproxy |   - radsecproxy | ||||||
|   - ratelimit |   - ratelimit | ||||||
|   - rtty-openssl |   - rtty-openssl | ||||||
| @@ -43,6 +44,7 @@ packages: | |||||||
|   - ucentral-tools |   - ucentral-tools | ||||||
|   - ucode |   - ucode | ||||||
|   - udhcpsnoop |   - udhcpsnoop | ||||||
|  |   - udnssnoop | ||||||
|   - usteer |   - usteer | ||||||
|   - ustp |   - ustp | ||||||
|   - libustream-openssl |   - libustream-openssl | ||||||
|   | |||||||
							
								
								
									
										14
									
								
								profiles/wallys_dr6018_v4.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								profiles/wallys_dr6018_v4.yml
									
									
									
									
									
										Normal 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
									
								
							
							
						
						
									
										12
									
								
								profiles/x64_vmware.yml
									
									
									
									
									
										Normal 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 | ||||||
		Reference in New Issue
	
	Block a user