Compare commits

..

109 Commits

Author SHA1 Message Date
jaspreetsachdev
81e38dec0d Merge pull request #726 from Telecominfraproject/main
hostapd: Removing 802.11w and SHA256 encryption from PSK-Radius
2024-09-18 15:30:04 -04:00
Firas Shaari
c9c2137a54 hostapd: Removing 802.11w and SHA256 encryption from PSK-Radius
Signed-off-by: Firas Shaari <firas.shaari@shaariconsultancy.com>
2024-09-18 08:55:18 +02:00
John Crispin
ddbf50b673 ratelimit: delete iface data when a radio gets restarted
Fixes: WIFI-14050
Signed-off-by: John Crispin <john@phrozen.org>
2024-09-17 07:59:25 +02:00
John Crispin
cf599560e7 ucentral-schema: update to latest HEAD
Fixes: WIFI-14094
Signed-off-by: John Crispin <john@phrozen.org>
2024-09-16 16:11:54 +02:00
John Crispin
83a6710095 ucentral-schema: add more mpsk examples
Signed-off-by: John Crispin <john@phrozen.org>
2024-09-16 15:49:56 +02:00
Tanya Singh
ecff108ac9 afc: Add more fields to ubus command for GPS to send location info to AFC server
Fixes: WIFI-14065
Signed-off-by: Tanya Singh <tanya_singh@accton.com>
2024-09-16 11:49:02 +02:00
John Crispin
18f357a06b ucentral-schema: update to latest HEAD
9e7873a command: add fixed_config

Fixes: WIFI-14136
Signed-off-by: John Crispin <john@phrozen.org>
2024-09-16 11:48:30 +02:00
John Crispin
aedbf9794e hostapd: sync patches
Fixes: WIFI-14118
Signed-off-by: John Crispin <john@phrozen.org>
2024-09-10 16:00:57 +02:00
John Crispin
c235143c16 hostapd: allow using psk2-radius in combination with enhanced MPSK
Signed-off-by: John Crispin <john@phrozen.org>
2024-09-09 15:47:42 +02:00
John Crispin
17a97e5060 ucentral-schema: update to latest HEAD
79f8158 wrap up psk2-radius / enhanced MPSK

Signed-off-by: John Crispin <john@phrozen.org>
2024-09-09 15:46:52 +02:00
Tanya Singh
b5d5af41f0 ipq95xx: Update bdf for Edgecore EAP105
FIxes: WIFI-14127
Signed-off-by: Tanya Singh <tanya_singh@accton.com>
2024-09-09 15:45:01 +02:00
Firas Shaari
2a4d4f6a2e hostapd: Higher WAP2 SHA256 breaks MPSK deployments
Fixes: WIFI-14092
Signed-off-by: Firas Shaari <firas.shaari@shaariconsultancy.com>
2024-09-09 15:27:22 +02:00
John Crispin
8cd635c895 hostapd: fix radius rate limit while roaming
Fixes: WIFI-14054
Signed-off-by: John Crispin <john@phrozen.org>
2024-09-09 15:27:08 +02:00
John Crispin
249b24c3c6 ratelimit: add a dump function
Signed-off-by: John Crispin <john@phrozen.org>
2024-09-09 15:27:07 +02:00
John Crispin
e479001b36 ucentral-event: tell rate-limit the BSS a STA was connected to
Fixes: WIFI-14053
Signed-off-by: John Crispin <john@phrozen.org>
2024-09-09 15:27:07 +02:00
John Crispin
c312d45e21 ratelimit: re-init device settings upon radio level config changes
The device was not re-initialized if ony radio settings get updated without the
device settings changing.

Fixes: WIFI-14050
Signed-off-by: John Crispin <john@phrozen.org>
2024-09-09 15:27:07 +02:00
John Crispin
1f5f5a1a06 ucentral-schema: update to latest HEAD
658a29d state.uc: Fixing negative coutners
06745bc handle multi-band phys for encryption check
c113cac fix 80211w value for "none" encryption

Signed-off-by: John Crispin <john@phrozen.org>
2024-09-09 15:27:07 +02:00
John Crispin
9ac52bd77a hostapd: fix mac specific multi-psk
Fixes: WIFI-14095
Signed-off-by: John Crispin <john@phrozen.org>
2024-09-09 15:27:07 +02:00
Ken
ba5074c57f ipq95xx: WF189 update BDF and set eth mac address
Fixes: WIFI-14096
Signed-off-by: Ken <xshi@actiontec.com>
2024-09-09 15:27:07 +02:00
Venkat Chimata
67c62ce445 ucentral-state: Set the LED state back to online on blink timeout
Signed-off-by: Venkat Chimata <venkata@shasta.cloud>
2024-09-09 15:27:07 +02:00
Tanya Singh
ef9a22bec7 ipq50xx: Update BDF for EAP104
Fixes: WIFI-14051
Fixes: WIFI-14055
Signed-off-by: Tanya Singh <tanya_singh@accton.com>
2024-09-09 15:27:07 +02:00
Tanya Singh
347b12e4dd ipq50xx: Update BDF for OAP101 series
Fixes: WIFI-13540
Fixes: WIFI-13578
Signed-off-by: Tanya Singh <tanya_singh@accton.com>
2024-09-09 15:27:07 +02:00
Marek Kwaczynski
06e3d3678d wireguard: update package hash
Update wireguard hash package, previous is not available.

Signed-off-by: Marek Kwaczynski <marek@shasta.cloud>
2024-08-30 09:19:23 -04:00
John Crispin
3357f668ee ucentral-event: add band / channel to join events
Signed-off-by: John Crispin <john@phrozen.org>
2024-08-15 10:32:38 +02:00
John Crispin
ed82b878c0 ucentral-schema: add gps support
Signed-off-by: John Crispin <john@phrozen.org>
2024-08-15 10:24:57 +02:00
CybertanYingWei
308c83263c mediatek: modify sonicfi rap630c-311g and sonicfi rap630w-311g company information
Signed-off-by: CybertanYingWei <Yingwei.Huang@cybertan.com.tw>
2024-08-15 07:20:30 +02:00
CybertanYingWei
06b8b32623 mediatek: add sonicfi rap630w 211g
Signed-off-by: CybertanYingWei <Yingwei.Huang@cybertan.com.tw>
2024-08-15 07:20:30 +02:00
John Crispin
16ebaf4fa3 hostapd: always override r0k_holder
Signed-off-by: John Crispin <john@phrozen.org>
2024-08-15 07:11:29 +02:00
Yin Ni
7d336070d7 ipq50xx: add initial support for GL.iNet B3000
Hardware:
* SoC: Qcom IPQ5018
* RAM: DDR3L 512MB
* Flash: 128MB Nand
* Ethernet: 3x GbE
* WLAN: 2x2 2.4GHz 574Mbps + 2x2 5GHz 2402Mbps (builtin + builtin)
* LEDS: 1x white, 1x blue
* Buttons: 1x reset
* Power: 12VDC, 1.5A

Installation:
* from qsdk to openwifi:
    upgrade "openwrt-ipq50xx-glinet_b3000-squashfs-nand-factory.bin" via web ui without keep config.
* upgrade "openwrt-ipq50xx-glinet_b3000-squashfs-sysupgrade.tar" if you are already in openwifi.

Signed-off-by: Yin Ni <yin.ni@gl-inet.com>
2024-08-12 15:59:03 +02:00
Tanya Singh
18889cfb54 mediatek: Support Edgecore EAP112
Fixes: WIFI-13753
Signed-off-by: Tanya Singh <tanya_singh@accton.com>
2024-08-12 10:24:11 +02:00
Venkat Chimata
9a3337c49e ipq807x: edgecore_oap101: Configure wifi and power leds correctly
Signed-off-by: Venkat Chimata <venkata@shasta.cloud>
2024-08-12 10:24:06 +02:00
Venkat Chimata
b8a4373e56 ipq807x: edgecore_oap101: Update upgrade_available correctly in the bootcount init.d script
Signed-off-by: Venkat Chimata <venkata@shasta.cloud>
2024-08-12 10:24:01 +02:00
Venkat Chimata
d5feaf2d4b ipq807x: Generate WiFi MAC Addresses correctly for Edgecore OAP101
Signed-off-by: Venkat Chimata <venkata@shasta.cloud>
2024-08-12 10:23:49 +02:00
John Crispin
e6ca8a30d5 ucentral-schema: update to latest HEAD
a626097 add schema for RRM based on Channel Utilization
39aed21 captive: allow loading the web-root from an external http server
37e3895 add multi-psk2-radius

Signed-off-by: John Crispin <john@phrozen.org>
2024-08-07 07:10:34 +02:00
John Crispin
ebe0b3ea52 hostapd: do not auto generate r0/1k keys when ft_key is set
Signed-off-by: John Crispin <john@phrozen.org>
2024-08-07 06:38:24 +02:00
Venkat Chimata
93b4735ca5 leds: Add controllable power LED option for multiple platforms
Add controllable power LED support for -

CIG WF186W, CIG WF186H, CIG WF188N, CIG WF196, Edgecore EAP101 and
Edgecore EAP102 and Edgecore EAP104

Signed-off-by: Venkat Chimata <venkata@shasta.cloud>
2024-08-07 06:27:10 +02:00
Tanya Singh
6d4f5b961e RRM: Channel Optimization based on Channel Utilization
Fixes: WIFI-13220
Signed-off-by: Tanya Singh <tanya_singh@accton.com>
2024-08-07 06:26:33 +02:00
Firas Shaari
63899e09ce Update rate-limit.json
Removing unnecessarily roaming configs from the rate-limit example.
2024-08-07 06:26:08 +02:00
John Crispin
028b96ee88 ipq95xx: fix multiple_bssid support
Fixes: WIFI-13906
Signed-off-by: John Crispin <john@phrozen.org>
2024-08-05 13:30:23 +02:00
John Crispin
b5eef3e284 uspot: use static html files
Signed-off-by: John Crispin <john@phrozen.org>
2024-08-05 09:12:47 +02:00
John Crispin
51437a78c0 mt76: populate wiphy->max_ap_assoc_sta
Fixes: WIFI-13513
Signed-off-by: John Crispin <john@phrozen.org>
2024-08-02 13:56:32 +02:00
John Crispin
a619e59c1d mt76: de-duplicate package
Signed-off-by: John Crispin <john@phrozen.org>
2024-08-02 13:55:15 +02:00
John Crispin
06cfa19b79 ucentral-client: detect 0 byte capabilities file
Fixes: WIFI-14023
Signed-off-by: John Crispin <john@phrozen.org>
2024-08-02 13:19:41 +02:00
John Crispin
c82e67b45b mediatek: fix /certificates mounting
latest mass production samples use ZSTD compression for certificates

Signed-off-by: John Crispin <john@phrozen.org>
2024-08-02 13:03:24 +02:00
John Crispin
d603ecd10a ratelimit: apply updated ratelimit to associated stations
Fixes: WIFI-13453
Fixes: WIFI-13840
Signed-off-by: John Crispin <john@phrozen.org>
2024-08-02 12:41:00 +02:00
John Crispin
0c19ddddca hostapd: fix wpa3-192 + 11r AKM
Fixes: WIFI-14016
Signed-off-by: John Crispin <john@phrozen.org>
2024-08-02 11:06:37 +02:00
John Crispin
c128391b58 ipq807x: update WF186 BDF files
Signed-off-by: John Crispin <john@phrozen.org>
2024-08-02 10:47:24 +02:00
Ken
4996cbd313 ipq807x: CIG-WF660a 5.4 Kernel/Firmware upgrade
Fixes: WIFI-13041
Signed-off-by: Ken <xshi@actiontec.com>
2024-08-02 10:44:10 +02:00
Your Name
c48d145889 add sonicfi rap630c-311g and sonicfi rap630w-311g
Signed-off-by: Your Name <you@example.com>
2024-07-31 10:13:36 +02:00
Venkat Chimata
bbc78828fc ieee8021x: Fix connectivity issues with a non-vlan based event Non-vlan based ieee8021x client was not able get IP Addess through the AP. The reason was that ieee8021x.uc subscriptions could n't subscribe hostapd events as the subscribe functions are called before creating the interfaces.
To handle this, invoke hapd_subscriber.subscribe after the interface is created.
Also dont delete the interface from ifaces as ifaces should always contain the
configured ports (from uci config) per ieee8021x.uc design.
Deleting interfaces from ifaces will lead to ieee8021x.uc crashes.

Signed-off-by: Venkat Chimata <venkata@shasta.cloud>
2024-07-24 16:08:04 +02:00
John Crispin
51a71c2224 ubox: add log_priority patch
Fixes: WIFI-14006
Signed-off-by: John Crispin <john@phrozen.org>
2024-07-24 07:19:07 +02:00
John Crispin
b99e374fae ucentral-schema: update to latest HEAD
bf512cd (HEAD -> main, origin/main, origin/HEAD) fix wifi assoc with main PSK in MPSK scenarios

Fixes: WIFI-13953
Signed-off-by: John Crispin <john@phrozen.org>
2024-07-24 06:52:44 +02:00
John Crispin
03e06c52d8 ucentral-schema: update to latest HEAD
f4924dc roaming: add support for 256 bit AES keys

Fixes: WIFI-14005
Fixes: WIFI-13980
Fixes: WIFI-13979
Fixes: WIFI-13968
Signed-off-by: John Crispin <john@phrozen.org>
2024-07-24 06:35:59 +02:00
John Crispin
273bce6f76 hostapd: fix extended radius AVPs
Signed-off-by: John Crispin <john@phrozen.org>
2024-07-24 06:14:00 +02:00
John Crispin
0a21b9d254 hostapd: enable FT-PSK for psk2-radius
Signed-off-by: John Crispin <john@phrozen.org>
2024-07-24 06:14:00 +02:00
Shashi Kushwaha
a5b132fc72 ipq50xx: hard reset issue resolved udaya wifi 6
Signed-off-by: Shashi Kushwaha <shashi.kushwaha@inventum.net>
2024-07-18 16:08:08 +02:00
Firas Shaari
644f6ebcd6 ucentral-schema: Update wpa2-radius.json
Fix configurations for the WPA2 Enterprise example with 802.11r enabled for fast transitioning.

Signed-off-by: Firas Shaari <fshaari-c@telecominfraproject.com>
2024-07-18 16:08:08 +02:00
John Crispin
a0c0abb6ac qca-ssdk: use INFO severity to indicate FDB flush
Signed-off-by: John Crispin <john@phrozen.org>
2024-07-18 16:08:08 +02:00
John Crispin
ed8311e4e4 hostapd: add ft_key easy button
Signed-off-by: John Crispin <john@phrozen.org>
2024-07-18 16:08:08 +02:00
John Crispin
3085bf3ccc hostapd: add rate support to FT
Signed-off-by: John Crispin <john@phrozen.org>
2024-07-18 16:08:08 +02:00
John Crispin
27ad029ceb hostapd: add origin_ap to events for FT associations
Signed-off-by: John Crispin <john@phrozen.org>
2024-07-13 15:35:43 +02:00
John Crispin
92dbb0e408 ucentral-schema: update to latest HEAD
2b14486 Fixing issues with section names in network config

Signed-off-by: John Crispin <john@phrozen.org>
2024-07-12 11:44:53 +02:00
John Crispin
5eb9df2df6 mediatek: mt76: Fix null pointer access
Fix null pointer dereference issue during Authentication stage and
add sanity check in mt7915_sta_statistics

Signed-off-by: John Crispin <john@phrozen.org>
2024-07-11 12:25:59 +02:00
John Crispin
6f2bd226f8 ucentral-schema: update to latest HEAD
9ccc1e0 add enhanced mpsk support

Signed-off-by: John Crispin <john@phrozen.org>
2024-07-11 12:17:15 +02:00
John Crispin
65eca97d16 ucentral-schema: update to latest HEAD
3cdfe8b Increase MAX MTU to 1600

Signed-off-by: John Crispin <john@phrozen.org>
2024-07-11 12:17:15 +02:00
John Crispin
9596f15742 ipq40xx: drop support
Signed-off-by: John Crispin <john@phrozen.org>
2024-07-11 12:17:15 +02:00
Venkat Chimata
131a26bcc0 eap104: Update the environment variable bootcount properly for EAP104
In the bootcount script there was no entry for Edgecore EAP104 to
set the bootcount. This commit adds support for Edgecore EAP104 in
bootcount script to set the environment variable correctly

Signed-off-by: Venkat Chimata <venkata@shasta.cloud>
2024-07-11 12:17:15 +02:00
Venkat Chimata
4b50ff9798 ipq50xx: Adjust ubootenv_size for ipq50xx
ubootenv_size is computed dynamically similar to ipq807x.
This resolves the issue where fw_setenv fails with the following error.

MTD erase error on /dev/mtd13: Invalid argument
Error: can't write fw_env to flash

Signed-off-by: Venkat Chimata <venkata@shasta.cloud>
2024-07-11 12:17:15 +02:00
Venkat Chimata
0b0de111e2 mac80211: Update tx stats correctly in case of AP mode
In the backports driver the tx stats are updated in ieee80211_8023_xmit.
However in AP mode the packets are transmitted in ieee80211_8023_xmit_ap.
ieee80211_8023_xmit is not hit in case of AP mode. Update the stats just
before calling ieee80211_8023_xmit_ap

Signed-off-by: Venkat Chimata <venkata@shasta.cloud>
2024-07-11 12:17:15 +02:00
HaiBac
0f999a54c1 ipq807x: add wallys DR5018 support
Signed-off-by: HaiBac <mail@bacnh.com>
2024-07-11 12:17:15 +02:00
Arif Alam
4b0297ba07 wireguard: update package hash
Signed-off-by: Arif Alam <arif.alam@netexperience.com>
2024-07-11 12:17:15 +02:00
John Crispin
a438d39486 ath11k: fix monitor mode
Enabling CPTCFG_ATH11K_MEM_PROFILE_512M will change the layout of
struct hal_rx_desc_ipq8074. This broke monitor mode. Fix it by not modifying
the struct even if the 512MB profile is enabled.

Fixes: WIFI-12102
Signed-off-by: John Crispin <john@phrozen.org>
2024-07-11 12:17:15 +02:00
John Crispin
33f8f22375 hostapd: add enhanced MPSK support
Signed-off-by: John Crispin <john@phrozen.org>
2024-07-11 12:17:15 +02:00
Felix Fietkau
6afc11838e hostapd: add support for authenticating with multiple PSKs via ubus helper
Also supports assigning a VLAN ID based on the PSK

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2024-07-11 09:34:28 +02:00
Felix Fietkau
b5048d8305 hostapd: reject probe/assoc/auth requests if any subscriber rejects them
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2024-07-03 08:41:03 +02:00
John Crispin
03d14daf20 ucentral-schema: update to latest HEAD
dd31b74 set 3.2.0 as the version

Signed-off-by: John Crispin <john@phrozen.org>
2024-07-03 08:23:33 +02:00
John Crispin
76c16ccc96 ucentral-schema: set 3.2.0 as the version
Signed-off-by: John Crispin <john@phrozen.org>
2024-07-03 08:15:12 +02:00
John Crispin
8b6e73477b ipq53xx: fix lan/wan mapping on cig wf-189
Signed-off-by: John Crispin <john@phrozen.org>
2024-07-03 06:52:55 +02:00
joydeepbenison
c51a24db43 ucentral-event: Fix Modifying VLAN-ID Under LAN Port
This commit is an improvement over previous
commit 3598a243b3 which added a
fix for traffic disruption when vlan id of the lan port is
changed on devices with internal switches such as fap655,
CIG_WF186w,EAP-104.
This commit reconfigures the vlans for the mpsk clients on the
switch using the ucentral-event subsystem by tracking the
netifd_add events.

Fixes: WIFI-13797
Signed-off-by: joydeepbenison <joydeep.ghosh@benisontech.com>
2024-07-03 06:40:52 +02:00
Venkat Chimata
45eb5c9a6b ieee8021x / hostapd: Fix 802.1x + DVLAN issues
ieee8021x
---------
1. Handle link_up events and update hostapd config
2. For certains scenarios, we need to remove and add
   instead of reload (reload did not work).
   Consider the following scenario -
   Say on CIG 186w as an example
   eth0.4086 interface exists with some non-ieee8021x config.
   Push ieee8021x config. In general the flow is that
   reload_config is called followed by invocation of services (from ucentral-schema)
   Services inovation does n't wait until the configi reloaded ie in this context
   ieee8021x service is invoked much before the network interfaces are recreated.
   That is not correct. To handle this, we capture link-up events
   and remove the existing interface (in hostapd as shown below) and add again
3. For swconfig platforms, the names contain a dot. Handle that gracefully in
   ubus_unsub_object while adding hostapd interface
4. Add better logging using log.syslog

hostapd
---------
In case of swconfig switches, the basename of the interface should be based on the last dot.
Earlier it was done based on the first dot, which would result in incorrect basename.
For example if the interface name is eth0.4087 then the vlan->ifname would be eth0.4087.  (A dot at the end) .
Before this patch, the basename was returned as eth0. It should be eth0.4087

Also fixed the return code by adding a default value of 0 and removed an unncessary check
for if_add before ubus add call.

Signed-off-by: Venkat Chimata <venkata@shasta.cloud>
2024-07-03 06:37:47 +02:00
John Crispin
a449f08839 hostapd: run afc client in insecure mode if the CA is not present
Signed-off-by: John Crispin <john@phrozen.org>
2024-06-28 06:21:36 +02:00
John Crispin
70b8ad926c ipq53xx: add EAP105 to CI
Signed-off-by: John Crispin <john@phrozen.org>
2024-06-28 06:21:26 +02:00
John Crispin
431ad6c09d ath11k-wifi: update CIG WF-188n BDF files
Signed-off-by: John Crispin <john@phrozen.org>
2024-06-20 11:43:15 +02:00
tanya.singh
276f039964 ipq53xx: Update board data file for EAP102 to support DFS channels correctly on India (IN) country code
Fixes: WIFI-13858
Signed-off-by: Tanya Singh <tanya_singh@accton.com>
2024-06-20 08:40:46 +02:00
John Crispin
962f84ca24 ucentral-schema: update to latest HEAD
83218cf use the correct path when removing old config files

Signed-off-by: John Crispin <john@phrozen.org>
2024-06-19 16:32:52 +02:00
John Crispin
10d8c47272 hostapd: drop wispr rate patch
this was breaking EAP-TTLS roaming

Signed-off-by: John Crispin <john@phrozen.org>
2024-06-19 13:54:58 +02:00
John Crispin
ad51d1788c hostapd: fix OWE vendor IE content
Signed-off-by: John Crispin <john@phrozen.org>
2024-06-18 13:09:37 +02:00
John Crispin
381265f8b3 ucentral-schema: update to latest HEAD
6e90f22 captive: fix NAT mode traffic capturing

Signed-off-by: John Crispin <john@phrozen.org>
2024-06-13 16:45:32 +02:00
John Crispin
1d106efd51 ath11k: fix multi band roaming
when roaming between 2 radios the following error messages would show up in the logs

[681066.503943] ath11k c000000.wifi: Failed to add peer: 38:f9:d3:bf:b2:d4 for VDEV: 1
[681066.503979] ath11k c000000.wifi: Failed to add station: 38:f9:d3:bf:b2:d4 for VDEV: 1

Signed-off-by: John Crispin <john@phrozen.org>
2024-06-13 08:23:05 +02:00
Hugo Yuan
bb7d78cd7d ipq50xx: fix typo in Makefile
Signed-off-by: Hugo Yuan <429632952@163.com>
2024-06-12 19:58:21 +02:00
John Crispin
f59883ec8e ucentral-schema: update to latest HEAD
857c3ba OWE: reorder config sections to ensure that the vendor IE gets populated with the correct SSID

Signed-off-by: John Crispin <john@phrozen.org>
2024-06-12 17:49:49 +02:00
John Crispin
ef0242c148 wireless-regdb: add DFS region for india
Signed-off-by: John Crispin <john@phrozen.org>
2024-06-12 14:48:21 +02:00
Felix Fietkau
0a758ca5fc mediatek-sdk: fix mt76 crash
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2024-06-12 14:47:14 +02:00
Felix Fietkau
9569b46398 ipq807x_v5.4: support sending FT refresh frames for switch learning tables
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2024-06-12 14:46:54 +02:00
John Crispin
2b536f9bdb captive: impove local mode /logoff support
Signed-off-by: John Crispin <john@phrozen.org>
2024-06-10 17:23:36 +02:00
John Crispin
95940b4fc7 ipq50xx: fix udaya a6-id2 image path
Signed-off-by: John Crispin <john@phrozen.org>
2024-06-10 13:14:44 +02:00
John Crispin
b5f0d205a3 ipq50xx: add LED support for udaya a6-id2
Signed-off-by: John Crispin <john@phrozen.org>
2024-06-10 08:59:47 +02:00
John Crispin
60a5609427 ucentral-schema: add more fingerprint sample config files
Signed-off-by: John Crispin <john@phrozen.org>
2024-06-10 08:26:36 +02:00
John Crispin
5784fbc9d0 ucentral-schema: update to latest HEAD
dcd571e allow only psc on 6GHz auto channel selection
310095a captive: handle /logoff and /logout paths
7aceedc ratelimit: reload the service rather than restarting it
ce41668 fingerprint: add missing allow_wan option to render code
721568b Merge pull request #17 from Telecominfraproject/WIFI-431-fix-update-internal-schema-validation
7d05e70 more AFC fixes

Signed-off-by: John Crispin <john@phrozen.org>
2024-06-10 06:11:00 +02:00
John Crispin
0037af2a6b afcd: allow starting the daemon without a CA
Signed-off-by: John Crispin <john@phrozen.org>
2024-06-10 06:08:30 +02:00
John Crispin
ed543017a3 ip807x: add missing yaml file for Udaya a6-id2
Signed-off-by: John Crispin <john@phrozen.org>
2024-06-10 06:07:53 +02:00
Arif Alam
5162c60dae hostapd: add config for acs to only pick psc in 6GHz band
Fixes WIFI-13750

Signed-off-by: Arif Alam <arif.alam@netexperience.com>
2024-06-10 06:06:36 +02:00
John Crispin
1ff690c3f7 captive: allow /login endpoint
Signed-off-by: John Crispin <john@phrozen.org>
2024-06-08 09:55:12 +02:00
John Crispin
e17c6e5918 uspot: add logoff/out support to local captive
Signed-off-by: John Crispin <john@phrozen.org>
2024-06-07 16:44:11 +02:00
John Crispin
4ca64012ef ipq50xx: add Udaya A6-ID2 support
Fixes: WIFI-13058
Signed-off-by: John Crispin <john@phrozen.org>
2024-06-07 11:57:35 +02:00
John Crispin
470983bba3 ratelimit: allow flushing all default values
Signed-off-by: John Crispin <john@phrozen.org>
2024-06-07 09:38:55 +02:00
John Crispin
5b168597de certificates: fix cert loading on dual boot EAP111
Signed-off-by: John Crispin <john@phrozen.org>
2024-06-07 07:22:29 +02:00
John Crispin
54072c22a4 ucentral-schema: update to latest HEAD
5226dc8 fix afc_op_class

Signed-off-by: John Crispin <john@phrozen.org>
2024-06-06 14:21:13 +02:00
John Crispin
82ef44048b afcd: do not require a CA
Signed-off-by: John Crispin <john@phrozen.org>
2024-06-06 14:20:42 +02:00
503 changed files with 13717 additions and 53355 deletions

View File

@@ -21,7 +21,7 @@ jobs:
strategy:
fail-fast: false
matrix:
target: [ 'cig_wf186h', 'cig_wf186w', 'cig_wf188n', 'cig_wf196', 'cig_wf189', 'cybertan_eww631-a1', 'cybertan_eww631-b1', 'edgecore_eap101', 'edgecore_eap102', 'edgecore_eap104', 'edgecore_eap111', 'edgecore_ecw5211', 'edgecore_oap101', 'edgecore_oap101-6e', 'edgecore_oap101e', 'edgecore_oap101e-6e', 'hfcl_ion4', 'hfcl_ion4xe', 'hfcl_ion4xi', 'hfcl_ion4x', 'hfcl_ion4x_2', 'hfcl_ion4x_3', 'hfcl_ion4xi_w', 'hfcl_ion4x_w', 'indio_um-305ax', 'indio_um-325ac', 'indio_um-510ac-v3', 'indio_um-550ac', 'sercomm_ap72tip', 'udaya_a5-id2', 'wallys_dr40x9', 'wallys_dr6018', 'wallys_dr6018-v4', 'yuncore_ax820', 'yuncore_ax840', 'yuncore_fap640', 'yuncore_fap650', 'yuncore_fap655' ]
target: [ 'cig_wf186h', 'cig_wf186w', 'cig_wf188n', 'cig_wf196', 'cig_wf189', 'cybertan_eww631-a1', 'cybertan_eww631-b1','sonicfi_rap630c-311g', 'sonicfi_rap630w-311g', 'sonicfi_rap630w-211g', 'edgecore_eap101', 'edgecore_eap102', 'edgecore_eap104', 'edgecore_eap105', 'edgecore_eap111', 'edgecore_eap112', 'edgecore_oap101', 'edgecore_oap101-6e', 'edgecore_oap101e', 'edgecore_oap101e-6e', 'hfcl_ion4xe', 'hfcl_ion4xi', 'hfcl_ion4x', 'hfcl_ion4x_2', 'hfcl_ion4x_3', 'hfcl_ion4xi_w', 'hfcl_ion4x_w', 'indio_um-305ax', 'sercomm_ap72tip', 'udaya_a6-id2', 'wallys_dr5018', 'wallys_dr6018', 'wallys_dr6018-v4', 'yuncore_ax820', 'yuncore_ax840', 'yuncore_fap640', 'yuncore_fap650', 'yuncore_fap655' ]
steps:
- uses: actions/checkout@v3

View File

@@ -32,9 +32,12 @@ ALLWIFIBOARDS:= \
cybertan-eww622-a1 \
cybertan-eww631-a1 \
cybertan-eww631-b1 \
sonicfi-rap630c-311g \
sonicfi-rap630w-311g \
edgecore-eap101 \
gl-ax1800 \
gl-axt1800 \
gl-b3000 \
sercomm-wallaby \
edgecore-eap102 \
edgecore-oap102 \
@@ -45,6 +48,7 @@ ALLWIFIBOARDS:= \
indio-um-510axm-v1 \
muxi-ap3220l \
plasmacloud-pax1800 \
wallys-dr5018 \
wallys-dr6018 \
wallys-dr6018-v4 \
tplink-ex227 \
@@ -52,6 +56,7 @@ ALLWIFIBOARDS:= \
yuncore-ax840 \
yuncore-fap650 \
yuncore-fap655 \
udaya-a6-id2 \
meshpp-s618
ALLWIFIPACKAGES:=$(foreach BOARD,$(ALLWIFIBOARDS),ath11k-wifi-$(BOARD))
@@ -104,6 +109,11 @@ $(call Package/ath11k-wifi-default)
TITLE:=gl-axt1800 bdf
endef
define Package/ath11k-wifi-gl-b3000
$(call Package/ath11k-wifi-default)
TITLE:=gl-b3000 bdf
endef
define Package/ath11k-wifi-motorola-q14
$(call Package/ath11k-wifi-default)
TITLE:=motorola q14 bdf
@@ -289,6 +299,13 @@ define Package/ath11k-wifi-gl-axt1800/install
$(INSTALL_DATA) ./board-gl-axt1800.bin.IPQ6018 $(1)/lib/firmware/ath11k/IPQ6018/hw1.0/board-2.bin
endef
define Package/ath11k-wifi-gl-b3000/install
$(INSTALL_DIR) $(1)/lib/firmware/ath11k/IPQ5018/hw1.0/
$(INSTALL_DIR) $(1)/lib/firmware/ath11k/qcn6122/hw1.0/
$(INSTALL_DATA) ./board-gl-b3000.bin.IPQ5018 $(1)/lib/firmware/ath11k/IPQ5018/hw1.0/board.bin
$(INSTALL_DATA) ./board-gl-b3000.bin.QCN6122 $(1)/lib/firmware/ath11k/qcn6122/hw1.0/board.bin
endef
define Package/ath11k-wifi-motorola-q14/install
$(INSTALL_DIR) $(1)/lib/firmware/ath11k/IPQ5018/hw1.0/
$(INSTALL_DIR) $(1)/lib/firmware/ath11k/qcn6122/hw1.0/
@@ -375,6 +392,8 @@ $(eval $(call generate-ath11k-wifi-package,cig-wf194c4,Cigtech WF194c4))
$(eval $(call generate-ath11k-wifi-package,cybertan-eww622-a1,CyberTan EWW622 A1))
$(eval $(call generate-ath11k-wifi-package,cybertan-eww631-a1,CyberTan EWW631 A1))
$(eval $(call generate-ath11k-wifi-package,cybertan-eww631-b1,CyberTan EWW631 B1))
$(eval $(call generate-ath11k-wifi-package,sonicfi-rap630c-311g,Sonicfi RAP630C 311G))
$(eval $(call generate-ath11k-wifi-package,sonicfi-rap630w-311g,Sonicfi RAP630W 311G))
$(eval $(call generate-ath11k-wifi-package,sercomm-wallaby,Sercomm Kiwi))
$(eval $(call generate-ath11k-wifi-package,wallys-dr6018,Wallys DR6018))
$(eval $(call generate-ath11k-wifi-package,wallys-dr6018-v4,Wallys DR6018 V4))
@@ -393,6 +412,8 @@ $(eval $(call generate-ath11k-wifi-package,meshpp-s618,Mesh++ S618))
$(eval $(call generate-ath11k-wifi-package,muxi-ap3220l,MUXI AP3220L))
$(eval $(call generate-ath11k-wifi-package,yuncore-fap650,YunCore FAP650))
$(eval $(call generate-ath11k-wifi-package,yuncore-fap655,YunCore FAP655))
$(eval $(call generate-ath11k-wifi-package,udaya-a6-id2,Udaya A6-ID2))
$(eval $(call generate-ath11k-wifi-package,wallys-dr5018,Wallys DR5018))
$(foreach PACKAGE,$(ALLWIFIPACKAGES),$(eval $(call BuildPackage,$(PACKAGE))))
$(eval $(call BuildPackage,ath11k-wifi-qcom-ipq5018))

View File

@@ -601,10 +601,11 @@ define Package/afcd/install
$(INSTALL_DIR) $(1)/usr/share/hostap $(1)/etc/init.d
$(INSTALL_BIN) ./files/afcd.init $(1)/etc/init.d/afcd
$(INSTALL_DATA) ./files/afcd.uc $(1)/usr/share/hostap/
$(INSTALL_DATA) ./files/afc_location.uc $(1)/usr/share/hostap/
endef
define Install/hostapd
$(INSTALL_DIR) $(1)/usr/sbin $(1)/usr/share/hostap
$(INSTALL_DIR) $(1)/usr/sbin $(1)/usr/share/hostap $(1)/etc/init.d
$(INSTALL_DATA) ./files/hostapd.uc $(1)/usr/share/hostap/
$(INSTALL_DIR) $(1)/etc/init.d $(1)/etc/config $(1)/etc/radius
ln -sf hostapd $(1)/usr/sbin/hostapd-radius
@@ -612,6 +613,8 @@ define Install/hostapd
$(INSTALL_DATA) ./files/radius.config $(1)/etc/config/radius
$(INSTALL_DATA) ./files/radius.clients $(1)/etc/radius/clients
$(INSTALL_DATA) ./files/radius.users $(1)/etc/radius/users
$(INSTALL_BIN) ./files/mpskd $(1)/usr/share/hostap/
$(INSTALL_BIN) ./files/mpskd.init $(1)/etc/init.d/mpskd
endef
define Install/supplicant

View File

@@ -0,0 +1,23 @@
#!/usr/bin/env ucode
'use strict';
let fs = require("fs");
let ubus = require('ubus').connect();
let gps_info = ubus.call('gps', 'info');
let latitude = gps_info.latitude ?? 0;
let longitude = gps_info.longitude ?? 0;
// afc-location.json file content
let afc_location = {};
afc_location.location_type = "ellipse";
afc_location.location = longitude + ":" + latitude ;
afc_location.height = gps_info.elevation ?? 0;
afc_location.height_type = "AMSL";
afc_location.major_axis = gps_info.major_axis ?? 0;
afc_location.minor_axis = gps_info.minor_axis ?? 0;
afc_location.orientation = gps_info.major_orientation ?? 0;
afc_location.vertical_tolerance = gps_info.vdop ?? 0;
let afc_location_json = fs.open("/etc/ucentral/afc-location.json", "w");
afc_location_json.write(afc_location);
afc_location_json.close();

View File

@@ -4,6 +4,7 @@ START=19
USE_PROCD=1
NAME=afcd
PROG=/usr/bin/ucode
add_afc() {
config_get_bool disabled "$1" disabled 0
@@ -11,10 +12,19 @@ add_afc() {
config_get url "$1" url
config_get cert "$1" cert
[ -n "$cert" -a -n "$url" ] || return
[ -n "$url" ] || return
procd_open_instance afcd
procd_set_param command /usr/bin/ucode /usr/share/hostap/afcd.uc -u "$url" -c "$cert"
procd_set_param command "$PROG" /usr/share/hostap/afcd.uc -u "$url"
[ -n "$cert" ] && procd_append_param command -c "$cert"
procd_set_param respawn
procd_close_instance
}
_afc_location() {
# create afc-location.json
procd_open_instance
procd_set_param command "$PROG" /usr/share/hostap/afc_location.uc
procd_set_param respawn
procd_close_instance
}
@@ -22,6 +32,9 @@ add_afc() {
start_service() {
config_load wireless
config_foreach add_afc afc-server
local gps_disabled=$(uci get gps.@gps[-1].disabled)
[ "$gps_disabled" -eq 0 ] && _afc_location
}
service_triggers()

View File

@@ -72,7 +72,7 @@ function handle_request(req)
let cl = uclient.new(opts.url, null, cb);
if (!cl.ssl_init({ verify: true, ca_files: [ opts.cert ] })) {
if (!cl.ssl_init({ verify: !!opts.cert, ca_files: [ opts.cert ] })) {
warn(`Failed to initialize SSL\n`);
return false;
}

View File

@@ -47,8 +47,8 @@ hostapd_append_wpa_key_mgmt() {
[ "${ieee80211w:-0}" -gt 0 ] && append wpa_key_mgmt "WPA-${auth_type_l}-SHA256"
;;
eap192)
append wpa_key_mgmt "WPA-EAP-SUITE-B-192"
[ "${ieee80211r:-0}" -gt 0 ] && append wpa_key_mgmt "FT-EAP"
[ "${ieee80211r:-0}" -gt 0 ] || append wpa_key_mgmt "WPA-EAP-SUITE-B-192"
[ "${ieee80211r:-0}" -gt 0 ] && append wpa_key_mgmt "FT-EAP-SHA384"
;;
eap-eap2)
append wpa_key_mgmt "WPA-EAP"
@@ -73,6 +73,10 @@ hostapd_append_wpa_key_mgmt() {
owe)
append wpa_key_mgmt "OWE"
;;
psk2-radius)
append wpa_key_mgmt "WPA-PSK"
[ "${ieee80211r:-0}" -gt 0 ] && append wpa_key_mgmt "FT-PSK"
;;
esac
[ "$fils" -gt 0 ] && {
@@ -404,8 +408,8 @@ hostapd_common_add_bss_config() {
config_add_string lci civic
config_add_boolean ieee80211r pmk_r1_push ft_psk_generate_local ft_over_ds
config_add_int r0_key_lifetime reassociation_deadline
config_add_string mobility_domain r1_key_holder
config_add_int r0_key_lifetime reassociation_deadline ft_l2_refresh
config_add_string mobility_domain r1_key_holder ft_key
config_add_array r0kh r1kh
config_add_int ieee80211w_max_timeout ieee80211w_retry_timeout
@@ -984,10 +988,11 @@ hostapd_set_bss_options() {
set_default ieee80211r 0
if [ "$ieee80211r" -gt "0" ]; then
json_get_vars mobility_domain ft_psk_generate_local ft_over_ds reassociation_deadline
json_get_vars mobility_domain ft_psk_generate_local ft_over_ds reassociation_deadline ft_l2_refresh
set_default mobility_domain "$(echo "$ssid" | md5sum | head -c 4)"
set_default ft_over_ds 1
set_default ft_l2_refresh 30
set_default reassociation_deadline 1000
skip_kh_setup=0
@@ -1010,9 +1015,10 @@ hostapd_set_bss_options() {
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 "reassociation_deadline=$reassociation_deadline" "$N"
[ -n "$ft_l2_refresh" ] && append bss_conf "ft_l2_refresh=$ft_l2_refresh" "$N"
if [ "$skip_kh_setup" -eq "0" ]; then
json_get_vars r0_key_lifetime r1_key_holder pmk_r1_push
json_get_vars r0_key_lifetime r1_key_holder pmk_r1_push ft_key
json_get_values r0kh r0kh
json_get_values r1kh r1kh
@@ -1020,12 +1026,15 @@ hostapd_set_bss_options() {
set_default pmk_r1_push 0
[ -n "$r0kh" -a -n "$r1kh" ] || {
key=`echo -n "$mobility_domain/$auth_secret" | md5sum | awk '{print $1}'`
[ -z "$ft_key" ] && {
key=`echo -n "$mobility_domain/$auth_secret" | md5sum | awk '{print $1}'`
set_default r0kh "ff:ff:ff:ff:ff:ff,*,$key"
set_default r1kh "00:00:00:00:00:00,00:00:00:00:00:00,$key"
set_default r0kh "ff:ff:ff:ff:ff:ff,*,$key"
set_default r1kh "00:00:00:00:00:00,00:00:00:00:00:00,$key"
}
}
[ -n "$ft_key" ] && append bss_conf "ft_key=$ft_key" "$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 "pmk_r1_push=$pmk_r1_push" "$N"

View File

@@ -833,6 +833,8 @@ let main_obj = {
hostapd.printf(`Set new config for phy ${phy}: ${file}`);
iface_set_config(phy, config);
hostapd.data.auth_obj.notify("reload", { phy });
return {
pid: hostapd.getpid()
};
@@ -872,6 +874,9 @@ let main_obj = {
hostapd.data.ubus = ubus;
hostapd.data.obj = ubus.publish("hostapd", main_obj);
let auth_obj = {};
hostapd.data.auth_obj = ubus.publish("hostapd-auth", auth_obj);
function bss_event(type, name, data) {
let ubus = hostapd.data.ubus;
@@ -901,5 +906,23 @@ return {
},
bss_remove: function(name, obj) {
bss_event("remove", name);
}
},
sta_auth: function(iface, sta) {
let msg = { iface, sta };
let ret = {};
let data_cb = (type, data) => {
ret = { ...ret, ...data };
};
hostapd.data.auth_obj.notify("sta_auth", msg, data_cb, null, null, 1000);
return ret;
},
sta_connected: function(iface, sta, data) {
let msg = { iface, sta, ...data };
let ret = {};
let data_cb = (type, data) => {
ret = { ...ret, ...data };
};
hostapd.data.auth_obj.notify("sta_connected", msg, data_cb, null, null, 1000);
return ret;
},
};

View File

@@ -0,0 +1,335 @@
#!/usr/bin/env ucode
'use strict';
import * as uloop from 'uloop';
import * as libubus from 'ubus';
uloop.init();
let ubus = libubus.connect();
let interfaces = {};
let ssids = {};
let cache = {};
let sub_6g = [];
let sub_6g_obj;
let reload_timer;
let gc_timer;
let timeout = 48 * 60 * 60;
function event_cb_6g(req) {
//printf('6g %s %.J\n', req.data, req.type);
if (req.type != 'auth' && req.type != 'probe')
return 0;
let addr = req.data.address;
let iface = interfaces[req.data.ifname];
if (!iface)
return 0;
let ssid = iface.ssid;
if (!ssid || !length(ssids[ssid].keys))
return 0;
let ssid_cache = cache[ssid];
if (ssid_cache && ssid_cache[addr])
return 0;
if (req.type == 'probe') {
printf(`Ignore probe ${req.type} on ${req.data.ifname} from ${addr}\n`);
return 1;
}
printf(`reject ${req.type} on ${req.data.ifname} from ${addr}\n`);
return 5;
}
function event_cb(req) {
//printf('normal %s %.J\n', req.data, req.type);
if (req.type != 'probe')
return 0;
let addr = req.data.address;
let iface = interfaces[req.data.ifname];
if (!iface)
return 0;
let ssid = iface.ssid;
if (!ssid || !length(ssids[ssid].keys))
return 0;
let ssid_cache = cache[ssid];
if (ssid_cache && ssid_cache[addr])
return 0;
printf(`reply to ${req.type} on ${req.data.ifname} from ${addr} without 6G RNR\n`);
return 2;
}
function create_6g_subscriber() {
for (let cur_sub in sub_6g)
cur_sub.remove();
sub_6g = [];
for (let ifname, iface in interfaces) {
let obj = 'hostapd.' + ifname;
let cur_sub;
if (iface.band == '6g')
cur_sub = ubus.subscriber((req) => event_cb_6g(req));
else
cur_sub = ubus.subscriber((req) => event_cb(req));
cur_sub.subscribe(obj);
push(sub_6g, cur_sub);
printf(`subscribe ${ifname}\n`);
ubus.call(obj, 'notify_response', { notify_response: 1 });
}
}
function cache_gc() {
let ts = time();
for (let ssid in keys(cache)) {
if (!ssids[ssid]) {
delete cache[ssid];
continue;
}
let ssid_cache = cache[ssid];
ssid = ssids[ssid];
for (let addr in keys(ssid_cache)) {
let sta = ssid_cache[addr];
let keep = ts < cache.timeout;
if (keep && !ssid.keys[sta.key])
keep = false;
if (keep)
sta.keydata = ssid.keys[sta.key];
if (!keep)
delete cache[addr];
}
}
}
function netifd_reload() {
let data = ubus.call('network.wireless', 'status');
ssids = {};
interfaces = {};
for (let radio_name, radio in data) {
if (!radio.up)
continue;
for (let iface in radio.interfaces) {
let config = iface.config;
if (config.mode != 'ap' || !iface.ifname)
continue;
let band = radio.config.band;
let nr_data = ubus.call('hostapd.' + iface.ifname, 'rrm_nr_get_own');
let nr;
if (nr_data && nr_data.value && nr_data.value[2])
nr = nr_data.value[2];
interfaces[iface.ifname] = {
band, nr,
ssid: config.ssid,
};
ssids[config.ssid] ??= {
interfaces: [],
keys: {},
bands: {},
};
let ssid = ssids[config.ssid];
push(ssid.interfaces, iface.ifname);
ssid.bands[band] = iface.ifname;
for (let sta in iface.stations) {
let stacfg = sta.config;
let key = stacfg.key;
if (!key)
continue;
let keydata = {};
let vid = stacfg.vid;
if (vid)
keydata.vlan = +vid;
let mac = stacfg.mac;
if (mac)
keydata.mac = mac;
ssid.keys[key] = keydata;
}
}
}
printf('New config: %.J\n', { ssids, interfaces });
cache_gc();
create_6g_subscriber();
}
function iface_ssid(ifname) {
let iface = interfaces[ifname];
if (!iface)
return;
return iface.ssid;
}
function sta_cache_entry_get(ssid, addr) {
let ssid_cache = cache[ssid] ?? {};
let entry = ssid_cache[addr];
if (entry)
entry.timeout = time() + timeout;
printf(`Get cache entry ssid=${ssid} addr=${addr}: ${entry}\n`);
return entry;
}
function sta_cache_entry_add(ssid, addr, key) {
cache[ssid] ??= {};
let ssid_cache = cache[ssid];
let ssid_data = ssids[ssid];
let keydata = ssid_data.keys[key];
let cache_data = {
timeout: time() + timeout,
ssid, key,
data: keydata ?? {},
};
ssid_cache[addr] = cache_data;
printf(`Added cache entry ssid=${ssid} addr=${addr}\n`);
return cache_data;
}
function ssid_psk(ssid, addr) {
ssid = ssids[ssid];
if (!ssid)
return [];
let specific = [];
let rest = [];
for (let k, v in ssid.keys)
if (v.mac == addr)
push(specific, k);
else if (!v.mac)
push(rest, k);
if (length(specific))
return specific;
return rest;
}
function sta_auth_psk(ifname, addr) {
let ssid = iface_ssid(ifname);
if (!ssid)
return;
let cache = sta_cache_entry_get(ssid, addr);
if (cache)
return [ cache.key ];
return ssid_psk(ssid, addr);
}
function sta_auth_cache(ifname, addr, idx, phrase) {
let ssid = iface_ssid(ifname);
if (!ssid)
return;
let cache = sta_cache_entry_get(ssid, addr);
if (cache)
return cache.data;
let psk = ssid_psk(ssid, addr);
if (!psk)
return;
psk = psk[idx];
if (!psk)
psk = phrase;
if (!psk)
return;
cache = sta_cache_entry_add(ssid, addr, psk);
if (!cache)
return;
let ssid_data = ssids[ssid];
if (!ssid_data)
return cache.data;
let target_ifname = ssid_data.bands['6g'];
if (!target_ifname)
return cache.data;
let target_iface = interfaces[target_ifname];
if (!target_iface)
return cache.data;
cache.timer = uloop.timer(30 * 1000, () => {
let msg = {
addr,
disassociation_imminent: false,
neighbors: [
target_iface.nr
],
abridged: false,
};
printf(`ubus call hostapd.${ifname} bss_transition_request '${msg}'\n`);
ubus.call('hostapd.' + ifname, 'bss_transition_request', msg);
delete cache.timer;
});
return cache.data;
}
function auth_cb(msg) {
let data = msg.data;
printf(`Event ${msg.type}: ${msg.data}\n`);
switch (msg.type) {
case 'sta_auth':
return {
psk: sta_auth_psk(data.iface, data.sta),
force_psk: true,
};
case 'sta_connected':
if (data.psk_idx == null)
return;
return sta_auth_cache(data.iface, data.sta, data.psk_idx, data.psk);
case 'reload':
netifd_reload();
reload_timer.set(5000);
break;
}
}
let ubus_methods = {
state: {
call: function(req) {
return {
interfaces,
ssids,
cache
};
},
args: {
}
},
};
reload_timer = uloop.timer(-1, () => { netifd_reload(); });
gc_timer = uloop.timer(1000, () => { gc_timer.set(30 * 1000); cache_gc(); });
ubus.publish('mpsk', ubus_methods);
let sub = ubus.subscriber(auth_cb);
let listener = ubus.listener('ubus.object.add', (event, msg) => {
if (msg.path == 'hostapd-auth')
sub.subscribe(msg.path);
});
sub.subscribe('hostapd-auth');
netifd_reload();
uloop.run();

View File

@@ -0,0 +1,13 @@
#!/bin/sh /etc/rc.common
START=19
USE_PROCD=1
NAME=mpskd
start_service() {
procd_open_instance mpskd
procd_set_param command /usr/share/hostap/mpskd
procd_set_param respawn
procd_close_instance
}

View File

@@ -14,6 +14,6 @@
"methods": [ "request" ]
}
},
"publish": [ "hostapd", "hostapd.*", "wpa_supplicant", "wpa_supplicant.*" ],
"publish": [ "hostapd", "hostapd.*", "wpa_supplicant", "wpa_supplicant.*", "hostapd-auth" ],
"send": [ "bss.*", "wps_credentials" ]
}

View File

@@ -88,6 +88,14 @@
void hostapd_new_assoc_sta(struct hostapd_data *hapd, struct sta_info *sta,
int reassoc);
void hostapd_interface_deinit_free(struct hostapd_iface *iface);
@@ -662,6 +671,7 @@ hostapd_switch_channel_fallback(struct h
void hostapd_cleanup_cs_params(struct hostapd_data *hapd);
void hostapd_periodic_iface(struct hostapd_iface *iface);
int hostapd_owe_trans_get_info(struct hostapd_data *hapd);
+void hostapd_owe_update_trans(struct hostapd_iface *iface);
void hostapd_ocv_check_csa_sa_query(void *eloop_ctx, void *timeout_ctx);
/* utils.c */
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
@@ -216,6 +216,8 @@ int hostapd_reload_config(struct hostapd
@@ -132,6 +140,15 @@
return 0;
}
@@ -1945,7 +1950,7 @@ static int hostapd_owe_iface_iter2(struc
#endif /* CONFIG_OWE */
-static void hostapd_owe_update_trans(struct hostapd_iface *iface)
+void hostapd_owe_update_trans(struct hostapd_iface *iface)
{
#ifdef CONFIG_OWE
/* Check whether the enabled BSS can complete OWE transition mode
@@ -2090,7 +2095,7 @@ static int hostapd_setup_interface_compl
hapd = iface->bss[j];
if (j)
@@ -568,3 +585,146 @@
.send_mlme = driver_nl80211_send_mlme,
.get_hw_feature_data = nl80211_get_hw_feature_data,
.sta_add = wpa_driver_nl80211_sta_add,
--- a/src/ap/ieee802_11.c
+++ b/src/ap/ieee802_11.c
@@ -494,11 +494,17 @@ static const char * sae_get_password(str
struct sae_pt **s_pt,
const struct sae_pk **s_pk)
{
+ struct hostapd_bss_config *conf = hapd->conf;
+ struct hostapd_ssid *ssid = &conf->ssid;
+ struct hostapd_sta_wpa_psk_short *psk;
const char *password = NULL;
- struct sae_password_entry *pw;
+ struct sae_password_entry *pw = NULL;
struct sae_pt *pt = NULL;
const struct sae_pk *pk = NULL;
+ if (sta && sta->use_sta_psk)
+ goto use_sta_psk;
+
for (pw = hapd->conf->sae_passwords; pw; pw = pw->next) {
if (!is_broadcast_ether_addr(pw->peer_addr) &&
os_memcmp(pw->peer_addr, sta->addr, ETH_ALEN) != 0)
@@ -519,6 +525,31 @@ static const char * sae_get_password(str
pt = hapd->conf->ssid.pt;
}
+use_sta_psk:
+ if (!password && sta) {
+ for (psk = sta->psk; psk; psk = psk->next) {
+ if (!psk->is_passphrase)
+ continue;
+
+ password = psk->passphrase;
+ if (!sta->use_sta_psk)
+ break;
+
+ if (sta->sae_pt) {
+ pt = sta->sae_pt;
+ break;
+ }
+
+ pt = sae_derive_pt(conf->sae_groups, ssid->ssid,
+ ssid->ssid_len,
+ (const u8 *) password,
+ os_strlen(password),
+ NULL);
+ sta->sae_pt = pt;
+ break;
+ }
+ }
+
if (pw_entry)
*pw_entry = pw;
if (s_pt)
@@ -3698,6 +3729,12 @@ static void handle_auth(struct hostapd_d
goto fail;
}
+ res = hostapd_ucode_sta_auth(hapd, sta);
+ if (res) {
+ resp = res;
+ goto fail;
+ }
+
sta->flags &= ~WLAN_STA_PREAUTH;
ieee802_1x_notify_pre_auth(sta->eapol_sm, 0);
--- a/src/ap/sta_info.c
+++ b/src/ap/sta_info.c
@@ -412,6 +412,9 @@ void ap_free_sta(struct hostapd_data *ha
os_free(sta->sae_postponed_commit);
#endif /* CONFIG_TESTING_OPTIONS */
+ if (sta->sae_pt)
+ sae_deinit_pt(sta->sae_pt);
+
os_free(sta);
}
@@ -1280,6 +1283,8 @@ void ap_sta_set_authorized(struct hostap
else
sta->flags &= ~WLAN_STA_AUTHORIZED;
+ if (authorized)
+ hostapd_ucode_sta_connected(hapd, sta);
#ifdef CONFIG_P2P
if (hapd->p2p_group == NULL) {
if (sta->p2p_ie != NULL &&
--- a/src/ap/sta_info.h
+++ b/src/ap/sta_info.h
@@ -201,6 +201,9 @@ struct sta_info {
int vlan_id_bound; /* updated by ap_sta_bind_vlan() */
/* PSKs from RADIUS authentication server */
struct hostapd_sta_wpa_psk_short *psk;
+ struct sae_pt *sae_pt;
+ int use_sta_psk;
+ int psk_idx;
char *identity; /* User-Name from RADIUS */
char *radius_cui; /* Chargeable-User-Identity from RADIUS */
--- a/src/ap/wpa_auth_glue.c
+++ b/src/ap/wpa_auth_glue.c
@@ -337,6 +337,7 @@ static const u8 * hostapd_wpa_auth_get_p
struct sta_info *sta = ap_get_sta(hapd, addr);
const u8 *psk;
+ sta->psk_idx = 0;
if (vlan_id)
*vlan_id = 0;
if (psk_len)
@@ -381,13 +382,18 @@ static const u8 * hostapd_wpa_auth_get_p
* returned psk which should not be returned again.
* logic list (all hostapd_get_psk; all sta->psk)
*/
+ if (sta && sta->use_sta_psk)
+ psk = NULL;
if (sta && sta->psk && !psk) {
struct hostapd_sta_wpa_psk_short *pos;
+ int psk_idx;
if (vlan_id)
*vlan_id = 0;
psk = sta->psk->psk;
+ sta->psk_idx = psk_idx = 1;
for (pos = sta->psk; pos; pos = pos->next) {
+ psk_idx++;
if (pos->is_passphrase) {
pbkdf2_sha1(pos->passphrase,
hapd->conf->ssid.ssid,
@@ -396,10 +402,14 @@ static const u8 * hostapd_wpa_auth_get_p
pos->is_passphrase = 0;
}
if (pos->psk == prev_psk) {
+ sta->psk_idx = psk_idx;
psk = pos->next ? pos->next->psk : NULL;
break;
}
}
+
+ if (!psk)
+ sta->psk_idx = 0;
}
return psk;
}

View File

@@ -1,7 +1,5 @@
Index: hostapd-2021-02-20-59e9794c/src/ap/wpa_auth.h
===================================================================
--- hostapd-2021-02-20-59e9794c.orig/src/ap/wpa_auth.h
+++ hostapd-2021-02-20-59e9794c/src/ap/wpa_auth.h
--- a/src/ap/wpa_auth.h
+++ b/src/ap/wpa_auth.h
@@ -15,6 +15,10 @@
#include "common/ieee802_11_defs.h"
@@ -41,11 +39,9 @@ Index: hostapd-2021-02-20-59e9794c/src/ap/wpa_auth.h
#endif /* CONFIG_IEEE80211R_AP */
Index: hostapd-2021-02-20-59e9794c/src/ap/wpa_auth_glue.c
===================================================================
--- hostapd-2021-02-20-59e9794c.orig/src/ap/wpa_auth_glue.c
+++ hostapd-2021-02-20-59e9794c/src/ap/wpa_auth_glue.c
@@ -1153,6 +1153,40 @@ static int hostapd_wpa_auth_get_vlan(voi
--- a/src/ap/wpa_auth_glue.c
+++ b/src/ap/wpa_auth_glue.c
@@ -1172,6 +1172,40 @@ static int hostapd_wpa_auth_get_vlan(voi
}
@@ -86,7 +82,7 @@ Index: hostapd-2021-02-20-59e9794c/src/ap/wpa_auth_glue.c
static int
hostapd_wpa_auth_set_identity(void *ctx, const u8 *sta_addr,
const u8 *identity, size_t identity_len)
@@ -1471,6 +1505,8 @@ int hostapd_setup_wpa(struct hostapd_dat
@@ -1490,6 +1524,8 @@ int hostapd_setup_wpa(struct hostapd_dat
.add_tspec = hostapd_wpa_auth_add_tspec,
.set_vlan = hostapd_wpa_auth_set_vlan,
.get_vlan = hostapd_wpa_auth_get_vlan,
@@ -95,11 +91,9 @@ Index: hostapd-2021-02-20-59e9794c/src/ap/wpa_auth_glue.c
.set_identity = hostapd_wpa_auth_set_identity,
.get_identity = hostapd_wpa_auth_get_identity,
.set_radius_cui = hostapd_wpa_auth_set_radius_cui,
Index: hostapd-2021-02-20-59e9794c/src/ap/ieee802_11.c
===================================================================
--- hostapd-2021-02-20-59e9794c.orig/src/ap/ieee802_11.c
+++ hostapd-2021-02-20-59e9794c/src/ap/ieee802_11.c
@@ -3240,7 +3240,7 @@ static void handle_auth_pasn_1(struct ho
--- a/src/ap/ieee802_11.c
+++ b/src/ap/ieee802_11.c
@@ -3215,7 +3215,7 @@ static void handle_auth_pasn_1(struct ho
rsn_data.pmkid,
pmk_r1, &pmk_r1_len, NULL,
NULL, NULL, NULL,
@@ -108,26 +102,24 @@ Index: hostapd-2021-02-20-59e9794c/src/ap/ieee802_11.c
if (ret) {
wpa_printf(MSG_DEBUG,
"PASN: FT: Failed getting PMK-R1");
Index: hostapd-2021-02-20-59e9794c/src/ap/wpa_auth_ft.c
===================================================================
--- hostapd-2021-02-20-59e9794c.orig/src/ap/wpa_auth_ft.c
+++ hostapd-2021-02-20-59e9794c/src/ap/wpa_auth_ft.c
--- a/src/ap/wpa_auth_ft.c
+++ b/src/ap/wpa_auth_ft.c
@@ -375,6 +375,14 @@ static size_t wpa_ft_vlan_len(const stru
return tlv_len;
}
+static size_t wpa_ft_rate_limit_len(const struct rate_description *rate)
+{
+ if (!rate)
+ if (!rate || (!rate->rx && !rate->tx))
+ return 0;
+
+ return (sizeof(*rate));
+ return (sizeof(struct ft_rrb_tlv) + 8);
+}
+
static size_t wpa_ft_vlan_lin(const struct vlan_description *vlan,
u8 *start, u8 *endpos)
@@ -430,10 +438,47 @@ static size_t wpa_ft_vlan_lin(const stru
@@ -430,10 +438,48 @@ static size_t wpa_ft_vlan_lin(const stru
}
@@ -149,13 +141,14 @@ Index: hostapd-2021-02-20-59e9794c/src/ap/wpa_auth_ft.c
+ return tlv_len;
+ hdr = (struct ft_rrb_tlv *) pos;
+ hdr->type = host_to_le16(FT_RRB_RATE_LIMIT);
+ hdr->len = host_to_le16(sizeof(le16));
+ hdr->len = host_to_le16(2 * sizeof(le32));
+ pos = start + tlv_len;
+
+ tlv_len += sizeof(u32);
+ if (start + tlv_len > endpos)
+ return tlv_len;
+ WPA_PUT_LE32(pos, rate->rx);
+ pos = start + tlv_len;
+ tlv_len += sizeof(u32);
+ if (start + tlv_len > endpos)
+ return tlv_len;
@@ -176,7 +169,7 @@ Index: hostapd-2021-02-20-59e9794c/src/ap/wpa_auth_ft.c
{
u8 *pos, *endpos;
size_t tlv_len;
@@ -441,6 +486,7 @@ static int wpa_ft_rrb_lin(const struct t
@@ -441,6 +487,7 @@ static int wpa_ft_rrb_lin(const struct t
tlv_len = wpa_ft_tlv_len(tlvs1);
tlv_len += wpa_ft_tlv_len(tlvs2);
tlv_len += wpa_ft_vlan_len(vlan);
@@ -184,7 +177,7 @@ Index: hostapd-2021-02-20-59e9794c/src/ap/wpa_auth_ft.c
*plain_len = tlv_len;
*plain = os_zalloc(tlv_len);
@@ -454,6 +500,7 @@ static int wpa_ft_rrb_lin(const struct t
@@ -454,6 +501,7 @@ static int wpa_ft_rrb_lin(const struct t
pos += wpa_ft_tlv_lin(tlvs1, pos, endpos);
pos += wpa_ft_tlv_lin(tlvs2, pos, endpos);
pos += wpa_ft_vlan_lin(vlan, pos, endpos);
@@ -192,7 +185,7 @@ Index: hostapd-2021-02-20-59e9794c/src/ap/wpa_auth_ft.c
/* sanity check */
if (pos != endpos) {
@@ -522,7 +569,8 @@ static int wpa_ft_rrb_build(const u8 *ke
@@ -522,7 +570,8 @@ static int wpa_ft_rrb_build(const u8 *ke
const struct tlv_list *tlvs_auth,
const struct vlan_description *vlan,
const u8 *src_addr, u8 type,
@@ -202,7 +195,7 @@ Index: hostapd-2021-02-20-59e9794c/src/ap/wpa_auth_ft.c
{
u8 *plain = NULL, *auth = NULL, *pos, *tmp;
size_t plain_len = 0, auth_len = 0;
@@ -530,10 +578,10 @@ static int wpa_ft_rrb_build(const u8 *ke
@@ -530,10 +579,10 @@ static int wpa_ft_rrb_build(const u8 *ke
size_t pad_len = 0;
*packet = NULL;
@@ -215,7 +208,7 @@ Index: hostapd-2021-02-20-59e9794c/src/ap/wpa_auth_ft.c
goto out;
*packet_len = sizeof(u16) + auth_len + plain_len;
@@ -696,6 +744,24 @@ static int wpa_ft_get_vlan(struct wpa_au
@@ -696,6 +745,24 @@ static int wpa_ft_get_vlan(struct wpa_au
}
@@ -240,7 +233,7 @@ Index: hostapd-2021-02-20-59e9794c/src/ap/wpa_auth_ft.c
static int
wpa_ft_set_identity(struct wpa_authenticator *wpa_auth, const u8 *sta_addr,
const u8 *identity, size_t identity_len)
@@ -991,7 +1057,7 @@ wpa_ft_rrb_seq_req(struct wpa_authentica
@@ -991,7 +1058,7 @@ wpa_ft_rrb_seq_req(struct wpa_authentica
if (wpa_ft_rrb_build(key, key_len, NULL, NULL, seq_req_auth, NULL,
wpa_auth->addr, FT_PACKET_R0KH_R1KH_SEQ_REQ,
@@ -249,7 +242,7 @@ Index: hostapd-2021-02-20-59e9794c/src/ap/wpa_auth_ft.c
item = NULL; /* some other seq resp might still accept this */
goto err;
}
@@ -1174,6 +1240,7 @@ struct wpa_ft_pmk_r0_sa {
@@ -1174,6 +1241,7 @@ struct wpa_ft_pmk_r0_sa {
u8 spa[ETH_ALEN];
int pairwise; /* Pairwise cipher suite, WPA_CIPHER_* */
struct vlan_description *vlan;
@@ -257,7 +250,7 @@ Index: hostapd-2021-02-20-59e9794c/src/ap/wpa_auth_ft.c
os_time_t expiration; /* 0 for no expiration */
u8 *identity;
size_t identity_len;
@@ -1192,6 +1259,7 @@ struct wpa_ft_pmk_r1_sa {
@@ -1192,6 +1260,7 @@ struct wpa_ft_pmk_r1_sa {
u8 spa[ETH_ALEN];
int pairwise; /* Pairwise cipher suite, WPA_CIPHER_* */
struct vlan_description *vlan;
@@ -265,7 +258,7 @@ Index: hostapd-2021-02-20-59e9794c/src/ap/wpa_auth_ft.c
u8 *identity;
size_t identity_len;
u8 *radius_cui;
@@ -1220,6 +1288,7 @@ static void wpa_ft_free_pmk_r0(struct wp
@@ -1220,6 +1289,7 @@ static void wpa_ft_free_pmk_r0(struct wp
os_memset(r0->pmk_r0, 0, PMK_LEN_MAX);
os_free(r0->vlan);
@@ -273,7 +266,7 @@ Index: hostapd-2021-02-20-59e9794c/src/ap/wpa_auth_ft.c
os_free(r0->identity);
os_free(r0->radius_cui);
os_free(r0);
@@ -1273,6 +1342,7 @@ static void wpa_ft_free_pmk_r1(struct wp
@@ -1273,6 +1343,7 @@ static void wpa_ft_free_pmk_r1(struct wp
eloop_cancel_timeout(wpa_ft_expire_pmk_r1, r1, NULL);
os_memset(r1->pmk_r1, 0, PMK_LEN_MAX);
@@ -281,7 +274,7 @@ Index: hostapd-2021-02-20-59e9794c/src/ap/wpa_auth_ft.c
os_free(r1->vlan);
os_free(r1->identity);
os_free(r1->radius_cui);
@@ -1326,7 +1396,8 @@ static int wpa_ft_store_pmk_r0(struct wp
@@ -1326,7 +1397,8 @@ static int wpa_ft_store_pmk_r0(struct wp
const struct vlan_description *vlan,
int expires_in, int session_timeout,
const u8 *identity, size_t identity_len,
@@ -291,7 +284,7 @@ Index: hostapd-2021-02-20-59e9794c/src/ap/wpa_auth_ft.c
{
struct wpa_ft_pmk_cache *cache = wpa_auth->ft_pmk_cache;
struct wpa_ft_pmk_r0_sa *r0;
@@ -1354,6 +1425,14 @@ static int wpa_ft_store_pmk_r0(struct wp
@@ -1354,6 +1426,14 @@ static int wpa_ft_store_pmk_r0(struct wp
}
*r0->vlan = *vlan;
}
@@ -306,7 +299,7 @@ Index: hostapd-2021-02-20-59e9794c/src/ap/wpa_auth_ft.c
if (identity) {
r0->identity = os_malloc(identity_len);
if (r0->identity) {
@@ -1413,7 +1492,8 @@ static int wpa_ft_store_pmk_r1(struct wp
@@ -1413,7 +1493,8 @@ static int wpa_ft_store_pmk_r1(struct wp
const struct vlan_description *vlan,
int expires_in, int session_timeout,
const u8 *identity, size_t identity_len,
@@ -316,7 +309,7 @@ Index: hostapd-2021-02-20-59e9794c/src/ap/wpa_auth_ft.c
{
struct wpa_ft_pmk_cache *cache = wpa_auth->ft_pmk_cache;
int max_expires_in = wpa_auth->conf.r1_max_key_lifetime;
@@ -1443,6 +1523,14 @@ static int wpa_ft_store_pmk_r1(struct wp
@@ -1443,6 +1524,14 @@ static int wpa_ft_store_pmk_r1(struct wp
}
*r1->vlan = *vlan;
}
@@ -331,7 +324,7 @@ Index: hostapd-2021-02-20-59e9794c/src/ap/wpa_auth_ft.c
if (identity) {
r1->identity = os_malloc(identity_len);
if (r1->identity) {
@@ -1479,7 +1567,7 @@ int wpa_ft_fetch_pmk_r1(struct wpa_authe
@@ -1479,7 +1568,7 @@ int wpa_ft_fetch_pmk_r1(struct wpa_authe
struct vlan_description *vlan,
const u8 **identity, size_t *identity_len,
const u8 **radius_cui, size_t *radius_cui_len,
@@ -340,7 +333,7 @@ Index: hostapd-2021-02-20-59e9794c/src/ap/wpa_auth_ft.c
{
struct wpa_ft_pmk_cache *cache = wpa_auth->ft_pmk_cache;
struct wpa_ft_pmk_r1_sa *r1;
@@ -1499,6 +1587,12 @@ int wpa_ft_fetch_pmk_r1(struct wpa_authe
@@ -1499,6 +1588,12 @@ int wpa_ft_fetch_pmk_r1(struct wpa_authe
*vlan = *r1->vlan;
if (vlan && !r1->vlan)
os_memset(vlan, 0, sizeof(*vlan));
@@ -353,7 +346,7 @@ Index: hostapd-2021-02-20-59e9794c/src/ap/wpa_auth_ft.c
if (identity && identity_len) {
*identity = r1->identity;
*identity_len = r1->identity_len;
@@ -2025,7 +2119,7 @@ static int wpa_ft_pull_pmk_r1(struct wpa
@@ -2025,7 +2120,7 @@ static int wpa_ft_pull_pmk_r1(struct wpa
if (wpa_ft_rrb_build(key, key_len, req_enc, NULL, req_auth, NULL,
sm->wpa_auth->addr, FT_PACKET_R0KH_R1KH_PULL,
@@ -362,7 +355,7 @@ Index: hostapd-2021-02-20-59e9794c/src/ap/wpa_auth_ft.c
return -1;
ft_pending_req_ies = wpabuf_alloc_copy(ies, ies_len);
@@ -2054,6 +2148,7 @@ int wpa_ft_store_pmk_fils(struct wpa_sta
@@ -2054,6 +2149,7 @@ int wpa_ft_store_pmk_fils(struct wpa_sta
{
int expires_in = sm->wpa_auth->conf.r0_key_lifetime;
struct vlan_description vlan;
@@ -370,7 +363,7 @@ Index: hostapd-2021-02-20-59e9794c/src/ap/wpa_auth_ft.c
const u8 *identity, *radius_cui;
size_t identity_len, radius_cui_len;
int session_timeout;
@@ -2065,6 +2160,7 @@ int wpa_ft_store_pmk_fils(struct wpa_sta
@@ -2065,6 +2161,7 @@ int wpa_ft_store_pmk_fils(struct wpa_sta
MAC2STR(sm->addr));
return -1;
}
@@ -378,7 +371,7 @@ Index: hostapd-2021-02-20-59e9794c/src/ap/wpa_auth_ft.c
identity_len = wpa_ft_get_identity(sm->wpa_auth, sm->addr, &identity);
radius_cui_len = wpa_ft_get_radius_cui(sm->wpa_auth, sm->addr,
@@ -2074,7 +2170,7 @@ int wpa_ft_store_pmk_fils(struct wpa_sta
@@ -2074,7 +2171,7 @@ int wpa_ft_store_pmk_fils(struct wpa_sta
return wpa_ft_store_pmk_r0(sm->wpa_auth, sm->addr, pmk_r0, pmk_r0_len,
pmk_r0_name, sm->pairwise, &vlan, expires_in,
session_timeout, identity, identity_len,
@@ -387,7 +380,7 @@ Index: hostapd-2021-02-20-59e9794c/src/ap/wpa_auth_ft.c
}
@@ -2095,6 +2191,7 @@ int wpa_auth_derive_ptk_ft(struct wpa_st
@@ -2095,6 +2192,7 @@ int wpa_auth_derive_ptk_ft(struct wpa_st
int psk_local = sm->wpa_auth->conf.ft_psk_generate_local;
int expires_in = sm->wpa_auth->conf.r0_key_lifetime;
struct vlan_description vlan;
@@ -395,7 +388,7 @@ Index: hostapd-2021-02-20-59e9794c/src/ap/wpa_auth_ft.c
const u8 *identity, *radius_cui;
size_t identity_len, radius_cui_len;
int session_timeout;
@@ -2119,6 +2216,8 @@ int wpa_auth_derive_ptk_ft(struct wpa_st
@@ -2119,6 +2217,8 @@ int wpa_auth_derive_ptk_ft(struct wpa_st
return -1;
}
@@ -404,7 +397,7 @@ Index: hostapd-2021-02-20-59e9794c/src/ap/wpa_auth_ft.c
identity_len = wpa_ft_get_identity(sm->wpa_auth, sm->addr, &identity);
radius_cui_len = wpa_ft_get_radius_cui(sm->wpa_auth, sm->addr,
&radius_cui);
@@ -2134,7 +2233,7 @@ int wpa_auth_derive_ptk_ft(struct wpa_st
@@ -2134,7 +2234,7 @@ int wpa_auth_derive_ptk_ft(struct wpa_st
pmk_r0_name,
sm->pairwise, &vlan, expires_in,
session_timeout, identity, identity_len,
@@ -413,7 +406,7 @@ Index: hostapd-2021-02-20-59e9794c/src/ap/wpa_auth_ft.c
if (wpa_derive_pmk_r1(pmk_r0, pmk_r0_len, pmk_r0_name, r1kh, sm->addr,
pmk_r1, sm->pmk_r1_name) < 0)
@@ -2143,7 +2242,8 @@ int wpa_auth_derive_ptk_ft(struct wpa_st
@@ -2143,7 +2243,8 @@ int wpa_auth_derive_ptk_ft(struct wpa_st
wpa_ft_store_pmk_r1(sm->wpa_auth, sm->addr, pmk_r1, pmk_r1_len,
sm->pmk_r1_name, sm->pairwise, &vlan,
expires_in, session_timeout, identity,
@@ -423,7 +416,7 @@ Index: hostapd-2021-02-20-59e9794c/src/ap/wpa_auth_ft.c
return wpa_pmk_r1_to_ptk(pmk_r1, pmk_r1_len, sm->SNonce, sm->ANonce,
sm->addr, sm->wpa_auth->addr, sm->pmk_r1_name,
@@ -2986,7 +3086,8 @@ static int wpa_ft_local_derive_pmk_r1(st
@@ -2986,7 +3087,8 @@ static int wpa_ft_local_derive_pmk_r1(st
const u8 **identity, size_t *identity_len,
const u8 **radius_cui,
size_t *radius_cui_len,
@@ -433,7 +426,7 @@ Index: hostapd-2021-02-20-59e9794c/src/ap/wpa_auth_ft.c
{
struct wpa_auth_config *conf = &wpa_auth->conf;
const struct wpa_ft_pmk_r0_sa *r0;
@@ -3023,7 +3124,8 @@ static int wpa_ft_local_derive_pmk_r1(st
@@ -3023,7 +3125,8 @@ static int wpa_ft_local_derive_pmk_r1(st
pmk_r1_name,
sm->pairwise, r0->vlan, expires_in, session_timeout,
r0->identity, r0->identity_len,
@@ -443,7 +436,7 @@ Index: hostapd-2021-02-20-59e9794c/src/ap/wpa_auth_ft.c
*out_pairwise = sm->pairwise;
if (vlan) {
@@ -3033,6 +3135,13 @@ static int wpa_ft_local_derive_pmk_r1(st
@@ -3033,6 +3136,13 @@ static int wpa_ft_local_derive_pmk_r1(st
os_memset(vlan, 0, sizeof(*vlan));
}
@@ -457,15 +450,15 @@ Index: hostapd-2021-02-20-59e9794c/src/ap/wpa_auth_ft.c
if (identity && identity_len) {
*identity = r0->identity;
*identity_len = r0->identity_len;
@@ -3063,6 +3172,7 @@ static int wpa_ft_process_auth_req(struc
@@ -3063,6 +3173,7 @@ static int wpa_ft_process_auth_req(struc
u8 *pos, *end;
int pairwise, session_timeout = 0;
struct vlan_description vlan;
+ struct rate_description rate;
+ struct rate_description rate = {};
const u8 *identity, *radius_cui;
size_t identity_len = 0, radius_cui_len = 0;
int use_sha384;
@@ -3153,7 +3263,7 @@ static int wpa_ft_process_auth_req(struc
@@ -3152,7 +3263,7 @@ static int wpa_ft_process_auth_req(struc
} else if (wpa_ft_fetch_pmk_r1(sm->wpa_auth, sm->addr, pmk_r1_name,
pmk_r1, &pmk_r1_len, &pairwise, &vlan,
&identity, &identity_len, &radius_cui,
@@ -474,7 +467,7 @@ Index: hostapd-2021-02-20-59e9794c/src/ap/wpa_auth_ft.c
wpa_printf(MSG_DEBUG,
"FT: No PMK-R1 available in local cache for the requested PMKR1Name");
if (wpa_ft_local_derive_pmk_r1(sm->wpa_auth, sm,
@@ -3162,7 +3272,7 @@ static int wpa_ft_process_auth_req(struc
@@ -3161,7 +3272,7 @@ static int wpa_ft_process_auth_req(struc
pmk_r1_name, pmk_r1, &pairwise,
&vlan, &identity, &identity_len,
&radius_cui, &radius_cui_len,
@@ -483,7 +476,7 @@ Index: hostapd-2021-02-20-59e9794c/src/ap/wpa_auth_ft.c
wpa_printf(MSG_DEBUG,
"FT: Generated PMK-R1 based on local PMK-R0");
goto pmk_r1_derived;
@@ -3229,6 +3339,7 @@ pmk_r1_derived:
@@ -3219,6 +3330,7 @@ pmk_r1_derived:
wpa_printf(MSG_DEBUG, "FT: Failed to configure VLAN");
return WLAN_STATUS_UNSPECIFIED_FAILURE;
}
@@ -491,7 +484,7 @@ Index: hostapd-2021-02-20-59e9794c/src/ap/wpa_auth_ft.c
if (wpa_ft_set_identity(sm->wpa_auth, sm->addr,
identity, identity_len) < 0 ||
wpa_ft_set_radius_cui(sm->wpa_auth, sm->addr,
@@ -3801,7 +3912,7 @@ static int wpa_ft_rrb_build_r0(const u8
@@ -3791,7 +3903,7 @@ static int wpa_ft_rrb_build_r0(const u8
ret = wpa_ft_rrb_build(key, key_len, tlvs, sess_tlv, tlv_auth,
pmk_r0->vlan, src_addr, type,
@@ -500,7 +493,7 @@ Index: hostapd-2021-02-20-59e9794c/src/ap/wpa_auth_ft.c
forced_memzero(pmk_r1, sizeof(pmk_r1));
@@ -3941,7 +4052,7 @@ static int wpa_ft_rrb_rx_pull(struct wpa
@@ -3931,7 +4043,7 @@ static int wpa_ft_rrb_rx_pull(struct wpa
ret = wpa_ft_rrb_build(key, key_len, resp, NULL, resp_auth,
NULL, wpa_auth->addr,
FT_PACKET_R0KH_R1KH_RESP,
@@ -509,7 +502,7 @@ Index: hostapd-2021-02-20-59e9794c/src/ap/wpa_auth_ft.c
} else {
ret = wpa_ft_rrb_build_r0(key, key_len, resp, r0, f_r1kh_id,
f_s1kh_id, resp_auth, wpa_auth->addr,
@@ -3993,11 +4104,15 @@ static int wpa_ft_rrb_rx_r1(struct wpa_a
@@ -3983,11 +4095,15 @@ static int wpa_ft_rrb_rx_r1(struct wpa_a
size_t f_expires_in_len;
size_t f_identity_len, f_radius_cui_len;
size_t f_session_timeout_len;
@@ -525,7 +518,7 @@ Index: hostapd-2021-02-20-59e9794c/src/ap/wpa_auth_ft.c
size_t pmk_r1_len;
RRB_GET_AUTH(FT_RRB_R0KH_ID, r0kh_id, msgtype, -1);
@@ -4106,6 +4221,13 @@ static int wpa_ft_rrb_rx_r1(struct wpa_a
@@ -4096,6 +4212,13 @@ static int wpa_ft_rrb_rx_r1(struct wpa_a
wpa_printf(MSG_DEBUG, "FT: vlan %d%s",
le_to_host16(vlan.untagged), vlan.tagged[0] ? "+" : "");
@@ -539,7 +532,7 @@ Index: hostapd-2021-02-20-59e9794c/src/ap/wpa_auth_ft.c
RRB_GET_OPTIONAL(FT_RRB_IDENTITY, identity, msgtype, -1);
if (f_identity)
wpa_hexdump_ascii(MSG_DEBUG, "FT: Identity", f_identity,
@@ -4128,7 +4250,7 @@ static int wpa_ft_rrb_rx_r1(struct wpa_a
@@ -4118,7 +4241,7 @@ static int wpa_ft_rrb_rx_r1(struct wpa_a
f_pmk_r1_name,
pairwise, &vlan, expires_in, session_timeout,
f_identity, f_identity_len, f_radius_cui,
@@ -548,7 +541,7 @@ Index: hostapd-2021-02-20-59e9794c/src/ap/wpa_auth_ft.c
goto out;
ret = 0;
@@ -4441,7 +4563,7 @@ static int wpa_ft_rrb_rx_seq_req(struct
@@ -4431,7 +4554,7 @@ static int wpa_ft_rrb_rx_seq_req(struct
if (wpa_ft_rrb_build(key, key_len, NULL, NULL, seq_resp_auth, NULL,
wpa_auth->addr, FT_PACKET_R0KH_R1KH_SEQ_RESP,

View File

@@ -0,0 +1,147 @@
--- a/src/ap/ieee802_11.c
+++ b/src/ap/ieee802_11.c
@@ -469,6 +469,7 @@ static void handle_auth_ft_finish(void *
hostapd_logger(hapd, dst, HOSTAPD_MODULE_IEEE80211,
HOSTAPD_LEVEL_DEBUG, "authentication OK (FT)");
+ hostapd_ubus_notify(hapd, "ft-finish", sta->addr);
sta->flags |= WLAN_STA_AUTH;
mlme_authenticate_indication(hapd, sta);
}
@@ -5435,6 +5436,8 @@ static void handle_assoc(struct hostapd_
}
sta = ap_get_sta(hapd, mgmt->sa);
+ if (sta && reassoc)
+ memcpy(sta->origin_ap, mgmt->u.reassoc_req.current_ap, 6);
#ifdef CONFIG_IEEE80211R_AP
if (sta && sta->auth_alg == WLAN_AUTH_FT &&
(sta->flags & WLAN_STA_AUTH) == 0) {
@@ -5588,6 +5591,7 @@ static void handle_assoc(struct hostapd_
.type = HOSTAPD_UBUS_ASSOC_REQ,
.mgmt_frame = mgmt,
.ssi_signal = rssi,
+ .reassoc = reassoc,
};
/* followed by SSID and Supported rates; and HT capabilities if 802.11n
@@ -6414,7 +6418,7 @@ static void handle_assoc_cb(struct hosta
* Open, static WEP, FT protocol, or FILS; no separate
* authorization step.
*/
- ap_sta_set_authorized(hapd, sta, 1);
+ _ap_sta_set_authorized(hapd, sta, 1, reassoc);
}
if (reassoc)
--- a/src/ap/ubus.c
+++ b/src/ap/ubus.c
@@ -1870,6 +1870,8 @@ int hostapd_ubus_handle_event(struct hos
if (req->ssi_signal)
blobmsg_add_u32(&b, "signal", req->ssi_signal);
blobmsg_add_u32(&b, "freq", hapd->iface->freq);
+ if (req->reassoc && req->mgmt_frame)
+ blobmsg_add_macaddr(&b, "origin", req->mgmt_frame->u.reassoc_req.current_ap);
if (req->elems) {
if(req->elems->ht_capabilities)
@@ -1940,6 +1942,7 @@ void hostapd_ubus_notify(struct hostapd_
blob_buf_init(&b, 0);
blobmsg_add_macaddr(&b, "address", addr);
blobmsg_add_string(&b, "ifname", hapd->conf->iface);
+ blobmsg_printf(&b, "target", MACSTR, MAC2STR(hapd->conf->bssid));
ubus_notify(ctx, &hapd->ubus.obj, type, b.head, -1);
}
@@ -1958,7 +1961,7 @@ void hostapd_ubus_notify_csa(struct host
}
-void hostapd_ubus_notify_authorized(struct hostapd_data *hapd, struct sta_info *sta)
+void hostapd_ubus_notify_authorized(struct hostapd_data *hapd, struct sta_info *sta, int reassoc)
{
if (!hapd->ubus.obj.has_subscribers)
return;
@@ -1975,6 +1978,9 @@ void hostapd_ubus_notify_authorized(stru
blobmsg_add_u32(&b, "", sta->bandwidth[1]);
blobmsg_close_array(&b, r);
}
+ if (reassoc)
+ blobmsg_add_macaddr(&b, "origin", sta->origin_ap);
+ blobmsg_printf(&b, "target", MACSTR, MAC2STR(hapd->conf->bssid));
ubus_notify(ctx, &hapd->ubus.obj, "sta-authorized", b.head, -1);
}
--- a/src/ap/ubus.h
+++ b/src/ap/ubus.h
@@ -22,6 +22,7 @@ struct hostapd_ubus_request {
const struct ieee802_11_elems *elems;
int ssi_signal; /* dBm */
const u8 *addr;
+ int reassoc;
};
struct hostapd_iface;
@@ -49,7 +50,7 @@ void hostapd_ubus_remove_vlan(struct hos
int hostapd_ubus_handle_event(struct hostapd_data *hapd, struct hostapd_ubus_request *req);
void hostapd_ubus_notify(struct hostapd_data *hapd, const char *type, const u8 *mac);
-void hostapd_ubus_notify_authorized(struct hostapd_data *hapd, struct sta_info *sta);
+void hostapd_ubus_notify_authorized(struct hostapd_data *hapd, struct sta_info *sta, int reassoc);
void hostapd_ubus_notify_beacon_report(struct hostapd_data *hapd,
const u8 *addr, u8 token, u8 rep_mode,
struct rrm_measurement_beacon_report *rep,
--- a/src/ap/sta_info.c
+++ b/src/ap/sta_info.c
@@ -1265,8 +1265,8 @@ const char * ap_sta_wpa_get_keyid(struct
}
-void ap_sta_set_authorized(struct hostapd_data *hapd, struct sta_info *sta,
- int authorized)
+void _ap_sta_set_authorized(struct hostapd_data *hapd, struct sta_info *sta,
+ int authorized, int reassoc)
{
const u8 *dev_addr = NULL;
char buf[100];
@@ -1346,7 +1346,7 @@ void ap_sta_set_authorized(struct hostap
" keyid=%s", keyid);
}
- hostapd_ubus_notify_authorized(hapd, sta);
+ hostapd_ubus_notify_authorized(hapd, sta, reassoc);
wpa_msg(hapd->msg_ctx, MSG_INFO, AP_STA_CONNECTED "%s%s%s%s",
buf, ip_addr, keyid_buf, alg_buf);
@@ -1375,6 +1375,11 @@ void ap_sta_set_authorized(struct hostap
}
#endif /* CONFIG_FST */
}
+void ap_sta_set_authorized(struct hostapd_data *hapd, struct sta_info *sta,
+ int authorized)
+{
+ _ap_sta_set_authorized(hapd, sta, authorized, 0);
+}
void ap_sta_disconnect(struct hostapd_data *hapd, struct sta_info *sta,
--- a/src/ap/sta_info.h
+++ b/src/ap/sta_info.h
@@ -106,6 +106,7 @@ struct sta_info {
struct sta_info *next; /* next entry in sta list */
struct sta_info *hnext; /* next entry in hash table list */
u8 addr[6];
+ u8 origin_ap[6];
be32 ipaddr;
struct dl_list ip6addr; /* list head for struct ip6addr */
u16 aid; /* STA's unique AID (1 .. 2007) or 0 if not yet assigned */
@@ -392,6 +393,9 @@ const char * ap_sta_wpa_get_keyid(struct
void ap_sta_disconnect(struct hostapd_data *hapd, struct sta_info *sta,
const u8 *addr, u16 reason);
+void _ap_sta_set_authorized(struct hostapd_data *hapd,
+ struct sta_info *sta, int authorized,
+ int reassoc);
void ap_sta_set_authorized(struct hostapd_data *hapd,
struct sta_info *sta, int authorized);
static inline int ap_sta_is_authorized(struct sta_info *sta)

View File

@@ -0,0 +1,86 @@
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
@@ -3152,6 +3152,8 @@ static int hostapd_config_fill(struct ho
bss->ft_over_ds = atoi(pos);
} else if (os_strcmp(buf, "ft_psk_generate_local") == 0) {
bss->ft_psk_generate_local = atoi(pos);
+ } else if (os_strcmp(buf, "ft_l2_refresh") == 0) {
+ bss->ft_l2_refresh = atoi(pos);
#endif /* CONFIG_IEEE80211R_AP */
#ifndef CONFIG_NO_CTRL_IFACE
} else if (os_strcmp(buf, "ctrl_interface") == 0) {
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
@@ -401,6 +401,7 @@ struct hostapd_bss_config {
int pmk_r1_push;
int ft_over_ds;
int ft_psk_generate_local;
+ int ft_l2_refresh;
int r1_max_key_lifetime;
#endif /* CONFIG_IEEE80211R_AP */
--- a/src/ap/wpa_auth_glue.c
+++ b/src/ap/wpa_auth_glue.c
@@ -1495,6 +1495,28 @@ static void hostapd_request_radius_psk(v
#endif /* CONFIG_NO_RADIUS */
+static void wpa_ft_refresh(void *eloop_data, void *user_data)
+{
+ struct hostapd_data *hapd = eloop_data;
+ struct ft_rrb_frame *frame;
+ struct l2_ethhdr *buf;
+ size_t len;
+
+ len = sizeof(*buf) + sizeof(*frame);
+ buf = os_zalloc(len);
+ frame = (struct ft_rrb_frame *)(buf + 1);
+ frame->frame_type = RSN_REMOTE_FRAME_TYPE_FT_RRB;
+ frame->packet_type = FT_PACKET_REQUEST;
+ memset(buf->h_dest, 0xff, ETH_ALEN);
+ os_memcpy(buf->h_source, hapd->own_addr, ETH_ALEN);
+ buf->h_proto = host_to_be16(ETH_P_RRB);
+ l2_packet_send(hapd->l2, buf->h_dest, ETH_P_RRB, (u8 *) buf, len);
+ os_free(buf);
+
+ eloop_register_timeout(hapd->conf->ft_l2_refresh, 0, wpa_ft_refresh,
+ hapd, NULL);
+}
+
int hostapd_setup_wpa(struct hostapd_data *hapd)
{
struct wpa_auth_config _conf;
@@ -1640,6 +1662,9 @@ int hostapd_setup_wpa(struct hostapd_dat
"Failed to open ETH_P_OUI interface");
return -1;
}
+
+ if (hapd->conf->ft_l2_refresh)
+ wpa_ft_refresh(hapd, NULL);
}
#endif /* CONFIG_IEEE80211R_AP */
@@ -1655,7 +1680,6 @@ void hostapd_reconfig_wpa(struct hostapd
wpa_reconfig(hapd->wpa_auth, &wpa_auth_conf);
}
-
void hostapd_deinit_wpa(struct hostapd_data *hapd)
{
ieee80211_tkip_countermeasures_deinit(hapd);
@@ -1679,6 +1703,7 @@ void hostapd_deinit_wpa(struct hostapd_d
"information element from interface %s",
hapd->conf->iface);
}
+
}
ieee802_1x_deinit(hapd);
@@ -1687,6 +1712,7 @@ void hostapd_deinit_wpa(struct hostapd_d
hostapd_wpa_ft_rrb_rx_later(hapd, NULL); /* flush without delivering */
eloop_cancel_timeout(hostapd_oui_deliver_later, hapd, ELOOP_ALL_CTX);
hostapd_oui_deliver_later(hapd, NULL); /* flush without delivering */
+ eloop_cancel_timeout(wpa_ft_refresh, hapd, ELOOP_ALL_CTX);
l2_packet_deinit(hapd->l2);
hapd->l2 = NULL;
hostapd_wpa_unregister_ft_oui(hapd);

View File

@@ -0,0 +1,27 @@
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
@@ -1995,6 +1995,13 @@ static int hostapd_owe_iface_iter(struct
is_zero_ether_addr(bss->own_addr))
continue;
+ if (!os_memcmp(hapd->conf->owe_transition_bssid, bss->own_addr,
+ ETH_ALEN) &&
+ hapd->conf->owe_transition_ssid_len == bss->conf->ssid.ssid_len &&
+ !os_memcmp(hapd->conf->owe_transition_ssid, bss->conf->ssid.ssid,
+ bss->conf->ssid.ssid_len))
+ return 0;
+
os_memcpy(hapd->conf->owe_transition_bssid, bss->own_addr,
ETH_ALEN);
os_memcpy(hapd->conf->owe_transition_ssid,
@@ -2011,10 +2018,6 @@ static int hostapd_owe_iface_iter(struct
int hostapd_owe_trans_get_info(struct hostapd_data *hapd)
{
- if (hapd->conf->owe_transition_ssid_len > 0 &&
- !is_zero_ether_addr(hapd->conf->owe_transition_bssid))
- return 0;
-
/* Find transition mode SSID/BSSID information from a BSS operated by
* this hostapd instance. */
if (!hapd->iface->interfaces ||

View File

@@ -0,0 +1,53 @@
From 98b6503b87bb36bf2f5ae16e52e230e8870c867f Mon Sep 17 00:00:00 2001
From: Venkat Chimata <venkata@shasta.cloud>
Date: Fri, 28 Jun 2024 14:39:31 +0530
Subject: [PATCH] hostapd: Fix DVLAN + 802.1x issue
In case of swconfig switches, the basename of the interface should be based on the last dot.
Earlier it was done based on the first dot, which would result in incorrect basename.
For example if the interface name is eth0.4087 then the vlan->ifname would be eth0.4087. (A dot at the end) .
Before this patch, the basename was returned as eth0. It should be eth0.4087
Also fixed the return code by adding a default value of 0 and removed an unncessary check
for if_add before ubus add call.
Signed-off-by: Venkat Chimata <venkata@shasta.cloud>
---
src/ap/vlan_init.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/ap/vlan_init.c b/src/ap/vlan_init.c
index 3e27671..cfeb1e5 100644
--- a/src/ap/vlan_init.c
+++ b/src/ap/vlan_init.c
@@ -23,7 +23,8 @@ static int vlan_if_add(struct hostapd_data *hapd, struct hostapd_vlan *vlan,
int existsok)
{
bool vlan_exists = iface_exists(vlan->ifname);
- int ret;
+ int ret = 0;
+
#ifdef CONFIG_WEP
int i;
@@ -38,7 +39,7 @@ static int vlan_if_add(struct hostapd_data *hapd, struct hostapd_vlan *vlan,
#endif /* CONFIG_WEP */
if (!hapd->driver || !hapd->driver->if_add) {
- char *dot = strstr(vlan->ifname, ".");
+ char *dot = strrchr(vlan->ifname, '.');
if (dot)
*dot = '\0';
ret = 0;
@@ -59,7 +60,7 @@ static int vlan_if_add(struct hostapd_data *hapd, struct hostapd_vlan *vlan,
if (hapd->wpa_auth)
ret = wpa_auth_ensure_group(hapd->wpa_auth, vlan->vlan_id);
- if (!ret && !vlan_exists && hapd->driver->if_add)
+ if (!ret && !vlan_exists)
hostapd_ubus_add_vlan(hapd, vlan);
if (ret == 0)
--
2.34.1

View File

@@ -0,0 +1,156 @@
--- a/src/ap/ieee802_11.c
+++ b/src/ap/ieee802_11.c
@@ -7740,7 +7740,7 @@ enum colocation_mode get_colocation_mode
}
-size_t hostapd_eid_rnr_len(struct hostapd_data *hapd, u32 type)
+size_t _hostapd_eid_rnr_len(struct hostapd_data *hapd, u32 type, int add_6g)
{
size_t len = 0, current_len = 0;
enum colocation_mode mode = get_colocation_mode(hapd);
@@ -7753,7 +7753,7 @@ size_t hostapd_eid_rnr_len(struct hostap
/* fallthrough */
case WLAN_FC_STYPE_PROBE_RESP:
- if (mode == COLOCATED_LOWER_BAND)
+ if (add_6g && mode == COLOCATED_LOWER_BAND)
len += hostapd_eid_rnr_colocation_len(hapd,
&current_len);
@@ -7776,6 +7776,10 @@ size_t hostapd_eid_rnr_len(struct hostap
return len;
}
+size_t hostapd_eid_rnr_len(struct hostapd_data *hapd, u32 type)
+{
+ return _hostapd_eid_rnr_len(hapd, type, 1);
+}
static u8 *hostapd_eid_rnr_iface(struct hostapd_data *hapd,
struct hostapd_data *reporting_hapd,
@@ -7938,7 +7942,7 @@ static u8 *hostapd_eid_neighbor_report_d
}
-u8 * hostapd_eid_rnr(struct hostapd_data *hapd, u8 *eid, u32 type)
+u8 * _hostapd_eid_rnr(struct hostapd_data *hapd, u8 *eid, u32 type, int add_6g)
{
u8 *eid_start = eid;
size_t current_len = 0;
@@ -7955,7 +7959,7 @@ u8 * hostapd_eid_rnr(struct hostapd_data
/* fallthrough */
case WLAN_FC_STYPE_PROBE_RESP:
- if (mode == COLOCATED_LOWER_BAND)
+ if (add_6g && mode == COLOCATED_LOWER_BAND)
eid = hostapd_eid_rnr_colocation(hapd, eid,
&current_len);
@@ -7981,4 +7985,9 @@ u8 * hostapd_eid_rnr(struct hostapd_data
return eid;
}
+u8 * hostapd_eid_rnr(struct hostapd_data *hapd, u8 *eid, u32 type)
+{
+ return _hostapd_eid_rnr(hapd, eid, type, 1);
+}
+
#endif /* CONFIG_NATIVE_WINDOWS */
--- a/src/ap/ieee802_11.h
+++ b/src/ap/ieee802_11.h
@@ -135,6 +135,7 @@ u8 * hostapd_eid_time_zone(struct hostap
int hostapd_update_time_adv(struct hostapd_data *hapd);
void hostapd_client_poll_ok(struct hostapd_data *hapd, const u8 *addr);
u8 * hostapd_eid_bss_max_idle_period(struct hostapd_data *hapd, u8 *eid);
+u8 * _hostapd_eid_rnr(struct hostapd_data *hapd, u8 *eid, u32 type, int add_6g);
u8 * hostapd_eid_rnr(struct hostapd_data *hapd, u8 *eid, u32 type);
u8 * hostapd_eid_multiple_bssid(struct hostapd_data *hapd,
struct hostapd_data *req_bss, u8 *eid, u8 *end,
@@ -146,6 +147,7 @@ size_t hostapd_eid_multiple_bssid_len(st
struct hostapd_data *req_bss, u32 type,
const u8 *known_bssids,
u8 known_bssids_len, size_t *rnr_len);
+size_t _hostapd_eid_rnr_len(struct hostapd_data *hapd, u32 type, int add_6g);
size_t hostapd_eid_rnr_len(struct hostapd_data *hapd, u32 type);
int auth_sae_init_committed(struct hostapd_data *hapd, struct sta_info *sta);
#ifdef CONFIG_SAE
--- a/src/ap/beacon.c
+++ b/src/ap/beacon.c
@@ -463,7 +463,8 @@ static u8 * hostapd_eid_supported_op_cla
static u8 * hostapd_gen_probe_resp(struct hostapd_data *hapd,
const struct ieee80211_mgmt *req,
int is_p2p, size_t *resp_len,
- const u8 *known_bssids, u8 known_bssids_len)
+ const u8 *known_bssids, u8 known_bssids_len,
+ int add_6g)
{
struct hostapd_data *req_bss = NULL;
struct ieee80211_mgmt *resp;
@@ -523,7 +524,7 @@ static u8 * hostapd_gen_probe_resp(struc
known_bssids,
known_bssids_len,
NULL);
- buflen += hostapd_eid_rnr_len(hapd, WLAN_FC_STYPE_PROBE_RESP);
+ buflen += _hostapd_eid_rnr_len(hapd, WLAN_FC_STYPE_PROBE_RESP, add_6g);
resp = os_zalloc(buflen);
if (resp == NULL)
@@ -706,7 +707,7 @@ static u8 * hostapd_gen_probe_resp(struc
pos = hostapd_eid_mbo(hapd, pos, (u8 *) resp + buflen - pos);
pos = hostapd_eid_owe_trans(hapd, pos, (u8 *) resp + buflen - pos);
pos = hostapd_eid_dpp_cc(hapd, pos, (u8 *) resp + buflen - pos);
- pos = hostapd_eid_rnr(hapd, pos, WLAN_FC_STYPE_PROBE_RESP);
+ pos = _hostapd_eid_rnr(hapd, pos, WLAN_FC_STYPE_PROBE_RESP, add_6g);
if (hapd->conf->vendor_elements) {
os_memcpy(pos, wpabuf_head(hapd->conf->vendor_elements),
@@ -930,6 +931,7 @@ void handle_probe_req(struct hostapd_dat
.ssi_signal = ssi_signal,
.elems = &elems,
};
+ int ubus_response;
if (hapd->iconf->rssi_ignore_probe_request && ssi_signal &&
ssi_signal < hapd->iconf->rssi_ignore_probe_request)
@@ -1118,7 +1120,12 @@ void handle_probe_req(struct hostapd_dat
}
#endif /* CONFIG_P2P */
- if (hostapd_ubus_handle_event(hapd, &req)) {
+ ubus_response = hostapd_ubus_handle_event(hapd, &req);
+
+ if (ubus_response == 2) {
+ wpa_printf(MSG_DEBUG, "Probe request for " MACSTR " without 6G RNR.\n",
+ MAC2STR(mgmt->sa));
+ } else if (ubus_response) {
wpa_printf(MSG_DEBUG, "Probe request for " MACSTR " rejected by ubus handler.\n",
MAC2STR(mgmt->sa));
return;
@@ -1170,7 +1177,7 @@ void handle_probe_req(struct hostapd_dat
resp = hostapd_gen_probe_resp(hapd, mgmt, elems.p2p != NULL,
&resp_len, elems.known_bssids,
- elems.known_bssids_len);
+ elems.known_bssids_len, ubus_response == 2 ? 0 : 1);
if (resp == NULL)
return;
@@ -1239,7 +1246,7 @@ static u8 * hostapd_probe_resp_offloads(
"this");
/* Generate a Probe Response template for the non-P2P case */
- return hostapd_gen_probe_resp(hapd, NULL, 0, resp_len, NULL, 0);
+ return hostapd_gen_probe_resp(hapd, NULL, 0, resp_len, NULL, 0, 1);
}
#endif /* NEED_AP_MLME */
@@ -1269,7 +1276,7 @@ static u8 * hostapd_unsol_bcast_probe_re
return hostapd_gen_probe_resp(hapd, NULL, 0,
&params->unsol_bcast_probe_resp_tmpl_len,
- NULL, 0);
+ NULL, 0, 1);
}
#endif /* CONFIG_IEEE80211AX */

View File

@@ -0,0 +1,11 @@
--- a/src/radius/radius.c
+++ b/src/radius/radius.c
@@ -755,7 +755,7 @@ struct radius_attr_hdr * radius_msg_add_
ext->length = sizeof(*ext) + 1 + alen;
ext->ext_type = ext_type;
wpabuf_put_u8(msg->buf, data_len > alen ? 0x80 : 0);
- wpabuf_put_data(msg->buf, data, data_len);
+ wpabuf_put_data(msg->buf, data, alen);
data += alen;
data_len -= alen;
if (radius_msg_add_attr_to_array(

View File

@@ -0,0 +1,69 @@
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
@@ -3154,6 +3154,8 @@ static int hostapd_config_fill(struct ho
bss->ft_psk_generate_local = atoi(pos);
} else if (os_strcmp(buf, "ft_l2_refresh") == 0) {
bss->ft_l2_refresh = atoi(pos);
+ } else if (os_strcmp(buf, "ft_key") == 0) {
+ strncpy(bss->ft_key, pos, sizeof(bss->ft_key));
#endif /* CONFIG_IEEE80211R_AP */
#ifndef CONFIG_NO_CTRL_IFACE
} else if (os_strcmp(buf, "ctrl_interface") == 0) {
@@ -4996,8 +4998,22 @@ struct hostapd_config * hostapd_config_r
fclose(f);
- for (i = 0; i < conf->num_bss; i++)
+ for (i = 0; i < conf->num_bss; i++) {
+ if (*conf->bss[i]->ft_key) {
+ u8 buffer[128];
+ sprintf(buffer, "%02X:%02X:%02X:%02X:%02X:%02X %02X%02X%02X%02X%02X%02X %s", MAC2STR(conf->bss[i]->bssid), MAC2STR(conf->bss[i]->bssid), conf->bss[i]->ft_key);
+ add_r0kh(conf->bss[i], buffer);
+ sprintf(buffer, "%02X:%02X:%02X:%02X:%02X:%02X %02X:%02X:%02X:%02X:%02X:%02X %s", MAC2STR(conf->bss[i]->bssid), MAC2STR(conf->bss[i]->bssid), conf->bss[i]->ft_key);
+ add_r1kh(conf->bss[i], buffer);
+ sprintf(buffer, "ff:ff:ff:ff:ff:ff * %s", conf->bss[i]->ft_key);
+ add_r0kh(conf->bss[i], buffer);
+ sprintf(buffer, "00:00:00:00:00:00 00:00:00:00:00:00 %s", conf->bss[i]->ft_key);
+ add_r1kh(conf->bss[i], buffer);
+ hexstr2bin(conf->bss[i]->bssid, conf->bss[i]->r1_key_holder, FT_R1KH_ID_LEN);
+ conf->bss[i]->r0_key_holder_bssid = 1;
+ }
hostapd_set_security_params(conf->bss[i], 1);
+ }
if (hostapd_config_check(conf, 1))
errors++;
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
@@ -403,6 +403,7 @@ struct hostapd_bss_config {
int ft_psk_generate_local;
int ft_l2_refresh;
int r1_max_key_lifetime;
+ u8 ft_key[65];
#endif /* CONFIG_IEEE80211R_AP */
char *ctrl_interface; /* directory for UNIX domain sockets */
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
@@ -390,6 +390,7 @@ struct hostapd_bss_config {
/* IEEE 802.11r - Fast BSS Transition */
u8 mobility_domain[MOBILITY_DOMAIN_ID_LEN];
u8 r1_key_holder[FT_R1KH_ID_LEN];
+ int r0_key_holder_bssid;
u32 r0_key_lifetime; /* PMK-R0 lifetime seconds */
int rkh_pos_timeout;
int rkh_neg_timeout;
--- a/src/ap/wpa_auth_glue.c
+++ b/src/ap/wpa_auth_glue.c
@@ -80,7 +80,10 @@ static void hostapd_wpa_auth_conf(struct
os_memcpy(wconf->ssid, conf->ssid.ssid, wconf->ssid_len);
os_memcpy(wconf->mobility_domain, conf->mobility_domain,
MOBILITY_DOMAIN_ID_LEN);
- if (conf->nas_identifier &&
+ if (1 || conf->r0_key_holder_bssid) {
+ sprintf(wconf->r0_key_holder, "%02X%02X%02X%02X%02X%02X", MAC2STR(conf->bssid));
+ wconf->r0_key_holder_len = 12;
+ } else if (conf->nas_identifier &&
os_strlen(conf->nas_identifier) <= FT_R0KH_ID_MAX_LEN) {
wconf->r0_key_holder_len = os_strlen(conf->nas_identifier);
os_memcpy(wconf->r0_key_holder, conf->nas_identifier,

View File

@@ -1830,7 +1830,8 @@ ubus_event_cb(struct ubus_notify_request *req, int idx, int ret)
{
struct ubus_event_req *ureq = container_of(req, struct ubus_event_req, nreq);
ureq->resp = ret;
if (!ureq->resp)
ureq->resp = ret;
}
int hostapd_ubus_handle_event(struct hostapd_data *hapd, struct hostapd_ubus_request *req)
@@ -1863,6 +1864,7 @@ int hostapd_ubus_handle_event(struct hostapd_data *hapd, struct hostapd_ubus_req
blob_buf_init(&b, 0);
blobmsg_add_macaddr(&b, "address", addr);
blobmsg_add_string(&b, "ifname", hapd->conf->iface);
if (req->mgmt_frame)
blobmsg_add_macaddr(&b, "target", req->mgmt_frame->da);
if (req->ssi_signal)

View File

@@ -9,6 +9,7 @@
#include "ap_drv_ops.h"
#include "dfs.h"
#include "acs.h"
#include "ieee802_11_auth.h"
#include <libubox/uloop.h>
static uc_resource_type_t *global_type, *bss_type, *iface_type;
@@ -255,6 +256,7 @@ uc_hostapd_bss_set_config(uc_vm_t *vm, size_t nargs)
hostapd_setup_bss(hapd, hapd == iface->bss[0], true);
hostapd_ucode_update_interfaces();
hostapd_owe_update_trans(iface);
done:
ret = 0;
@@ -375,6 +377,7 @@ uc_hostapd_iface_add_bss(uc_vm_t *vm, size_t nargs)
conf->bss[idx] = NULL;
ret = hostapd_ucode_bss_get_uval(hapd);
hostapd_ucode_update_interfaces();
hostapd_owe_update_trans(iface);
goto out;
deinit_ctrl:
@@ -602,6 +605,7 @@ out:
ieee802_11_set_beacon(hapd);
}
hostapd_owe_update_trans(iface);
return ucv_boolean_new(true);
}
@@ -693,6 +697,7 @@ uc_hostapd_bss_rename(uc_vm_t *vm, size_t nargs)
hostapd_ubus_add_bss(hapd);
hostapd_ucode_update_interfaces();
hostapd_owe_update_trans(hapd->iface);
out:
if (interfaces->ctrl_iface_init)
interfaces->ctrl_iface_init(hapd);
@@ -700,6 +705,113 @@ out:
return ret ? NULL : ucv_boolean_new(true);
}
int hostapd_ucode_sta_auth(struct hostapd_data *hapd, struct sta_info *sta)
{
char addr[sizeof(MACSTR)];
uc_value_t *val, *cur;
int ret = 0;
if (wpa_ucode_call_prepare("sta_auth"))
return 0;
uc_value_push(ucv_get(ucv_string_new(hapd->conf->iface)));
snprintf(addr, sizeof(addr), MACSTR, MAC2STR(sta->addr));
val = ucv_string_new(addr);
uc_value_push(ucv_get(val));
val = wpa_ucode_call(2);
cur = ucv_object_get(val, "psk", NULL);
if (ucv_type(cur) == UC_ARRAY) {
struct hostapd_sta_wpa_psk_short *p, **next;
size_t len = ucv_array_length(cur);
next = &sta->psk;
hostapd_free_psk_list(*next);
*next = NULL;
for (size_t i = 0; i < len; i++) {
uc_value_t *cur_psk;
const char *str;
size_t str_len;
cur_psk = ucv_array_get(cur, i);
str = ucv_string_get(cur_psk);
str_len = strlen(str);
if (!str || str_len < 8 || str_len > 64)
continue;
p = os_zalloc(sizeof(*p));
if (len == 64) {
if (hexstr2bin(str, p->psk, PMK_LEN) < 0) {
free(p);
continue;
}
} else {
p->is_passphrase = 1;
memcpy(p->passphrase, str, str_len + 1);
}
*next = p;
next = &p->next;
}
}
cur = ucv_object_get(val, "force_psk", NULL);
sta->use_sta_psk = ucv_is_truish(cur);
cur = ucv_object_get(val, "status", NULL);
if (ucv_type(cur) == UC_INTEGER)
ret = ucv_int64_get(cur);
ucv_put(val);
ucv_gc(vm);
return ret;
}
void hostapd_ucode_sta_connected(struct hostapd_data *hapd, struct sta_info *sta)
{
struct hostapd_sta_wpa_psk_short *psk = sta->psk;
char addr[sizeof(MACSTR)];
uc_value_t *val, *cur;
int ret = 0;
if (wpa_ucode_call_prepare("sta_connected"))
return;
uc_value_push(ucv_get(ucv_string_new(hapd->conf->iface)));
snprintf(addr, sizeof(addr), MACSTR, MAC2STR(sta->addr));
val = ucv_string_new(addr);
uc_value_push(ucv_get(val));
val = ucv_object_new(vm);
if (sta->psk_idx)
ucv_object_add(val, "psk_idx", ucv_int64_new(sta->psk_idx - 1));
if (sta->psk)
ucv_object_add(val, "psk", ucv_string_new(sta->psk->passphrase));
uc_value_push(ucv_get(val));
val = wpa_ucode_call(3);
if (ucv_type(val) != UC_OBJECT)
goto out;
cur = ucv_object_get(val, "vlan", NULL);
if (ucv_type(cur) == UC_INTEGER) {
struct vlan_description vdesc = {
.notempty = 1,
.untagged = ucv_int64_get(cur),
};
ap_sta_set_vlan(hapd, sta, &vdesc);
ap_sta_bind_vlan(hapd, sta);
}
out:
ucv_put(val);
}
int hostapd_ucode_init(struct hapd_interfaces *ifaces)
{

View File

@@ -23,6 +23,8 @@ int hostapd_ucode_init(struct hapd_interfaces *ifaces);
void hostapd_ucode_free(void);
void hostapd_ucode_free_iface(struct hostapd_iface *iface);
int hostapd_ucode_sta_auth(struct hostapd_data *hapd, struct sta_info *sta);
void hostapd_ucode_sta_connected(struct hostapd_data *hapd, struct sta_info *sta);
void hostapd_ucode_add_bss(struct hostapd_data *hapd);
void hostapd_ucode_free_bss(struct hostapd_data *hapd);
void hostapd_ucode_reload_bss(struct hostapd_data *hapd);
@@ -44,6 +46,13 @@ static inline void hostapd_ucode_free_iface(struct hostapd_iface *iface)
static inline void hostapd_ucode_reload_bss(struct hostapd_data *hapd)
{
}
static inline int hostapd_ucode_sta_auth(struct hostapd_data *hapd, struct sta_info *sta)
{
return 0;
}
static inline void hostapd_ucode_sta_connected(struct hostapd_data *hapd, struct sta_info *sta)
{
}
static inline void hostapd_ucode_add_bss(struct hostapd_data *hapd)
{
}

View File

@@ -3,7 +3,7 @@ include $(TOPDIR)/rules.mk
ARCH:=aarch64
BOARD:=ipq50xx
BOARDNAME:=Qualcomm Technologies, Inc IPQ50xx
FEATURES:=squashfs fpu ramdisk pcie usbgadgeti nand
FEATURES:=squashfs fpu ramdisk pcie usbgadget nand
CPU_TYPE:=cortex-a53
CPU_SUBTYPE:=neon-vfpv4
MAINTAINER:=John Crispin <blogic@openwrt.org>

View File

@@ -7,16 +7,29 @@ board_config_update
board=$(board_name)
case "$board" in
wallys,dr5018)
ucidef_set_led_netdev "wan" "wan" "green:uplink" "eth0"
;;
edgecore,eap104)
ucidef_set_led_wlan "wlan2g" "WLAN2G" "green:wifi2" "phy0tpt"
ucidef_set_led_wlan "wlan5g" "WLAN5G" "green:wifi5" "phy1tpt"
ucidef_set_led_netdev "wan" "wan" "yellow:uplink" "eth0"
ucidef_set_led_default "power" "POWER" "green:power" "on"
;;
cig,wf186h|\
cig,wf186w)
ucidef_set_led_default "power" "POWER" "green:status" "on"
;;
cybertan,eww631-a1|\
cybertan,eww631-b1)
ucidef_set_led_default "power" "POWER" "sys:blue" "on"
;;
edgecore,oap101|\
edgecore,oap101-6e|\
edgecore,oap101e|\
edgecore,oap101e-6e)
ucidef_set_led_netdev "wan" "wan" "red:ethernet" "eth1"
ucidef_set_led_default "power" "POWER" "blue:management" "on"
;;
hfcl,ion4x_w|\
hfcl,ion4xi_w)

View File

@@ -18,13 +18,19 @@ qcom_setup_interfaces()
cig,wf186h)
ucidef_add_switch "switch0" "4:wan" "1:lan" "2:lan" "6@eth0"
;;
sonicfi,rap630c-311g|\
cybertan,eww631-a1)
ucidef_set_interface_wan "eth0"
ucidef_set_interface_lan ""
;;
sonicfi,rap630w-311g|\
cybertan,eww631-b1)
ucidef_add_switch "switch1" "5:wan" "2:lan" "3:lan" "4:lan" "6@eth0"
;;
udaya,a6-id2)
ucidef_set_interface_wan "eth1"
ucidef_set_interface_lan "eth0"
;;
edgecore,oap101|\
edgecore,oap101-6e|\
edgecore,oap101e|\
@@ -32,6 +38,7 @@ qcom_setup_interfaces()
ucidef_set_interface_lan "eth1"
ucidef_set_interface_wan "eth0"
;;
wallys,dr5018|\
edgecore,eap104)
ucidef_set_interface_wan "eth0"
ucidef_add_switch "switch1" \
@@ -52,6 +59,9 @@ qcom_setup_interfaces()
ucidef_add_switch "switch1" \
"6@eth0" "1:lan" "2:lan" "3:lan" "4:lan" "5:wan"
;;
glinet,b3000)
ucidef_add_switch "switch1" "6@eth1" "1:wan" "2:lan" "3:lan"
;;
esac
}
@@ -70,6 +80,8 @@ qcom_setup_macs()
ucidef_set_network_device_mac eth0 $wan_mac
ip link set eth0 address $wan_mac
;;
sonicfi,rap630c-311g|\
sonicfi,rap630w-311g|\
cybertan,eww631-a1|\
cybertan,eww631-b1)
mtd=$(find_mtd_chardev "0:APPSBLENV")
@@ -82,6 +94,10 @@ qcom_setup_macs()
ip link set eth0 address $wan_mac
ucidef_set_label_macaddr $wan_mac
;;
glinet,b3000)
wan_mac=$(cat /sys/class/net/eth1/address)
lan_mac=$(macaddr_add "$wan_mac" 2)
;;
*)
wan_mac=$(cat /sys/class/net/eth0/address)
lan_mac=$(macaddr_add "$wan_mac" 1)

View File

@@ -61,6 +61,39 @@ ath11k_generate_macs_eww631_b1() {
echo -ne \\x${mac2//:/\\x} >> /lib/firmware/ath11k-macs
}
ath11k_generate_macs_rap630c_311g() {
touch /lib/firmware/ath11k-macs
local dev=$(find_mtd_chardev "0:APPSBLENV")
mac=$(grep BaseMacAddress= $dev | cut -d '=' -f2)
eth=$(macaddr_canonicalize $mac)
mac1=$(macaddr_add $eth 1)
mac2=$(macaddr_add $eth 2)
echo -ne \\x${mac1//:/\\x} >> /lib/firmware/ath11k-macs
echo -ne \\x${mac2//:/\\x} >> /lib/firmware/ath11k-macs
}
ath11k_generate_macs_rap630w_311g() {
touch /lib/firmware/ath11k-macs
local dev=$(find_mtd_chardev "0:APPSBLENV")
mac=$(grep BaseMacAddress= $dev | cut -d '=' -f2)
eth=$(macaddr_canonicalize $mac)
mac1=$(macaddr_add $eth 2)
mac2=$(macaddr_add $eth 3)
echo -ne \\x${mac1//:/\\x} >> /lib/firmware/ath11k-macs
echo -ne \\x${mac2//:/\\x} >> /lib/firmware/ath11k-macs
}
ath11k_generate_macs_gl_b3000() {
mac=$(cat /proc/gl-hw-info/device_mac)
[ -z "$mac" ] && ath11k_generate_macs || {
touch /lib/firmware/ath11k-macs
mac1=$(macaddr_add $mac 2)
mac2=$(macaddr_add $mac 3)
echo -ne \\x${mac2//:/\\x} >> /lib/firmware/ath11k-macs
echo -ne \\x${mac1//:/\\x} >> /lib/firmware/ath11k-macs
}
}
caldata_die() {
echo "caldata: " "$*"
exit 1
@@ -86,6 +119,8 @@ ath11k/IPQ5018/hw1.0/caldata.bin)
case "$board" in
cig,wf186w|\
cig,wf186h|\
sonicfi,rap630c-311g|\
sonicfi,rap630w-311g|\
cybertan,eww631-a1|\
cybertan,eww631-b1|\
edgecore,eap104|\
@@ -99,7 +134,10 @@ ath11k/IPQ5018/hw1.0/caldata.bin)
optimcloud,d60-5g|\
optimcloud,d50|\
optimcloud,d50-5g|\
yuncore,fap655)
udaya,a6-id2|\
wallys,dr5018|\
yuncore,fap655|\
glinet,b3000)
caldata_extract "0:ART" 0x1000 0x20000
;;
esac
@@ -108,13 +146,17 @@ ath11k/qcn6122/hw1.0/caldata_1.bin)
case "$board" in
cig,wf186w|\
cig,wf186h|\
sonicfi,rap630c-311g|\
sonicfi,rap630w-311g|\
cybertan,eww631-a1|\
cybertan,eww631-b1|\
edgecore,oap101|\
edgecore,oap101-6e|\
edgecore,oap101e|\
edgecore,oap101e-6e|\
udaya,a6-id2|\
hfcl,ion4xi_w|\
wallys,dr5018|\
yuncore,fap655)
caldata_extract "0:ART" 0x26800 0x20000
;;
@@ -122,13 +164,17 @@ ath11k/qcn6122/hw1.0/caldata_1.bin)
;;
ath11k/qcn6122/hw1.0/caldata_2.bin)
case "$board" in
wallys,dr5018|\
edgecore,eap104|\
edgecore,oap101-6e|\
edgecore,oap101e-6e)
caldata_extract "0:ART" 0x4c000 0x20000
;;
sonicfi,rap630c-311g|\
sonicfi,rap630w-311g|\
cybertan,eww631-a1|\
cybertan,eww631-b1)
cybertan,eww631-b1|\
glinet,b3000)
caldata_extract "0:ART" 0x26800 0x20000
;;
esac
@@ -149,6 +195,12 @@ ath11k-macs)
cig,wf186h)
ath11k_generate_macs_wf186w
;;
sonicfi,rap630c-311g)
ath11k_generate_macs_rap630c_311g
;;
sonicfi,rap630w-311g)
ath11k_generate_macs_rap630w_311g
;;
cybertan,eww631-a1)
ath11k_generate_macs_eww631_a1
;;
@@ -156,6 +208,7 @@ ath11k-macs)
ath11k_generate_macs_eww631_b1
;;
edgecore,eap104|\
edgecore,oap101|\
edgecore,oap101-6e|\
edgecore,oap101e-6e|\
optimcloud,d60|\
@@ -169,6 +222,9 @@ ath11k-macs)
hfcl,ion4xi_w)
ath11k_generate_macs_ion4x
;;
glinet,b3000)
ath11k_generate_macs_gl_b3000
;;
esac
;;
*)

View File

@@ -1,111 +0,0 @@
#!/bin/sh
[ -e /lib/firmware/$FIRMWARE ] && exit 0
. /lib/functions.sh
. /lib/functions/system.sh
ath11k_generate_macs() {
touch /lib/firmware/ath11k-macs
eth=$(cat /sys/class/net/eth0/address)
mac1=$(macaddr_add $eth 2)
mac2=$(macaddr_add $eth 3)
mac3=$(macaddr_add $eth 4)
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
}
ath11k_generate_macs_wf186w() {
touch /lib/firmware/ath11k-macs
local dev=$(find_mtd_chardev "0:APPSBLENV")
mac=$(grep BaseMacAddress= $dev | cut -dx -f2)
eth=$(macaddr_canonicalize $mac)
mac1=$(macaddr_add $eth 2)
mac2=$(macaddr_add $eth 3)
mac3=$(macaddr_add $eth 4)
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
}
ath11k_generate_macs_ion4x() {
touch /lib/firmware/ath11k-macs
wifimac0=$(grep WLAN0_BASEMAC= /dev/mtd13 |cut -d '=' -f2)
wifimac1=$(grep WLAN1_BASEMAC= /dev/mtd13 |cut -d '=' -f2)
wifimac2=00:00:00:00:00:00
echo -ne \\x${wifimac0//:/\\x} >> /lib/firmware/ath11k-macs
echo -ne \\x${wifimac1//:/\\x} >> /lib/firmware/ath11k-macs
echo -ne \\x${wifimac2//:/\\x} >> /lib/firmware/ath11k-macs
}
caldata_die() {
echo "caldata: " "$*"
exit 1
}
caldata_extract() {
local part=$1
local offset=$(($2))
local count=$(($3))
local mtd
mtd=$(find_mtd_chardev $part)
[ -n "$mtd" ] || caldata_die "no mtd device found for partition $part"
dd if=$mtd of=/lib/firmware/$FIRMWARE iflag=skip_bytes bs=$count skip=$offset count=1 2>/dev/null || \
caldata_die "failed to extract calibration data from $mtd"
}
board=$(board_name)
case "$FIRMWARE" in
ath11k/IPQ5018/hw1.0/caldata.bin)
case "$board" in
cig,wf186w|\
edgecore,eap104|\
edgecore,oap101-6e|\
edgecore,oap101e|\
hfcl,ion4xi_w|\
yuncore,fap655)
caldata_extract "0:ART" 0x1000 0x20000
;;
esac
;;
ath11k/qcn6122/hw1.0/caldata_1.bin)
case "$board" in
cig,wf186w|\
edgecore,oap101-6e|\
edgecore,oap101e|\
hfcl,ion4xi_w|\
yuncore,fap655)
caldata_extract "0:ART" 0x26800 0x20000
;;
esac
;;
ath11k/qcn6122/hw1.0/caldata_2.bin)
case "$board" in
edgecore,eap104|\
edgecore,oap101-6e)
caldata_extract "0:ART" 0x4c000 0x20000
;;
esac
;;
ath11k-macs)
case "$board" in
cig,wf186w)
ath11k_generate_macs_wf186w
;;
edgecore,eap104|\
yuncore,fap655)
ath11k_generate_macs
;;
hfcl,ion4xi_w)
ath11k_generate_macs_ion4x
;;
esac
;;
*)
exit 1
;;
esac

View File

@@ -0,0 +1,31 @@
#!/bin/sh
. /lib/functions.sh
board=$(board_name)
case "$board" in
"edgecore,eap101")
ln -s /sys/kernel/debug/ath11k/ipq6018\ hw1.0/mac0/fw_stats/pdev_stats /tmp/pdev_stats_phy0
ln -s /sys/kernel/debug/ath11k/ipq6018\ hw1.0/mac1/fw_stats/pdev_stats /tmp/pdev_stats_phy1
;;
"edgecore,eap102")
ln -s /sys/kernel/debug/ath11k/ipq8074\ hw2.0/mac0/fw_stats/pdev_stats /tmp/pdev_stats_phy0
ln -s /sys/kernel/debug/ath11k/ipq8074\ hw2.0/mac1/fw_stats/pdev_stats /tmp/pdev_stats_phy1
;;
"edgecore,oap101e-6e"|\
"edgecore,oap101-6e")
ln -s /sys/kernel/debug/ath11k/ipq5018\ hw1.0/mac0/fw_stats/pdev_stats /tmp/pdev_stats_phy0
ln -s /sys/kernel/debug/ath11k/qcn6122_1/mac0/fw_stats/pdev_stats /tmp/pdev_stats_phy1
ln -s /sys/kernel/debug/ath11k/qcn6122_2/mac0/fw_stats/pdev_stats /tmp/pdev_stats_phy2
;;
"edgecore,oap101e"|\
"edgecore,oap101")
ln -s /sys/kernel/debug/ath11k/ipq5018\ hw1.0/mac0/fw_stats/pdev_stats /tmp/pdev_stats_phy0
ln -s /sys/kernel/debug/ath11k/qcn6122_1/mac0/fw_stats/pdev_stats /tmp/pdev_stats_phy1
;;
"edgecore,eap104")
ln -s /sys/kernel/debug/ath11k/ipq5018\ hw1.0/mac0/fw_stats/pdev_stats /tmp/pdev_stats_phy0
ln -s /sys/kernel/debug/ath11k/qcn6122_2/mac0/fw_stats/pdev_stats /tmp/pdev_stats_phy1
;;
esac

View File

@@ -7,5 +7,11 @@ boot() {
hfcl,ion4xi_w)
fw_setenv boot_count 0
;;
edgecore,oap101|\
edgecore,eap104)
avail=$(fw_printenv -n upgrade_available)
[ "${avail}" -eq 0 ] && fw_setenv upgrade_available 1
fw_setenv bootcount 0
;;
esac
}

View File

@@ -70,9 +70,12 @@ platform_check_image() {
case $board in
cig,wf186w|\
cig,wf186h|\
sonicfi,rap630c-311g|\
sonicfi,rap630w-311g|\
cybertan,eww631-a1|\
cybertan,eww631-b1|\
edgecore,eap104|\
wallys,dr5018|\
hfcl,ion4x_w|\
hfcl,ion4xi_w|\
optimcloud,d60|\
@@ -80,6 +83,8 @@ platform_check_image() {
optimcloud,d50|\
optimcloud,d50-5g|\
yuncore,fap655|\
glinet,b3000|\
udaya,a6-id2|\
edgecore,oap101|\
edgecore,oap101-6e|\
edgecore,oap101e|\
@@ -97,6 +102,7 @@ platform_do_upgrade() {
board=$(board_name)
case $board in
glinet,b3000|\
edgecore,oap101|\
edgecore,oap101-6e|\
edgecore,oap101e|\
@@ -121,6 +127,8 @@ platform_do_upgrade() {
;;
cig,wf186w|\
cig,wf186h|\
udaya,a6-id2|\
wallys,dr5018|\
optimcloud,d60|\
optimcloud,d60-5g|\
optimcloud,d50|\
@@ -132,6 +140,8 @@ platform_do_upgrade() {
}
nand_upgrade_tar "$1"
;;
sonicfi,rap630c-311g|\
sonicfi,rap630w-311g|\
cybertan,eww631-a1|\
cybertan,eww631-b1)
boot_part=$(fw_printenv bootfrom | cut -d = -f2)

View File

@@ -0,0 +1,801 @@
/dts-v1/;
/* Copyright (c) 2018-2021, The Linux Foundation. All rights reserved.
*
* Copyright (c) 2021 Qualcomm Innovation Center, Inc. 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 "ipq5018.dtsi"
#include <dt-bindings/input/input.h>
/ {
#address-cells = <0x2>;
#size-cells = <0x2>;
model = "GL.iNet B3000";
compatible = "glinet,b3000", "qcom,ipq5018-mp03.5", "qcom,ipq5018";
interrupt-parent = <&intc>;
aliases {
serial0 = &blsp1_uart1;
ethernet0 = "/soc/dp1";
ethernet1 = "/soc/dp2";
led-upgrade = &led_system;
};
chosen {
bootargs = "console=ttyMSM0,115200,n8 rw init=/init";
bootargs-append = " swiotlb=1 coherent_pool=2M";
stdout-path = "serial0";
};
gl-hw {
compatible = "gl-hw-info";
model = "b3000";
radio = "radio0";
wan = "eth1.1";
lan = "eth1.2 eth1.3";
secondwan_vlan_port = "2";
dfs;
reset-button = "gpio-27";
flash_size = <128>;
temperature = "/sys/devices/virtual/thermal/thermal_zone0/temp";
factory_data {
device_mac = "0:ART", "0x6";
device_ddns = "0:ART", "0x10";
device_sn_bak = "0:ART", "0x20";
device_sn = "0:ART", "0x30";
country_code = "0:ART", "0x88";
device_cert = "0:ART", "0x50000";
};
};
reserved-memory {
#ifdef __IPQ_MEM_PROFILE_256_MB__
/* 256 MB Profile
* +==========+==============+=========================+
* | | | |
* | Region | Start Offset | Size |
* | | | |
* +----------+--------------+-------------------------+
* | NSS | 0x40000000 | 8MB |
* +----------+--------------+-------------------------+
* | Linux | 0x40800000 | Depends on total memory |
* +----------+--------------+-------------------------+
* | uboot | 0x4A600000 | 4MB |
* +----------+--------------+-------------------------+
* | SBL | 0x4AA00000 | 1MB |
* +----------+--------------+-------------------------+
* | smem | 0x4AB00000 | 1MB |
* +----------+--------------+-------------------------+
* | TZ | 0x4AC00000 | 4MB |
* +----------+--------------+-------------------------+
* | Q6 | | |
* | code/ | 0x4B000000 | 20MB |
* | data | | |
* +----------+--------------+-------------------------+
* | IPQ5018 | | |
* | data | 0x4C400000 | 13MB |
* +----------+--------------+-------------------------+
* | IPQ5018 | | |
* | M3 Dump | 0x4D100000 | 1MB |
* +----------+--------------+-------------------------+
* | IPQ5018 | | |
* | QDSS | 0x4D200000 | 1MB |
* +----------+--------------+-------------------------+
* | QCN6122_1| | |
* | data | 0x4D300000 | 13MB |
* +----------+--------------+-------------------------+
* | QCN6122_1| | |
* | M3 Dump | 0x4E000000 | 1MB |
* +----------+--------------+-------------------------+
* | QCN6122_1| | |
* | QDSS | 0x4E100000 | 1MB |
* +----------+--------------+-------------------------+
* | QCN6122_2| | |
* | data | 0x4E200000 | 13MB |
* +----------+--------------+-------------------------+
* | QCN6122_2| | |
* | M3 Dump | 0x4EF00000 | 1MB |
* +----------+--------------+-------------------------+
* | QCN6122_2| | |
* | QDSS | 0x4F000000 | 1MB |
* +----------+--------------+-------------------------+
* | |
* | Rest of the memory for Linux |
* | |
* +===================================================+
*/
q6_mem_regions: q6_mem_regions@4B000000 {
no-map;
reg = <0x0 0x4B000000 0x0 0x4100000>;
};
q6_code_data: q6_code_data@4B000000 {
no-map;
reg = <0x0 0x4B000000 0x0 0x1400000>;
};
q6_ipq5018_data: q6_ipq5018_data@4C400000 {
no-map;
reg = <0x0 0x4C400000 0x0 0xD00000>;
};
m3_dump: m3_dump@4D100000 {
no-map;
reg = <0x0 0x4D100000 0x0 0x100000>;
};
q6_etr_region: q6_etr_dump@4D200000 {
no-map;
reg = <0x0 0x4D200000 0x0 0x100000>;
};
q6_qcn6122_data1: q6_qcn6122_data1@4D300000 {
no-map;
reg = <0x0 0x4D300000 0x0 0xD00000>;
};
m3_dump_qcn6122_1: m3_dump_qcn6122_1@4E000000 {
no-map;
reg = <0x0 0x4E000000 0x0 0x100000>;
};
q6_qcn6122_etr_1: q6_qcn6122_etr_1@4E100000 {
no-map;
reg = <0x0 0x4E100000 0x0 0x100000>;
};
q6_qcn6122_data2: q6_qcn6122_data2@4E200000 {
no-map;
reg = <0x0 0x4E200000 0x0 0xD00000>;
};
m3_dump_qcn6122_2: m3_dump_qcn6122_2@4EF00000 {
no-map;
reg = <0x0 0x4EF00000 0x0 0x100000>;
};
q6_qcn6122_etr_2: q6_qcn6122_etr_2@4F000000 {
no-map;
reg = <0x0 0x4F000000 0x0 0x100000>;
};
#else
/* 512MB/1GB Profiles
* +==========+==============+=========================+
* | | | |
* | Region | Start Offset | Size |
* | | | |
* +----------+--------------+-------------------------+
* | NSS | 0x40000000 | 16MB |
* +----------+--------------+-------------------------+
* | Linux | 0x41000000 | Depends on total memory |
* +----------+--------------+-------------------------+
* | uboot | 0x4A600000 | 4MB |
* +----------+--------------+-------------------------+
* | SBL | 0x4AA00000 | 1MB |
* +----------+--------------+-------------------------+
* | smem | 0x4AB00000 | 1MB |
* +----------+--------------+-------------------------+
* | TZ | 0x4AC00000 | 4MB |
* +----------+--------------+-------------------------+
* | Q6 | | |
* | code/ | 0x4B000000 | 20MB |
* | data | | |
* +----------+--------------+-------------------------+
* | IPQ5018 | | |
* | data | 0x4C400000 | 13MB |
* +----------+--------------+-------------------------+
* | IPQ5018 | | |
* | M3 Dump | 0x4D100000 | 1MB |
* +----------+--------------+-------------------------+
* | IPQ5018 | | |
* | QDSS | 0x4D200000 | 1MB |
* +----------+--------------+-------------------------+
* | IPQ5018 | | |
* | Caldb | 0x4D300000 | 2MB |
* +----------+--------------+-------------------------+
* | QCN6122_1| | |
* | data | 0x4D500000 | 13MB |
* +----------+--------------+-------------------------+
* | QCN6122_1| | |
* | M3 Dump | 0x4E200000 | 1MB |
* +----------+--------------+-------------------------+
* | QCN6122_1| | |
* | QDSS | 0x4E300000 | 1MB |
* +----------+--------------+-------------------------+
* | QCN6122_1| | |
* | Caldb | 0x4E400000 | 5MB |
* +----------+--------------+-------------------------+
* | QCN6122_2| | |
* | data | 0x4E900000 | 13MB |
* +----------+--------------+-------------------------+
* | QCN6122_2| | |
* | M3 Dump | 0x4F600000 | 1MB |
* +----------+--------------+-------------------------+
* | QCN6122_2| | |
* | QDSS | 0x4F700000 | 1MB |
* +----------+--------------+-------------------------+
* | QCN6122_2| | |
* | Caldb | 0x4F800000 | 5MB |
* +----------+--------------+-------------------------+
* | |
* | Rest of the memory for Linux |
* | |
* +===================================================+
*/
q6_mem_regions: q6_mem_regions@4B000000 {
no-map;
reg = <0x0 0x4B000000 0x0 0x4D00000>;
};
q6_code_data: q6_code_data@4B000000 {
no-map;
reg = <0x0 0x4B000000 0x0 01400000>;
};
q6_ipq5018_data: q6_ipq5018_data@4C400000 {
no-map;
reg = <0x0 0x4C400000 0x0 0xD00000>;
};
m3_dump: m3_dump@4D100000 {
no-map;
reg = <0x0 0x4D100000 0x0 0x100000>;
};
q6_etr_region: q6_etr_dump@4D200000 {
no-map;
reg = <0x0 0x4D200000 0x0 0x100000>;
};
q6_caldb_region: q6_caldb_region@4D300000 {
no-map;
reg = <0x0 0x4D300000 0x0 0x200000>;
};
q6_qcn6122_data1: q6_qcn6122_data1@4D500000 {
no-map;
reg = <0x0 0x4D500000 0x0 0xD00000>;
};
m3_dump_qcn6122_1: m3_dump_qcn6122_1@4E200000 {
no-map;
reg = <0x0 0x4E200000 0x0 0x100000>;
};
q6_qcn6122_etr_1: q6_qcn6122_etr_1@4E300000 {
no-map;
reg = <0x0 0x4E300000 0x0 0x100000>;
};
q6_qcn6122_caldb_1: q6_qcn6122_caldb_1@4E400000 {
no-map;
reg = <0x0 0x4E400000 0x0 0x500000>;
};
q6_qcn6122_data2: q6_qcn6122_data2@4E900000 {
no-map;
reg = <0x0 0x4E900000 0x0 0xD00000>;
};
m3_dump_qcn6122_2: m3_dump_qcn6122_2@4F600000 {
no-map;
reg = <0x0 0x4F600000 0x0 0x100000>;
};
q6_qcn6122_etr_2: q6_qcn6122_etr_2@4F700000 {
no-map;
reg = <0x0 0x4F700000 0x0 0x100000>;
};
q6_qcn6122_caldb_2: q6_qcn6122_caldb_2@4F800000 {
no-map;
reg = <0x0 0x4F800000 0x0 0x500000>;
};
#endif
};
soc {
serial@78af000 {
status = "ok";
};
qpic_bam: dma@7984000{
status = "ok";
};
nand: qpic-nand@79b0000 {
pinctrl-0 = <&qspi_nand_pins>;
pinctrl-names = "default";
status = "ok";
};
mdio0: mdio@88000 {
status = "ok";
ethernet-phy@0 {
reg = <7>;
};
};
mdio1: mdio@90000 {
status = "ok";
pinctrl-0 = <&mdio1_pins>;
pinctrl-names = "default";
phy-reset-gpio = <&tlmm 39 0>;
ethernet-phy@0 {
reg = <0>;
};
ethernet-phy@1 {
reg = <1>;
};
ethernet-phy@2 {
reg = <2>;
};
ethernet-phy@3 {
reg = <3>;
};
};
ess-instance {
num_devices = <0x2>;
ess-switch@0x39c00000 {
compatible = "qcom,ess-switch-ipq50xx";
device_id = <0>;
switch_mac_mode = <0xf>; /* mac mode for uniphy instance*/
cmnblk_clk = "internal_96MHz"; /* cmnblk clk*/
qcom,port_phyinfo {
port@0 {
port_id = <1>;
phy_address = <7>;
};
port@1 {
port_id = <2>;
forced-speed = <1000>;
forced-duplex = <1>;
};
};
led_source@0 {
source = <0>;
mode = "normal";
speed = "all";
blink_en = "enable";
active = "high";
};
};
ess-switch1@1 {
compatible = "qcom,ess-switch-qca83xx";
device_id = <1>;
switch_access_mode = "mdio";
mdio-bus = <&mdio1>;
reset_gpio = <&tlmm 0x27 0>;
switch_cpu_bmp = <0x40>; /* cpu port bitmap */
switch_lan_bmp = <0xc>; /* lan port bitmap */
switch_wan_bmp = <0x2>; /* wan port bitmap */
qca,ar8327-initvals = <
0x00004 0x7600000 /* PAD0_MODE */
0x00008 0x1000000 /* PAD5_MODE */
0x0000c 0x80 /* PAD6_MODE */
0x00010 0x2613a0 /* PORT6 FORCE MODE*/
0x000e4 0xaa545 /* MAC_POWER_SEL */
0x000e0 0xc74164de /* SGMII_CTRL */
0x0007c 0x4e /* PORT0_STATUS */
0x00094 0x4e /* PORT6_STATUS */
>;
qcom,port_phyinfo {
port@0 {
port_id = <1>;
phy_address = <0>;
};
port@1 {
port_id = <2>;
phy_address = <1>;
};
port@2 {
port_id = <3>;
phy_address = <2>;
};
port@3 {
port_id = <4>;
phy_address = <3>;
};
};
};
};
dp1 {
device_type = "network";
compatible = "qcom,nss-dp";
clocks = <&gcc GCC_SNOC_GMAC0_AXI_CLK>;
clock-names = "nss-snoc-gmac-axi-clk";
qcom,id = <1>;
reg = <0x39C00000 0x10000>;
interrupts = <GIC_SPI 101 IRQ_TYPE_LEVEL_HIGH>;
qcom,mactype = <2>;
qcom,link-poll = <1>;
qcom,phy-mdio-addr = <7>;
mdio-bus = <&mdio0>;
local-mac-address = [000000000000];
phy-mode = "sgmii";
qcom,rx-page-mode = <0>;
};
dp2 {
device_type = "network";
compatible = "qcom,nss-dp";
clocks = <&gcc GCC_SNOC_GMAC1_AXI_CLK>;
clock-names = "nss-snoc-gmac-axi-clk";
qcom,id = <2>;
reg = <0x39D00000 0x10000>;
interrupts = <GIC_SPI 109 IRQ_TYPE_LEVEL_HIGH>;
qcom,mactype = <2>;
local-mac-address = [000000000000];
phy-mode = "sgmii";
qcom,rx-page-mode = <0>;
};
nss-macsec1 {
compatible = "qcom,nss-macsec";
phy_addr = <0x1c>;
mdiobus = <&mdio1>;
};
};
qcom,test@0 {
status = "ok";
};
thermal-zones {
status = "ok";
};
};
&tlmm {
pinctrl-names = "default";
qspi_nand_pins: qspi_nand_pins {
qspi_clock {
pins = "gpio9";
function = "qspi_clk";
drive-strength = <8>;
bias-disable;
};
qspi_cs {
pins = "gpio8";
function = "qspi_cs";
drive-strength = <8>;
bias-disable;
};
qspi_data {
pins = "gpio4", "gpio5", "gpio6", "gpio7";
function = "qspi_data";
drive-strength = <8>;
bias-disable;
};
};
mdio1_pins: mdio_pinmux {
mux_0 {
pins = "gpio36";
function = "mdc";
drive-strength = <8>;
bias-pull-up;
};
mux_1 {
pins = "gpio37";
function = "mdio";
drive-strength = <8>;
bias-pull-up;
};
};
button_pins: button_pins {
reset_button {
pins = "gpio27";
function = "gpio";
drive-strength = <8>;
bias-pull-up;
};
};
leds_pins: leds_pins {
led_system {
pins = "gpio24";
function = "gpio";
drive-strength = <8>;
bias-pull-down;
};
led_white {
pins = "gpio23";
function = "gpio";
drive-strength = <8>;
bias-pull-down;
};
};
};
&soc {
gpio_keys {
compatible = "gpio-keys";
pinctrl-0 = <&button_pins>;
pinctrl-names = "default";
reset {
label = "reset";
linux,code = <KEY_RESTART>;
gpios = <&tlmm 27 GPIO_ACTIVE_LOW>;
linux,input-type = <1>;
debounce-interval = <60>;
};
};
leds {
compatible = "gpio-leds";
pinctrl-0 = <&leds_pins>;
pinctrl-names = "default";
led_system: led@24 {
label = "blue_led";
gpios = <&tlmm 24 GPIO_ACTIVE_HIGH>;
default-state = "on";
};
led@23 {
label = "white_led";
gpios = <&tlmm 23 GPIO_ACTIVE_HIGH>;
default-state = "off";
};
};
};
&q6v5_wcss {
compatible = "qcom,ipq5018-q6-mpd";
#address-cells = <1>;
#size-cells = <1>;
ranges;
firmware = "IPQ5018/q6_fw.mdt";
reg = <0x0cd00000 0x4040>,
<0x1938000 0x8>,
<0x193d204 0x4>;
reg-names = "qdsp6",
"tcsr-msip",
"tcsr-q6";
resets = <&gcc GCC_WCSSAON_RESET>,
<&gcc GCC_WCSS_Q6_BCR>;
reset-names = "wcss_aon_reset",
"wcss_q6_reset";
clocks = <&gcc GCC_Q6_AXIS_CLK>,
<&gcc GCC_WCSS_ECAHB_CLK>,
<&gcc GCC_Q6_AXIM_CLK>,
<&gcc GCC_Q6_AXIM2_CLK>,
<&gcc GCC_Q6_AHB_CLK>,
<&gcc GCC_Q6_AHB_S_CLK>,
<&gcc GCC_WCSS_AXI_S_CLK>;
clock-names = "gcc_q6_axis_clk",
"gcc_wcss_ecahb_clk",
"gcc_q6_axim_clk",
"gcc_q6_axim2_clk",
"gcc_q6_ahb_clk",
"gcc_q6_ahb_s_clk",
"gcc_wcss_axi_s_clk";
#ifdef __IPQ_MEM_PROFILE_256_MB__
memory-region = <&q6_mem_regions>, <&q6_etr_region>;
#else
memory-region = <&q6_mem_regions>, <&q6_etr_region>,
<&q6_caldb_region>;
#endif
qcom,rproc = <&q6v5_wcss>;
qcom,bootargs_smem = <507>;
boot-args = <0x1 0x4 0x3 0x0F 0x0 0x0>,
<0x2 0x4 0x2 0x12 0x0 0x0>;
status = "ok";
q6_wcss_pd1: remoteproc_pd1@4ab000 {
compatible = "qcom,ipq5018-wcss-ahb-mpd";
reg = <0x4ab000 0x20>;
reg-names = "rmb";
firmware = "IPQ5018/q6_fw.mdt";
m3_firmware = "IPQ5018/m3_fw.mdt";
interrupts-extended = <&wcss_smp2p_in 8 0>,
<&wcss_smp2p_in 9 0>,
<&wcss_smp2p_in 12 0>,
<&wcss_smp2p_in 11 0>;
interrupt-names = "fatal",
"ready",
"spawn-ack",
"stop-ack";
resets = <&gcc GCC_WCSSAON_RESET>,
<&gcc GCC_WCSS_BCR>,
<&gcc GCC_CE_BCR>;
reset-names = "wcss_aon_reset",
"wcss_reset",
"ce_reset";
clocks = <&gcc GCC_WCSS_AHB_S_CLK>,
<&gcc GCC_WCSS_ACMT_CLK>,
<&gcc GCC_WCSS_AXI_M_CLK>;
clock-names = "gcc_wcss_ahb_s_clk",
"gcc_wcss_acmt_clk",
"gcc_wcss_axi_m_clk";
qcom,halt-regs = <&tcsr_q6_block 0xa000 0xd000 0x0>;
qcom,smem-states = <&wcss_smp2p_out 8>,
<&wcss_smp2p_out 9>,
<&wcss_smp2p_out 10>;
qcom,smem-state-names = "shutdown",
"stop",
"spawn";
#ifdef __IPQ_MEM_PROFILE_256_MB__
memory-region = <&q6_ipq5018_data>, <&m3_dump>,
<&q6_etr_region>;
#else
memory-region = <&q6_ipq5018_data>, <&m3_dump>,
<&q6_etr_region>, <&q6_caldb_region>;
#endif
};
q6_wcss_pd2: remoteproc_pd2 {
compatible = "qcom,ipq5018-wcss-pcie-mpd";
firmware = "IPQ5018/q6_fw.mdt";
m3_firmware = "qcn6122/m3_fw.mdt";
interrupts-extended = <&wcss_smp2p_in 16 0>,
<&wcss_smp2p_in 17 0>,
<&wcss_smp2p_in 20 0>,
<&wcss_smp2p_in 19 0>;
interrupt-names = "fatal",
"ready",
"spawn-ack",
"stop-ack";
qcom,smem-states = <&wcss_smp2p_out 16>,
<&wcss_smp2p_out 17>,
<&wcss_smp2p_out 18>;
qcom,smem-state-names = "shutdown",
"stop",
"spawn";
#ifdef __IPQ_MEM_PROFILE_256_MB__
memory-region = <&q6_qcn6122_data1>, <&m3_dump_qcn6122_1>,
<&q6_qcn6122_etr_1>;
#else
memory-region = <&q6_qcn6122_data1>, <&m3_dump_qcn6122_1>,
<&q6_qcn6122_etr_1>, <&q6_qcn6122_caldb_1>;
#endif
};
q6_wcss_pd3: remoteproc_pd3 {
compatible = "qcom,ipq5018-wcss-pcie-mpd";
firmware = "IPQ5018/q6_fw.mdt";
m3_firmware = "qcn6122/m3_fw.mdt";
interrupts-extended = <&wcss_smp2p_in 24 0>,
<&wcss_smp2p_in 25 0>,
<&wcss_smp2p_in 28 0>,
<&wcss_smp2p_in 27 0>;
interrupt-names = "fatal",
"ready",
"spawn-ack",
"stop-ack";
qcom,smem-states = <&wcss_smp2p_out 24>,
<&wcss_smp2p_out 25>,
<&wcss_smp2p_out 26>;
qcom,smem-state-names = "shutdown",
"stop",
"spawn";
#ifdef __IPQ_MEM_PROFILE_256_MB__
memory-region = <&q6_qcn6122_data2>, <&m3_dump_qcn6122_2>,
<&q6_qcn6122_etr_2>;
#else
memory-region = <&q6_qcn6122_data2>, <&m3_dump_qcn6122_2>,
<&q6_qcn6122_etr_2>, <&q6_qcn6122_caldb_2>;
#endif
};
};
&wifi0 {
/* IPQ5018 */
qcom,multipd_arch;
qcom,rproc = <&q6_wcss_pd1>;
qcom,userpd-subsys-name = "q6v5_wcss_userpd1";
#ifdef __IPQ_MEM_PROFILE_256_MB__
qcom,tgt-mem-mode = <2>;
#else
qcom,tgt-mem-mode = <1>;
#endif
qcom,board_id = <0x23>;
#ifdef __CNSS2__
qcom,bdf-addr = <0x4C400000 0x4C400000 0x4C400000 0x0 0x0>;
qcom,caldb-addr = <0x4D300000 0x4D300000 0 0 0>;
qcom,caldb-size = <0x200000>;
mem-region = <&q6_ipq5018_data>;
#else
memory-region = <&q6_ipq5018_data>;
#endif
status = "ok";
};
&wifi1 {
/* QCN6122 5G */
qcom,multipd_arch;
qcom,userpd-subsys-name = "q6v5_wcss_userpd3";
qcom,rproc = <&q6_wcss_pd3>;
#ifdef __IPQ_MEM_PROFILE_256_MB__
qcom,tgt-mem-mode = <2>;
#else
qcom,tgt-mem-mode = <1>;
#endif
qcom,board_id = <0x60>;
#ifdef __CNSS2__
qcom,bdf-addr = <0x4E900000 0x4E900000 0x4E200000 0x0 0x0>;
qcom,caldb-addr = <0x4F800000 0x4F800000 0 0 0>;
qcom,caldb-size = <0x500000>;
mem-region = <&q6_qcn6122_data2>;
#else
memory-region = <&q6_qcn6122_data2>;
#endif
status = "ok";
};
&dwc_0 {
/delete-property/ #phy-cells;
/delete-property/ phys;
/delete-property/ phy-names;
};
&hs_m31phy_0 {
status = "ok";
};
&eud {
status = "ok";
};
&pcie_x1 {
perst-gpio = <&tlmm 18 GPIO_ACTIVE_LOW>;
};
&pcie_x2 {
perst-gpio = <&tlmm 15 GPIO_ACTIVE_LOW>;
};
&pcie_x1_rp {
status = "disabled";
mhi_0: qcom,mhi@0 {
reg = <0 0 0 0 0 >;
};
};
&pcie_x2_rp {
status = "disabled";
mhi_1: qcom,mhi@1 {
reg = <0 0 0 0 0 >;
};
};

View File

@@ -0,0 +1,915 @@
/dts-v1/;
/* Copyright (c) 2018-2021, The Linux Foundation. All rights reserved.
*
* Copyright (c) 2021 Qualcomm Innovation Center, Inc. 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 "ipq5018.dtsi"
/ {
#address-cells = <0x2>;
#size-cells = <0x2>;
model = "Sonicfi RAP630C-311G";
compatible = "sonicfi,rap630c-311g", "qcom,ipq5018-mp03.5", "qcom,ipq5018";
interrupt-parent = <&intc>;
aliases {
sdhc1 = &sdhc_1; /* SDC1 eMMC slot */
serial0 = &blsp1_uart1;
serial1 = &blsp1_uart2;
ethernet0 = "/soc/dp1";
ethernet1 = "/soc/dp2";
};
chosen {
bootargs = "console=ttyMSM0,115200,n8 rw init=/init";
bootargs-append = " swiotlb=1 coherent_pool=2M";
stdout-path = "serial0";
};
reserved-memory {
#ifdef __IPQ_MEM_PROFILE_256_MB__
/* 256 MB Profile
* +==========+==============+=========================+
* | | | |
* | Region | Start Offset | Size |
* | | | |
* +----------+--------------+-------------------------+
* | NSS | 0x40000000 | 8MB |
* +----------+--------------+-------------------------+
* | Linux | 0x40800000 | Depends on total memory |
* +----------+--------------+-------------------------+
* | uboot | 0x4A600000 | 4MB |
* +----------+--------------+-------------------------+
* | SBL | 0x4AA00000 | 1MB |
* +----------+--------------+-------------------------+
* | smem | 0x4AB00000 | 1MB |
* +----------+--------------+-------------------------+
* | TZ | 0x4AC00000 | 4MB |
* +----------+--------------+-------------------------+
* | Q6 | | |
* | code/ | 0x4B000000 | 20MB |
* | data | | |
* +----------+--------------+-------------------------+
* | IPQ5018 | | |
* | data | 0x4C400000 | 13MB |
* +----------+--------------+-------------------------+
* | IPQ5018 | | |
* | M3 Dump | 0x4D100000 | 1MB |
* +----------+--------------+-------------------------+
* | IPQ5018 | | |
* | QDSS | 0x4D200000 | 1MB |
* +----------+--------------+-------------------------+
* | QCN6122_1| | |
* | data | 0x4D300000 | 13MB |
* +----------+--------------+-------------------------+
* | QCN6122_1| | |
* | M3 Dump | 0x4E000000 | 1MB |
* +----------+--------------+-------------------------+
* | QCN6122_1| | |
* | QDSS | 0x4E100000 | 1MB |
* +----------+--------------+-------------------------+
* | QCN6122_2| | |
* | data | 0x4E200000 | 13MB |
* +----------+--------------+-------------------------+
* | QCN6122_2| | |
* | M3 Dump | 0x4EF00000 | 1MB |
* +----------+--------------+-------------------------+
* | QCN6122_2| | |
* | QDSS | 0x4F000000 | 1MB |
* +----------+--------------+-------------------------+
* | |
* | Rest of the memory for Linux |
* | |
* +===================================================+
*/
q6_mem_regions: q6_mem_regions@4B000000 {
no-map;
reg = <0x0 0x4B000000 0x0 0x4100000>;
};
q6_code_data: q6_code_data@4B000000 {
no-map;
reg = <0x0 0x4B000000 0x0 0x1400000>;
};
q6_ipq5018_data: q6_ipq5018_data@4C400000 {
no-map;
reg = <0x0 0x4C400000 0x0 0xD00000>;
};
m3_dump: m3_dump@4D100000 {
no-map;
reg = <0x0 0x4D100000 0x0 0x100000>;
};
q6_etr_region: q6_etr_dump@4D200000 {
no-map;
reg = <0x0 0x4D200000 0x0 0x100000>;
};
q6_qcn6122_data1: q6_qcn6122_data1@4D300000 {
no-map;
reg = <0x0 0x4D300000 0x0 0xD00000>;
};
m3_dump_qcn6122_1: m3_dump_qcn6122_1@4E000000 {
no-map;
reg = <0x0 0x4E000000 0x0 0x100000>;
};
q6_qcn6122_etr_1: q6_qcn6122_etr_1@4E100000 {
no-map;
reg = <0x0 0x4E100000 0x0 0x100000>;
};
q6_qcn6122_data2: q6_qcn6122_data2@4E200000 {
no-map;
reg = <0x0 0x4E200000 0x0 0xD00000>;
};
m3_dump_qcn6122_2: m3_dump_qcn6122_2@4EF00000 {
no-map;
reg = <0x0 0x4EF00000 0x0 0x100000>;
};
q6_qcn6122_etr_2: q6_qcn6122_etr_2@4F000000 {
no-map;
reg = <0x0 0x4F000000 0x0 0x100000>;
};
#else
/* 512MB/1GB Profiles
* +==========+==============+=========================+
* | | | |
* | Region | Start Offset | Size |
* | | | |
* +----------+--------------+-------------------------+
* | NSS | 0x40000000 | 16MB |
* +----------+--------------+-------------------------+
* | Linux | 0x41000000 | Depends on total memory |
* +----------+--------------+-------------------------+
* | uboot | 0x4A600000 | 4MB |
* +----------+--------------+-------------------------+
* | SBL | 0x4AA00000 | 1MB |
* +----------+--------------+-------------------------+
* | smem | 0x4AB00000 | 1MB |
* +----------+--------------+-------------------------+
* | TZ | 0x4AC00000 | 4MB |
* +----------+--------------+-------------------------+
* | Q6 | | |
* | code/ | 0x4B000000 | 20MB |
* | data | | |
* +----------+--------------+-------------------------+
* | IPQ5018 | | |
* | data | 0x4C400000 | 13MB |
* +----------+--------------+-------------------------+
* | IPQ5018 | | |
* | M3 Dump | 0x4D100000 | 1MB |
* +----------+--------------+-------------------------+
* | IPQ5018 | | |
* | QDSS | 0x4D200000 | 1MB |
* +----------+--------------+-------------------------+
* | IPQ5018 | | |
* | Caldb | 0x4D300000 | 2MB |
* +----------+--------------+-------------------------+
* | QCN6122_1| | |
* | data | 0x4D500000 | 13MB |
* +----------+--------------+-------------------------+
* | QCN6122_1| | |
* | M3 Dump | 0x4E200000 | 1MB |
* +----------+--------------+-------------------------+
* | QCN6122_1| | |
* | QDSS | 0x4E300000 | 1MB |
* +----------+--------------+-------------------------+
* | QCN6122_1| | |
* | Caldb | 0x4E400000 | 5MB |
* +----------+--------------+-------------------------+
* | QCN6122_2| | |
* | data | 0x4E900000 | 13MB |
* +----------+--------------+-------------------------+
* | QCN6122_2| | |
* | M3 Dump | 0x4F600000 | 1MB |
* +----------+--------------+-------------------------+
* | QCN6122_2| | |
* | QDSS | 0x4F700000 | 1MB |
* +----------+--------------+-------------------------+
* | QCN6122_2| | |
* | Caldb | 0x4F800000 | 5MB |
* +----------+--------------+-------------------------+
* | |
* | Rest of the memory for Linux |
* | |
* +===================================================+
*/
q6_mem_regions: q6_mem_regions@4B000000 {
no-map;
reg = <0x0 0x4B000000 0x0 0x4D00000>;
};
q6_code_data: q6_code_data@4B000000 {
no-map;
reg = <0x0 0x4B000000 0x0 01400000>;
};
q6_ipq5018_data: q6_ipq5018_data@4C400000 {
no-map;
reg = <0x0 0x4C400000 0x0 0xD00000>;
};
m3_dump: m3_dump@4D100000 {
no-map;
reg = <0x0 0x4D100000 0x0 0x100000>;
};
q6_etr_region: q6_etr_dump@4D200000 {
no-map;
reg = <0x0 0x4D200000 0x0 0x100000>;
};
q6_caldb_region: q6_caldb_region@4D300000 {
no-map;
reg = <0x0 0x4D300000 0x0 0x200000>;
};
q6_qcn6122_data1: q6_qcn6122_data1@4D500000 {
no-map;
reg = <0x0 0x4D500000 0x0 0xD00000>;
};
m3_dump_qcn6122_1: m3_dump_qcn6122_1@4E200000 {
no-map;
reg = <0x0 0x4E200000 0x0 0x100000>;
};
q6_qcn6122_etr_1: q6_qcn6122_etr_1@4E300000 {
no-map;
reg = <0x0 0x4E300000 0x0 0x100000>;
};
q6_qcn6122_caldb_1: q6_qcn6122_caldb_1@4E400000 {
no-map;
reg = <0x0 0x4E400000 0x0 0x500000>;
};
q6_qcn6122_data2: q6_qcn6122_data2@4E900000 {
no-map;
reg = <0x0 0x4E900000 0x0 0xD00000>;
};
m3_dump_qcn6122_2: m3_dump_qcn6122_2@4F600000 {
no-map;
reg = <0x0 0x4F600000 0x0 0x100000>;
};
q6_qcn6122_etr_2: q6_qcn6122_etr_2@4F700000 {
no-map;
reg = <0x0 0x4F700000 0x0 0x100000>;
};
q6_qcn6122_caldb_2: q6_qcn6122_caldb_2@4F800000 {
no-map;
reg = <0x0 0x4F800000 0x0 0x500000>;
};
#endif
};
soc {
serial@78af000 {
status = "ok";
};
blsp1_uart2: serial@78b0000 {
pinctrl-0 = <&blsp1_uart_pins>;
pinctrl-names = "default";
};
qpic_bam: dma@7984000{
status = "ok";
};
nand: qpic-nand@79b0000 {
pinctrl-0 = <&qspi_nand_pins>;
pinctrl-names = "default";
status = "ok";
};
spi_0: spi@78b5000 { /* BLSP1 QUP0 */
pinctrl-0 = <&blsp0_spi_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;
};
};
mdio0: mdio@88000 {
status = "ok";
ethernet-phy@0 {
reg = <7>;
};
};
mdio1: mdio@90000 {
status = "disabled";
pinctrl-0 = <&mdio1_pins>;
pinctrl-names = "default";
phy-reset-gpio = <&tlmm 39 0>;
ethernet-phy@0 {
reg = <28>;
};
};
ess-instance {
num_devices = <0x1>;
ess-switch@0x39c00000 {
switch_mac_mode = <0xf>; /* mac mode for uniphy instance*/
cmnblk_clk = "internal_96MHz"; /* cmnblk clk*/
qcom,port_phyinfo {
port@0 {
port_id = <1>;
phy_address = <7>;
mdiobus = <&mdio0>;
};
/*
port@1 {
port_id = <2>;
phy_address = <0x1c>;
mdiobus = <&mdio1>;
port_mac_sel = "QGMAC_PORT";
};
*/
};
led_source@0 {
source = <0>;
mode = "normal";
speed = "all";
blink_en = "enable";
active = "high";
};
};
};
dp1 {
device_type = "network";
compatible = "qcom,nss-dp";
clocks = <&gcc GCC_SNOC_GMAC0_AXI_CLK>;
clock-names = "nss-snoc-gmac-axi-clk";
qcom,id = <1>;
reg = <0x39C00000 0x10000>;
interrupts = <GIC_SPI 101 IRQ_TYPE_LEVEL_HIGH>;
qcom,mactype = <2>;
qcom,link-poll = <1>;
qcom,phy-mdio-addr = <7>;
mdio-bus = <&mdio0>;
local-mac-address = [000000000000];
phy-mode = "sgmii";
qcom,rx-page-mode = <0>;
};
/*
dp2 {
device_type = "network";
compatible = "qcom,nss-dp";
clocks = <&gcc GCC_SNOC_GMAC1_AXI_CLK>;
clock-names = "nss-snoc-gmac-axi-clk";
qcom,id = <2>;
reg = <0x39D00000 0x10000>;
interrupts = <GIC_SPI 109 IRQ_TYPE_LEVEL_HIGH>;
qcom,mactype = <2>;
qcom,link-poll = <1>;
qcom,phy-mdio-addr = <28>;
mdio-bus = <&mdio1>;
local-mac-address = [000000000000];
phy-mode = "sgmii";
qcom,rx-page-mode = <0>;
};
*/
nss-macsec1 {
compatible = "qcom,nss-macsec";
phy_addr = <0x1c>;
mdiobus = <&mdio1>;
};
};
qcom,test@0 {
status = "ok";
};
thermal-zones {
status = "ok";
};
};
&tlmm {
pinctrl-0 = <&blsp0_uart_pins &phy_led_pins>;
pinctrl-names = "default";
blsp0_uart_pins: blsp0_uart_pins {
blsp0_uart_rx_tx {
pins = "gpio20", "gpio21";
function = "blsp0_uart0";
bias-disable;
};
};
blsp1_uart_pins: blsp1_uart_pins {
blsp1_uart_rx_tx {
pins = "gpio23", "gpio25", "gpio24", "gpio26";
function = "blsp1_uart2";
bias-disable;
};
};
blsp0_spi_pins: blsp0_spi_pins {
mux {
pins = "gpio10", "gpio11", "gpio12", "gpio13";
function = "blsp0_spi";
drive-strength = <2>;
bias-disable;
};
};
qspi_nand_pins: qspi_nand_pins {
qspi_clock {
pins = "gpio9";
function = "qspi_clk";
drive-strength = <8>;
bias-disable;
};
qspi_cs {
pins = "gpio8";
function = "qspi_cs";
drive-strength = <8>;
bias-disable;
};
qspi_data {
pins = "gpio4", "gpio5", "gpio6", "gpio7";
function = "qspi_data";
drive-strength = <8>;
bias-disable;
};
};
mdio1_pins: mdio_pinmux {
mux_0 {
pins = "gpio36";
function = "mdc";
drive-strength = <8>;
bias-pull-up;
};
mux_1 {
pins = "gpio37";
function = "mdio";
drive-strength = <8>;
bias-pull-up;
};
};
phy_led_pins: phy_led_pins {
gephy_led_pin {
pins = "gpio46";
function = "led0";
drive-strength = <8>;
bias-pull-down;
};
};
i2c_pins: i2c_pins {
i2c_scl {
pins = "gpio25";
function = "blsp2_i2c1";
drive-strength = <8>;
bias-disable;
};
i2c_sda {
pins = "gpio26";
function = "blsp2_i2c1";
drive-strength = <8>;
bias-disable;
};
};
button_pins: button_pins {
reset_button {
pins = "gpio28";
function = "gpio";
drive-strength = <8>;
bias-pull-up;
};
};
audio_pins: audio_pinmux {
mux_1 {
pins = "gpio24";
function = "audio_rxbclk";
drive-strength = <8>;
bias-pull-down;
};
mux_2 {
pins = "gpio25";
function = "audio_rxfsync";
drive-strength = <8>;
bias-pull-down;
};
mux_3 {
pins = "gpio26";
function = "audio_rxd";
drive-strength = <8>;
bias-pull-down;
};
mux_4 {
pins = "gpio27";
function = "audio_txmclk";
drive-strength = <8>;
bias-pull-down;
};
mux_5 {
pins = "gpio28";
function = "audio_txbclk";
drive-strength = <8>;
bias-pull-down;
};
mux_6 {
pins = "gpio29";
function = "audio_txfsync";
drive-strength = <8>;
bias-pull-down;
};
mux_7 {
pins = "gpio30";
function = "audio_txd";
drive-strength = <8>;
bias-pull-down;
};
};
leds_pins: leds_pinmux {
sys_blue {
pins = "gpio30";
function = "gpio";
drive-strength = <8>;
bias-pull-up;
};
sys_red {
pins = "gpio36";
function = "gpio";
drive-strength = <8>;
bias-disable;
};
sys_green {
pins = "gpio37";
function = "gpio";
drive-strength = <8>;
bias-disable;
};
};
};
&soc {
gpio_keys {
compatible = "gpio-keys";
pinctrl-0 = <&button_pins>;
pinctrl-names = "default";
button@1 {
label = "reset";
linux,code = <KEY_RESTART>;
gpios = <&tlmm 28 GPIO_ACTIVE_LOW>;
linux,input-type = <1>;
debounce-interval = <60>;
};
};
gpio_leds {
compatible = "gpio-leds";
pinctrl-0 = <&leds_pins>;
pinctrl-names = "default";
led@30 {
label = "sys:blue";
gpios = <&tlmm 30 GPIO_ACTIVE_HIGH>; /* GPIO_30 */
default-state="on";
/* linux,default-trigger = "timer";
active-delay = <700>;
inactive-delay = <700>;
default-state="on"; */
};
led@36 {
label = "sys:red";
gpios = <&tlmm 36 GPIO_ACTIVE_HIGH>; /* GPIO_36 */
default-state="off";
/* linux,default-trigger = "timer";
active-delay = <700>;
inactive-delay = <700>;
default-state="on"; */
};
led@37 {
label = "sys:green";
gpios = <&tlmm 37 GPIO_ACTIVE_HIGH>; /* GPIO_37 */
default-state="off";
/* linux,default-trigger = "timer";
active-delay = <700>;
inactive-delay = <700>;
default-state="on"; */
};
};
};
&q6v5_wcss {
compatible = "qcom,ipq5018-q6-mpd";
#address-cells = <1>;
#size-cells = <1>;
ranges;
firmware = "IPQ5018/q6_fw.mdt";
reg = <0x0cd00000 0x4040>,
<0x1938000 0x8>,
<0x193d204 0x4>;
reg-names = "qdsp6",
"tcsr-msip",
"tcsr-q6";
resets = <&gcc GCC_WCSSAON_RESET>,
<&gcc GCC_WCSS_Q6_BCR>;
reset-names = "wcss_aon_reset",
"wcss_q6_reset";
clocks = <&gcc GCC_Q6_AXIS_CLK>,
<&gcc GCC_WCSS_ECAHB_CLK>,
<&gcc GCC_Q6_AXIM_CLK>,
<&gcc GCC_Q6_AXIM2_CLK>,
<&gcc GCC_Q6_AHB_CLK>,
<&gcc GCC_Q6_AHB_S_CLK>,
<&gcc GCC_WCSS_AXI_S_CLK>;
clock-names = "gcc_q6_axis_clk",
"gcc_wcss_ecahb_clk",
"gcc_q6_axim_clk",
"gcc_q6_axim2_clk",
"gcc_q6_ahb_clk",
"gcc_q6_ahb_s_clk",
"gcc_wcss_axi_s_clk";
#ifdef __IPQ_MEM_PROFILE_256_MB__
memory-region = <&q6_mem_regions>, <&q6_etr_region>;
#else
memory-region = <&q6_mem_regions>, <&q6_etr_region>,
<&q6_caldb_region>;
#endif
qcom,rproc = <&q6v5_wcss>;
qcom,bootargs_smem = <507>;
boot-args = <0x1 0x4 0x3 0x0F 0x0 0x0>,
<0x2 0x4 0x2 0x12 0x0 0x0>;
status = "ok";
q6_wcss_pd1: remoteproc_pd1@4ab000 {
compatible = "qcom,ipq5018-wcss-ahb-mpd";
reg = <0x4ab000 0x20>;
reg-names = "rmb";
firmware = "IPQ5018/q6_fw.mdt";
m3_firmware = "IPQ5018/m3_fw.mdt";
interrupts-extended = <&wcss_smp2p_in 8 0>,
<&wcss_smp2p_in 9 0>,
<&wcss_smp2p_in 12 0>,
<&wcss_smp2p_in 11 0>;
interrupt-names = "fatal",
"ready",
"spawn-ack",
"stop-ack";
resets = <&gcc GCC_WCSSAON_RESET>,
<&gcc GCC_WCSS_BCR>,
<&gcc GCC_CE_BCR>;
reset-names = "wcss_aon_reset",
"wcss_reset",
"ce_reset";
clocks = <&gcc GCC_WCSS_AHB_S_CLK>,
<&gcc GCC_WCSS_ACMT_CLK>,
<&gcc GCC_WCSS_AXI_M_CLK>;
clock-names = "gcc_wcss_ahb_s_clk",
"gcc_wcss_acmt_clk",
"gcc_wcss_axi_m_clk";
qcom,halt-regs = <&tcsr_q6_block 0xa000 0xd000 0x0>;
qcom,smem-states = <&wcss_smp2p_out 8>,
<&wcss_smp2p_out 9>,
<&wcss_smp2p_out 10>;
qcom,smem-state-names = "shutdown",
"stop",
"spawn";
#ifdef __IPQ_MEM_PROFILE_256_MB__
memory-region = <&q6_ipq5018_data>, <&m3_dump>,
<&q6_etr_region>;
#else
memory-region = <&q6_ipq5018_data>, <&m3_dump>,
<&q6_etr_region>, <&q6_caldb_region>;
#endif
};
q6_wcss_pd2: remoteproc_pd2 {
compatible = "qcom,ipq5018-wcss-pcie-mpd";
firmware = "IPQ5018/q6_fw.mdt";
m3_firmware = "qcn6122/m3_fw.mdt";
interrupts-extended = <&wcss_smp2p_in 16 0>,
<&wcss_smp2p_in 17 0>,
<&wcss_smp2p_in 20 0>,
<&wcss_smp2p_in 19 0>;
interrupt-names = "fatal",
"ready",
"spawn-ack",
"stop-ack";
qcom,smem-states = <&wcss_smp2p_out 16>,
<&wcss_smp2p_out 17>,
<&wcss_smp2p_out 18>;
qcom,smem-state-names = "shutdown",
"stop",
"spawn";
#ifdef __IPQ_MEM_PROFILE_256_MB__
memory-region = <&q6_qcn6122_data1>, <&m3_dump_qcn6122_1>,
<&q6_qcn6122_etr_1>;
#else
memory-region = <&q6_qcn6122_data1>, <&m3_dump_qcn6122_1>,
<&q6_qcn6122_etr_1>, <&q6_qcn6122_caldb_1>;
#endif
};
q6_wcss_pd3: remoteproc_pd3 {
compatible = "qcom,ipq5018-wcss-pcie-mpd";
firmware = "IPQ5018/q6_fw.mdt";
interrupts-extended = <&wcss_smp2p_in 24 0>,
<&wcss_smp2p_in 25 0>,
<&wcss_smp2p_in 28 0>,
<&wcss_smp2p_in 27 0>;
interrupt-names = "fatal",
"ready",
"spawn-ack",
"stop-ack";
qcom,smem-states = <&wcss_smp2p_out 24>,
<&wcss_smp2p_out 25>,
<&wcss_smp2p_out 26>;
qcom,smem-state-names = "shutdown",
"stop",
"spawn";
#ifdef __IPQ_MEM_PROFILE_256_MB__
memory-region = <&q6_qcn6122_data2>, <&m3_dump_qcn6122_2>,
<&q6_qcn6122_etr_2>;
#else
memory-region = <&q6_qcn6122_data2>, <&m3_dump_qcn6122_2>,
<&q6_qcn6122_etr_2>, <&q6_qcn6122_caldb_2>;
#endif
};
};
&i2c_0 {
pinctrl-0 = <&i2c_pins>;
pinctrl-names = "default";
status = "disabled";
};
&wifi0 {
/* IPQ5018 */
qcom,multipd_arch;
qcom,rproc = <&q6_wcss_pd1>;
qcom,userpd-subsys-name = "q6v5_wcss_userpd1";
#ifdef __IPQ_MEM_PROFILE_256_MB__
qcom,tgt-mem-mode = <2>;
#else
qcom,tgt-mem-mode = <1>;
#endif
qcom,board_id = <0x24>;
#ifdef __CNSS2__
qcom,bdf-addr = <0x4C400000 0x4C400000 0x4C400000 0x0 0x0>;
qcom,caldb-addr = <0x4D300000 0x4D300000 0 0 0 0>;
qcom,caldb-size = <0x200000>;
mem-region = <&q6_ipq5018_data>;
1235
#else
memory-region = <&q6_ipq5018_data>;
#endif
status = "ok";
};
&wifi1 {
/* QCN6122 5G */
qcom,multipd_arch;
qcom,userpd-subsys-name = "q6v5_wcss_userpd3";
qcom,rproc = <&q6_wcss_pd3>;
#ifdef __IPQ_MEM_PROFILE_256_MB__
qcom,tgt-mem-mode = <2>;
#else
qcom,tgt-mem-mode = <1>;
#endif
qcom,board_id = <0x60>;
#ifdef __CNSS2__
qcom,bdf-addr = <0x4E900000 0x4E900000 0x4E200000 0x0 0x0>;
qcom,caldb-addr = <0x4F800000 0x4F800000 0 0 0>;
qcom,caldb-size = <0x500000>;
mem-region = <&q6_qcn6122_data2>;
#else
memory-region = <&q6_qcn6122_data2>;
#endif
status = "ok";
};
&wifi2 {
/* QCN6122 6G */
qcom,multipd_arch;
qcom,userpd-subsys-name = "q6v5_wcss_userpd3";
#ifdef __IPQ_MEM_PROFILE_256_MB__
qcom,tgt-mem-mode = <2>;
#else
qcom,tgt-mem-mode = <1>;
#endif
qcom,board_id = <0xb0>;
qcom,bdf-addr = <0x4ED00000 0x4ED00000 0x4E400000 0x0 0x0>;
#ifdef __CNSS2__
qcom,caldb-addr = <0x4FF00000 0x4FF00000 0 0 0>;
#else
qcom,caldb-addr = <0x4FF00000>;
m3-dump-addr = <0x4FD00000>;
#endif
qcom,caldb-size = <0x500000>;
status = "disabled";
};
&usb3 {
status = "ok";
device-power-gpio = <&tlmm 24 1>;
};
&dwc_0 {
/delete-property/ #phy-cells;
/delete-property/ phys;
/delete-property/ phy-names;
};
&hs_m31phy_0 {
status = "ok";
};
&eud {
status = "ok";
};
&pcie_x1 {
perst-gpio = <&tlmm 18 GPIO_ACTIVE_LOW>;
};
&pcie_x2 {
perst-gpio = <&tlmm 15 GPIO_ACTIVE_LOW>;
};
&pcie_x1_rp {
status = "disabled";
mhi_0: qcom,mhi@0 {
reg = <0 0 0 0 0 >;
};
};
&pcie_x2_rp {
status = "disabled";
mhi_1: qcom,mhi@1 {
reg = <0 0 0 0 0 >;
};
};

View File

@@ -0,0 +1,981 @@
/dts-v1/;
/* Copyright (c) 2018-2021, The Linux Foundation. All rights reserved.
*
* Copyright (c) 2021 Qualcomm Innovation Center, Inc. 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 "ipq5018.dtsi"
/ {
#address-cells = <0x2>;
#size-cells = <0x2>;
model = "Sonicfi RAP630W-311G";
compatible = "sonicfi,rap630w-311g", "qcom,ipq5018-mp03.5", "qcom,ipq5018";
interrupt-parent = <&intc>;
aliases {
sdhc1 = &sdhc_1; /* SDC1 eMMC slot */
serial0 = &blsp1_uart1;
serial1 = &blsp1_uart2;
ethernet0 = "/soc/dp1";
ethernet1 = "/soc/dp2";
};
chosen {
bootargs = "console=ttyMSM0,115200,n8 rw init=/init";
bootargs-append = " swiotlb=1 coherent_pool=2M";
stdout-path = "serial0";
};
reserved-memory {
#ifdef __IPQ_MEM_PROFILE_256_MB__
/* 256 MB Profile
* +==========+==============+=========================+
* | | | |
* | Region | Start Offset | Size |
* | | | |
* +----------+--------------+-------------------------+
* | NSS | 0x40000000 | 8MB |
* +----------+--------------+-------------------------+
* | Linux | 0x40800000 | Depends on total memory |
* +----------+--------------+-------------------------+
* | uboot | 0x4A600000 | 4MB |
* +----------+--------------+-------------------------+
* | SBL | 0x4AA00000 | 1MB |
* +----------+--------------+-------------------------+
* | smem | 0x4AB00000 | 1MB |
* +----------+--------------+-------------------------+
* | TZ | 0x4AC00000 | 4MB |
* +----------+--------------+-------------------------+
* | Q6 | | |
* | code/ | 0x4B000000 | 20MB |
* | data | | |
* +----------+--------------+-------------------------+
* | IPQ5018 | | |
* | data | 0x4C400000 | 13MB |
* +----------+--------------+-------------------------+
* | IPQ5018 | | |
* | M3 Dump | 0x4D100000 | 1MB |
* +----------+--------------+-------------------------+
* | IPQ5018 | | |
* | QDSS | 0x4D200000 | 1MB |
* +----------+--------------+-------------------------+
* | QCN6122_1| | |
* | data | 0x4D300000 | 13MB |
* +----------+--------------+-------------------------+
* | QCN6122_1| | |
* | M3 Dump | 0x4E000000 | 1MB |
* +----------+--------------+-------------------------+
* | QCN6122_1| | |
* | QDSS | 0x4E100000 | 1MB |
* +----------+--------------+-------------------------+
* | QCN6122_2| | |
* | data | 0x4E200000 | 13MB |
* +----------+--------------+-------------------------+
* | QCN6122_2| | |
* | M3 Dump | 0x4EF00000 | 1MB |
* +----------+--------------+-------------------------+
* | QCN6122_2| | |
* | QDSS | 0x4F000000 | 1MB |
* +----------+--------------+-------------------------+
* | |
* | Rest of the memory for Linux |
* | |
* +===================================================+
*/
q6_mem_regions: q6_mem_regions@4B000000 {
no-map;
reg = <0x0 0x4B000000 0x0 0x4100000>;
};
q6_code_data: q6_code_data@4B000000 {
no-map;
reg = <0x0 0x4B000000 0x0 0x1400000>;
};
q6_ipq5018_data: q6_ipq5018_data@4C400000 {
no-map;
reg = <0x0 0x4C400000 0x0 0xD00000>;
};
m3_dump: m3_dump@4D100000 {
no-map;
reg = <0x0 0x4D100000 0x0 0x100000>;
};
q6_etr_region: q6_etr_dump@4D200000 {
no-map;
reg = <0x0 0x4D200000 0x0 0x100000>;
};
q6_qcn6122_data1: q6_qcn6122_data1@4D300000 {
no-map;
reg = <0x0 0x4D300000 0x0 0xD00000>;
};
m3_dump_qcn6122_1: m3_dump_qcn6122_1@4E000000 {
no-map;
reg = <0x0 0x4E000000 0x0 0x100000>;
};
q6_qcn6122_etr_1: q6_qcn6122_etr_1@4E100000 {
no-map;
reg = <0x0 0x4E100000 0x0 0x100000>;
};
q6_qcn6122_data2: q6_qcn6122_data2@4E200000 {
no-map;
reg = <0x0 0x4E200000 0x0 0xD00000>;
};
m3_dump_qcn6122_2: m3_dump_qcn6122_2@4EF00000 {
no-map;
reg = <0x0 0x4EF00000 0x0 0x100000>;
};
q6_qcn6122_etr_2: q6_qcn6122_etr_2@4F000000 {
no-map;
reg = <0x0 0x4F000000 0x0 0x100000>;
};
#else
/* 512MB/1GB Profiles
* +==========+==============+=========================+
* | | | |
* | Region | Start Offset | Size |
* | | | |
* +----------+--------------+-------------------------+
* | NSS | 0x40000000 | 16MB |
* +----------+--------------+-------------------------+
* | Linux | 0x41000000 | Depends on total memory |
* +----------+--------------+-------------------------+
* | uboot | 0x4A600000 | 4MB |
* +----------+--------------+-------------------------+
* | SBL | 0x4AA00000 | 1MB |
* +----------+--------------+-------------------------+
* | smem | 0x4AB00000 | 1MB |
* +----------+--------------+-------------------------+
* | TZ | 0x4AC00000 | 4MB |
* +----------+--------------+-------------------------+
* | Q6 | | |
* | code/ | 0x4B000000 | 20MB |
* | data | | |
* +----------+--------------+-------------------------+
* | IPQ5018 | | |
* | data | 0x4C400000 | 14MB |
* +----------+--------------+-------------------------+
* | IPQ5018 | | |
* | M3 Dump | 0x4D200000 | 1MB |
* +----------+--------------+-------------------------+
* | IPQ5018 | | |
* | QDSS | 0x4D300000 | 1MB |
* +----------+--------------+-------------------------+
* | IPQ5018 | | |
* | Caldb | 0x4D400000 | 2MB |
* +----------+--------------+-------------------------+
* | QCN6122_1| | |
* | data | 0x4D600000 | 16MB |
* +----------+--------------+-------------------------+
* | QCN6122_1| | |
* | M3 Dump | 0x4E600000 | 1MB |
* +----------+--------------+-------------------------+
* | QCN6122_1| | |
* | QDSS | 0x4E700000 | 1MB |
* +----------+--------------+-------------------------+
* | QCN6122_1| | |
* | Caldb | 0x4E800000 | 5MB |
* +----------+--------------+-------------------------+
* | QCN6122_2| | |
* | data | 0x4ED00000 | 16MB |
* +----------+--------------+-------------------------+
* | QCN6122_2| | |
* | M3 Dump | 0x4FD00000 | 1MB |
* +----------+--------------+-------------------------+
* | QCN6122_2| | |
* | QDSS | 0x4FE00000 | 1MB |
* +----------+--------------+-------------------------+
* | QCN6122_2| | |
* | Caldb | 0x4FF00000 | 5MB |
* +----------+--------------+-------------------------+
* | |
* | Rest of the memory for Linux |
* | |
* +===================================================+
*/
q6_mem_regions: q6_mem_regions@4B000000 {
no-map;
reg = <0x0 0x4B000000 0x0 0x5400000>;
};
q6_code_data: q6_code_data@4B000000 {
no-map;
reg = <0x0 0x4B000000 0x0 01400000>;
};
q6_ipq5018_data: q6_ipq5018_data@4C400000 {
no-map;
reg = <0x0 0x4C400000 0x0 0xE00000>;
};
m3_dump: m3_dump@4D200000 {
no-map;
reg = <0x0 0x4D200000 0x0 0x100000>;
};
q6_etr_region: q6_etr_dump@4D300000 {
no-map;
reg = <0x0 0x4D300000 0x0 0x100000>;
};
q6_caldb_region: q6_caldb_region@4D400000 {
no-map;
reg = <0x0 0x4D400000 0x0 0x200000>;
};
q6_qcn6122_data1: q6_qcn6122_data1@4D600000 {
no-map;
reg = <0x0 0x4D600000 0x0 0x1000000>;
};
m3_dump_qcn6122_1: m3_dump_qcn6122_1@4E600000 {
no-map;
reg = <0x0 0x4E600000 0x0 0x100000>;
};
q6_qcn6122_etr_1: q6_qcn6122_etr_1@4E700000 {
no-map;
reg = <0x0 0x4E700000 0x0 0x100000>;
};
q6_qcn6122_caldb_1: q6_qcn6122_caldb_1@4E800000 {
no-map;
reg = <0x0 0x4E800000 0x0 0x500000>;
};
q6_qcn6122_data2: q6_qcn6122_data2@4E900000 {
no-map;
reg = <0x0 0x4ED00000 0x0 0x1000000>;
};
m3_dump_qcn6122_2: m3_dump_qcn6122_2@4FD00000 {
no-map;
reg = <0x0 0x4FD00000 0x0 0x100000>;
};
q6_qcn6122_etr_2: q6_qcn6122_etr_2@4FE00000 {
no-map;
reg = <0x0 0x4FE00000 0x0 0x100000>;
};
q6_qcn6122_caldb_2: q6_qcn6122_caldb_2@4FF00000 {
no-map;
reg = <0x0 0x4FF00000 0x0 0x500000>;
};
#endif
};
soc {
serial@78af000 {
status = "ok";
};
/*
blsp1_uart2: serial@78b0000 {
pinctrl-0 = <&blsp1_uart_pins>;
pinctrl-names = "default";
};
*/
qpic_bam: dma@7984000{
status = "ok";
};
nand: qpic-nand@79b0000 {
pinctrl-0 = <&qspi_nand_pins>;
pinctrl-names = "default";
status = "ok";
};
spi_0: spi@78b5000 { /* BLSP1 QUP0 */
pinctrl-0 = <&blsp0_spi_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;
};
};
mdio0: mdio@88000 {
status = "ok";
ethernet-phy@0 {
reg = <7>;
};
};
mdio1: mdio@90000 {
status = "ok";
pinctrl-0 = <&mdio1_pins>;
pinctrl-names = "default";
phy-reset-gpio = <&tlmm 38 0>;
ethernet-phy@0 {
reg = <0>;
};
ethernet-phy@1 {
reg = <1>;
};
ethernet-phy@2 {
reg = <2>;
};
ethernet-phy@3 {
reg = <3>;
};
ethernet-phy@4 {
reg = <4>;
};
};
ess-instance {
num_devices = <0x2>;
ess-switch@0x39c00000 {
compatible = "qcom,ess-switch-ipq50xx";
device_id = <0>;
switch_mac_mode = <0xf>; /* mac mode for uniphy instance*/
cmnblk_clk = "internal_96MHz"; /* cmnblk clk*/
qcom,port_phyinfo {
port@0 {
port_id = <1>;
phy_address = <7>;
};
port@1 {
port_id = <2>;
forced-speed = <1000>;
forced-duplex = <1>;
};
};
led_source@0 {
source = <0>;
mode = "normal";
speed = "all";
blink_en = "enable";
active = "high";
};
};
ess-switch1@1 {
compatible = "qcom,ess-switch-qca83xx";
device_id = <1>;
switch_access_mode = "mdio";
mdio-bus = <&mdio1>;
reset_gpio = <&tlmm 0x26 0>;
switch_cpu_bmp = <0x40>; /* cpu port bitmap (Port 6 GMAC) */
switch_lan_bmp = <0x3c>; /* lan port bitmap */
switch_wan_bmp = <0x0>; /* wan port bitmap */
qca,ar8327-initvals = <
0x00004 0x7600000 /* PAD0_MODE */
0x00008 0x1000000 /* PAD5_MODE */
0x0000c 0x80 /* PAD6_MODE */
0x00010 0x2613a0 /* PORT6 FORCE MODE*/
0x000e4 0xaa545 /* MAC_POWER_SEL */
0x000e0 0xc74164de /* SGMII_CTRL */
0x0007c 0x4e /* PORT0_STATUS */
0x00094 0x4e /* PORT6_STATUS */
>;
qcom,port_phyinfo {
port@0 {
port_id = <1>;
phy_address = <0>;
};
port@1 {
port_id = <2>;
phy_address = <1>;
};
port@2 {
port_id = <3>;
phy_address = <2>;
};
port@3 {
port_id = <4>;
phy_address = <3>;
};
port@4 {
port_id = <5>;
phy_address = <4>;
};
};
};
};
dp1 {
device_type = "network";
compatible = "qcom,nss-dp";
clocks = <&gcc GCC_SNOC_GMAC1_AXI_CLK>;
clock-names = "nss-snoc-gmac-axi-clk";
qcom,id = <2>;
reg = <0x39D00000 0x10000>;
interrupts = <GIC_SPI 109 IRQ_TYPE_LEVEL_HIGH>;
qcom,mactype = <2>;
local-mac-address = [000000000000];
phy-mode = "sgmii";
};
dp2 {
device_type = "network";
compatible = "qcom,nss-dp";
clocks = <&gcc GCC_SNOC_GMAC0_AXI_CLK>;
clock-names = "nss-snoc-gmac-axi-clk";
qcom,id = <1>;
reg = <0x39C00000 0x10000>;
interrupts = <GIC_SPI 101 IRQ_TYPE_LEVEL_HIGH>;
qcom,mactype = <2>;
qcom,link-poll = <1>;
qcom,phy-mdio-addr = <7>;
mdio-bus = <&mdio0>;
local-mac-address = [000000000000];
phy-mode = "sgmii";
};
qcom,test@0 {
status = "ok";
};
/*
lpass: lpass@0xA000000{
status = "disabled";
};
pcm: pcm@0xA3C0000{
pinctrl-0 = <&audio_pins>;
pinctrl-names = "default";
status = "disabled";
};
pcm_lb: pcm_lb@0 {
status = "disabled";
};
*/
};
thermal-zones {
status = "ok";
};
};
&tlmm {
pinctrl-0 = <&blsp0_uart_pins>; //<&blsp0_uart_pins &phy_led_pins>;
pinctrl-names = "default";
blsp0_uart_pins: blsp0_uart_pins {
blsp0_uart_rx_tx {
pins = "gpio20", "gpio21";
function = "blsp0_uart0";
bias-disable;
};
};
/*
blsp1_uart_pins: blsp1_uart_pins {
blsp1_uart_rx_tx {
pins = "gpio23", "gpio25", "gpio24", "gpio26";
function = "blsp1_uart2";
bias-disable;
};
};
*/
blsp0_spi_pins: blsp0_spi_pins {
mux {
pins = "gpio10", "gpio11", "gpio12", "gpio13";
function = "blsp0_spi";
drive-strength = <2>;
bias-disable;
};
};
qspi_nand_pins: qspi_nand_pins {
qspi_clock {
pins = "gpio9";
function = "qspi_clk";
drive-strength = <8>;
bias-disable;
};
qspi_cs {
pins = "gpio8";
function = "qspi_cs";
drive-strength = <8>;
bias-disable;
};
qspi_data {
pins = "gpio4", "gpio5", "gpio6", "gpio7";
function = "qspi_data";
drive-strength = <8>;
bias-disable;
};
};
mdio1_pins: mdio_pinmux {
mux_0 {
pins = "gpio36";
function = "mdc";
drive-strength = <8>;
bias-pull-up;
};
mux_1 {
pins = "gpio37";
function = "mdio";
drive-strength = <8>;
bias-pull-up;
};
};
/*
phy_led_pins: phy_led_pins {
gephy_led_pin {
pins = "gpio46";
function = "led0";
drive-strength = <8>;
bias-pull-down;
};
};
*/
i2c_pins: i2c_pins {
i2c_scl {
pins = "gpio25";
function = "blsp2_i2c1";
drive-strength = <8>;
bias-disable;
};
i2c_sda {
pins = "gpio26";
function = "blsp2_i2c1";
drive-strength = <8>;
bias-disable;
};
};
button_pins: button_pins {
reset_button {
pins = "gpio28";
function = "gpio";
drive-strength = <8>;
bias-pull-up;
};
};
/*
audio_pins: audio_pinmux {
mux_1 {
pins = "gpio24";
function = "audio_rxbclk";
drive-strength = <8>;
bias-pull-down;
};
mux_2 {
pins = "gpio25";
function = "audio_rxfsync";
drive-strength = <8>;
bias-pull-down;
};
mux_3 {
pins = "gpio26";
function = "audio_rxd";
drive-strength = <8>;
bias-pull-down;
};
mux_4 {
pins = "gpio27";
function = "audio_txmclk";
drive-strength = <8>;
bias-pull-down;
};
mux_5 {
pins = "gpio28";
function = "audio_txbclk";
drive-strength = <8>;
bias-pull-down;
};
mux_6 {
pins = "gpio29";
function = "audio_txfsync";
drive-strength = <8>;
bias-pull-down;
};
mux_7 {
pins = "gpio30";
function = "audio_txd";
drive-strength = <8>;
bias-pull-down;
};
};
*/
poe_pins: poe_pinmux {
/*
LAN port PoE output enable
H --> enable; L --> disable (Default setting to H)
*/
mux_0 { /* PoE_OUT_EN */
pins = "gpio24";
function = "gpio";
drive-strength = <2>;
bias-pull-up;
output-high;
};
mux_1 { /* PSE_INT_N */
pins = "gpio27";
function = "gpio";
bias-pull-up;
input;
};
};
leds_pins: leds_pinmux {
sys_green {
pins = "gpio1";
function = "gpio";
drive-strength = <8>;
bias-disable;
};
sys_blue {
pins = "gpio30";
function = "gpio";
drive-strength = <8>;
bias-pull-up;
};
sys_red {
pins = "gpio46";
function = "gpio";
drive-strength = <8>;
bias-disable;
};
};
};
&soc {
gpio_keys {
compatible = "gpio-keys";
pinctrl-0 = <&button_pins>;
pinctrl-names = "default";
button@1 {
label = "reset";
linux,code = <KEY_RESTART>;
gpios = <&tlmm 28 GPIO_ACTIVE_LOW>;
linux,input-type = <1>;
debounce-interval = <60>;
};
};
gpio_leds {
compatible = "gpio-leds";
pinctrl-0 = <&leds_pins>;
pinctrl-names = "default";
led@1 {
label = "sys:green";
gpios = <&tlmm 1 GPIO_ACTIVE_HIGH>; /* GPIO_1/ATST_QP0 */
default-state="off";
};
led@30 {
label = "sys:blue";
gpios = <&tlmm 30 GPIO_ACTIVE_HIGH>; /* GPIO_30 */
default-state="on";
};
led@46 {
label = "sys:red";
gpios = <&tlmm 46 GPIO_ACTIVE_HIGH>; /* GPIO_46 */
default-state="off";
};
};
};
&q6v5_wcss {
compatible = "qcom,ipq5018-q6-mpd";
#address-cells = <1>;
#size-cells = <1>;
ranges;
firmware = "IPQ5018/q6_fw.mdt";
reg = <0x0cd00000 0x4040>,
<0x1938000 0x8>,
<0x193d204 0x4>;
reg-names = "qdsp6",
"tcsr-msip",
"tcsr-q6";
resets = <&gcc GCC_WCSSAON_RESET>,
<&gcc GCC_WCSS_Q6_BCR>;
reset-names = "wcss_aon_reset",
"wcss_q6_reset";
clocks = <&gcc GCC_Q6_AXIS_CLK>,
<&gcc GCC_WCSS_ECAHB_CLK>,
<&gcc GCC_Q6_AXIM_CLK>,
<&gcc GCC_Q6_AXIM2_CLK>,
<&gcc GCC_Q6_AHB_CLK>,
<&gcc GCC_Q6_AHB_S_CLK>,
<&gcc GCC_WCSS_AXI_S_CLK>;
clock-names = "gcc_q6_axis_clk",
"gcc_wcss_ecahb_clk",
"gcc_q6_axim_clk",
"gcc_q6_axim2_clk",
"gcc_q6_ahb_clk",
"gcc_q6_ahb_s_clk",
"gcc_wcss_axi_s_clk";
#ifdef __IPQ_MEM_PROFILE_256_MB__
memory-region = <&q6_mem_regions>, <&q6_etr_region>;
#else
memory-region = <&q6_mem_regions>, <&q6_etr_region>,
<&q6_caldb_region>;
#endif
qcom,rproc = <&q6v5_wcss>;
qcom,bootargs_smem = <507>;
boot-args = <0x1 0x4 0x3 0x0F 0x0 0x0>,
<0x2 0x4 0x2 0x12 0x0 0x0>;
status = "ok";
q6_wcss_pd1: remoteproc_pd1@4ab000 {
compatible = "qcom,ipq5018-wcss-ahb-mpd";
reg = <0x4ab000 0x20>;
reg-names = "rmb";
firmware = "IPQ5018/q6_fw.mdt";
m3_firmware = "IPQ5018/m3_fw.mdt";
interrupts-extended = <&wcss_smp2p_in 8 0>,
<&wcss_smp2p_in 9 0>,
<&wcss_smp2p_in 12 0>,
<&wcss_smp2p_in 11 0>;
interrupt-names = "fatal",
"ready",
"spawn-ack",
"stop-ack";
resets = <&gcc GCC_WCSSAON_RESET>,
<&gcc GCC_WCSS_BCR>,
<&gcc GCC_CE_BCR>;
reset-names = "wcss_aon_reset",
"wcss_reset",
"ce_reset";
clocks = <&gcc GCC_WCSS_AHB_S_CLK>,
<&gcc GCC_WCSS_ACMT_CLK>,
<&gcc GCC_WCSS_AXI_M_CLK>;
clock-names = "gcc_wcss_ahb_s_clk",
"gcc_wcss_acmt_clk",
"gcc_wcss_axi_m_clk";
qcom,halt-regs = <&tcsr_q6_block 0xa000 0xd000 0x0>;
qcom,smem-states = <&wcss_smp2p_out 8>,
<&wcss_smp2p_out 9>,
<&wcss_smp2p_out 10>;
qcom,smem-state-names = "shutdown",
"stop",
"spawn";
#ifdef __IPQ_MEM_PROFILE_256_MB__
memory-region = <&q6_ipq5018_data>, <&m3_dump>,
<&q6_etr_region>;
#else
memory-region = <&q6_ipq5018_data>, <&m3_dump>,
<&q6_etr_region>, <&q6_caldb_region>;
#endif
};
q6_wcss_pd2: remoteproc_pd2 {
compatible = "qcom,ipq5018-wcss-pcie-mpd";
firmware = "IPQ5018/q6_fw.mdt";
m3_firmware = "qcn6122/m3_fw.mdt";
interrupts-extended = <&wcss_smp2p_in 16 0>,
<&wcss_smp2p_in 17 0>,
<&wcss_smp2p_in 20 0>,
<&wcss_smp2p_in 19 0>;
interrupt-names = "fatal",
"ready",
"spawn-ack",
"stop-ack";
qcom,smem-states = <&wcss_smp2p_out 16>,
<&wcss_smp2p_out 17>,
<&wcss_smp2p_out 18>;
qcom,smem-state-names = "shutdown",
"stop",
"spawn";
#ifdef __IPQ_MEM_PROFILE_256_MB__
memory-region = <&q6_qcn6122_data1>, <&m3_dump_qcn6122_1>,
<&q6_qcn6122_etr_1>;
#else
memory-region = <&q6_qcn6122_data1>, <&m3_dump_qcn6122_1>,
<&q6_qcn6122_etr_1>, <&q6_qcn6122_caldb_1>;
#endif
};
q6_wcss_pd3: remoteproc_pd3 {
compatible = "qcom,ipq5018-wcss-pcie-mpd";
firmware = "IPQ5018/q6_fw.mdt";
interrupts-extended = <&wcss_smp2p_in 24 0>,
<&wcss_smp2p_in 25 0>,
<&wcss_smp2p_in 28 0>,
<&wcss_smp2p_in 27 0>;
interrupt-names = "fatal",
"ready",
"spawn-ack",
"stop-ack";
qcom,smem-states = <&wcss_smp2p_out 24>,
<&wcss_smp2p_out 25>,
<&wcss_smp2p_out 26>;
qcom,smem-state-names = "shutdown",
"stop",
"spawn";
#ifdef __IPQ_MEM_PROFILE_256_MB__
memory-region = <&q6_qcn6122_data2>, <&m3_dump_qcn6122_2>,
<&q6_qcn6122_etr_2>;
#else
memory-region = <&q6_qcn6122_data2>, <&m3_dump_qcn6122_2>,
<&q6_qcn6122_etr_2>, <&q6_qcn6122_caldb_2>;
#endif
};
};
&i2c_0 {
pinctrl-0 = <&i2c_pins>;
pinctrl-names = "default";
status = "ok";
};
&wifi0 {
/* IPQ5018 */
qcom,multipd_arch;
qcom,rproc = <&q6_wcss_pd1>;
qcom,userpd-subsys-name = "q6v5_wcss_userpd1";
#ifdef __IPQ_MEM_PROFILE_256_MB__
qcom,tgt-mem-mode = <2>;
#else
qcom,tgt-mem-mode = <1>;
#endif
qcom,board_id = <0x24>;
#ifdef __CNSS2__
qcom,bdf-addr = <0x4C400000 0x4C400000 0x4C400000 0x0 0x0 0x0>;
qcom,caldb-addr = <0x4D300000 0x4D300000 0 0 0 0>;
qcom,caldb-size = <0x200000>;
mem-region = <&q6_ipq5018_data>;
#else
memory-region = <&q6_ipq5018_data>;
#endif
status = "ok";
};
&wifi1 {
/* QCN6122 5G */
qcom,multipd_arch;
qcom,userpd-subsys-name = "q6v5_wcss_userpd3";
qcom,rproc = <&q6_wcss_pd3>;
#ifdef __IPQ_MEM_PROFILE_256_MB__
qcom,tgt-mem-mode = <2>;
#else
qcom,tgt-mem-mode = <1>;
#endif
qcom,board_id = <0x60>;
#ifdef __CNSS2__
qcom,bdf-addr = <0x4E900000 0x4E900000 0x4E200000 0x0 0x0>;
qcom,caldb-addr = <0x4F800000 0x4F800000 0 0 0>;
qcom,caldb-size = <0x500000>;
mem-region = <&q6_qcn6122_data2>;
#else
memory-region = <&q6_qcn6122_data2>;
#endif
status = "ok";
};
&wifi2 {
/* QCN6122 6G */
qcom,multipd_arch;
qcom,userpd-subsys-name = "q6v5_wcss_userpd3";
#ifdef __IPQ_MEM_PROFILE_256_MB__
qcom,tgt-mem-mode = <2>;
#else
qcom,tgt-mem-mode = <1>;
#endif
qcom,board_id = <0xb0>;
qcom,bdf-addr = <0x4ED00000 0x4ED00000 0x4E400000 0x0 0x0>;
#ifdef __CNSS2__
qcom,caldb-addr = <0x4FF00000 0x4FF00000 0 0 0>;
#else
qcom,caldb-addr = <0x4FF00000>;
m3-dump-addr = <0x4FD00000>;
#endif
qcom,caldb-size = <0x500000>;
status = "disabled";
};
&usb3 {
status = "ok";
device-power-gpio = <&tlmm 24 1>;
};
&dwc_0 {
/delete-property/ #phy-cells;
/delete-property/ phys;
/delete-property/ phy-names;
};
&hs_m31phy_0 {
status = "ok";
};
&eud {
status = "ok";
};
&pcie_x1 {
perst-gpio = <&tlmm 18 GPIO_ACTIVE_LOW>;
};
&pcie_x2 {
perst-gpio = <&tlmm 15 GPIO_ACTIVE_LOW>;
};
&pcie_x1_rp {
status = "disabled";
mhi_0: qcom,mhi@0 {
reg = <0 0 0 0 0 >;
};
};
&pcie_x2_rp {
status = "disabled";
mhi_1: qcom,mhi@1 {
reg = <0 0 0 0 0 >;
};
};

View File

@@ -0,0 +1,900 @@
/dts-v1/;
/* Copyright (c) 2018-2021, The Linux Foundation. All rights reserved.
*
* Copyright (c) 2021 Qualcomm Innovation Center, Inc. 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 "ipq5018.dtsi"
/ {
#address-cells = <0x2>;
#size-cells = <0x2>;
model = "Udaya A6-ID2";
compatible = "udaya,a6-id2", "qcom,ipq5018";
interrupt-parent = <&intc>;
aliases {
sdhc1 = &sdhc_1; /* SDC1 eMMC slot */
serial0 = &blsp1_uart1;
serial1 = &blsp1_uart2;
ethernet0 = "/soc/dp1";
ethernet1 = "/soc/dp2";
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 = " swiotlb=1 coherent_pool=2M";
stdout-path = "serial0";
};
reserved-memory {
#ifdef __IPQ_MEM_PROFILE_256_MB__
/* 256 MB Profile
* +==========+==============+=========================+
* | | | |
* | Region | Start Offset | Size |
* | | | |
* +----------+--------------+-------------------------+
* | NSS | 0x40000000 | 8MB |
* +----------+--------------+-------------------------+
* | Linux | 0x40800000 | Depends on total memory |
* +----------+--------------+-------------------------+
* | uboot | 0x4A600000 | 4MB |
* +----------+--------------+-------------------------+
* | SBL | 0x4AA00000 | 1MB |
* +----------+--------------+-------------------------+
* | smem | 0x4AB00000 | 1MB |
* +----------+--------------+-------------------------+
* | TZ | 0x4AC00000 | 4MB |
* +----------+--------------+-------------------------+
* | Q6 | | |
* | code/ | 0x4B000000 | 20MB |
* | data | | |
* +----------+--------------+-------------------------+
* | IPQ5018 | | |
* | data | 0x4C400000 | 13MB |
* +----------+--------------+-------------------------+
* | IPQ5018 | | |
* | M3 Dump | 0x4D100000 | 1MB |
* +----------+--------------+-------------------------+
* | IPQ5018 | | |
* | QDSS | 0x4D200000 | 1MB |
* +----------+--------------+-------------------------+
* | QCN6122_1| | |
* | data | 0x4D300000 | 13MB |
* +----------+--------------+-------------------------+
* | QCN6122_1| | |
* | M3 Dump | 0x4E000000 | 1MB |
* +----------+--------------+-------------------------+
* | QCN6122_1| | |
* | QDSS | 0x4E100000 | 1MB |
* +----------+--------------+-------------------------+
* | QCN6122_2| | |
* | data | 0x4E200000 | 13MB |
* +----------+--------------+-------------------------+
* | QCN6122_2| | |
* | M3 Dump | 0x4EF00000 | 1MB |
* +----------+--------------+-------------------------+
* | QCN6122_2| | |
* | QDSS | 0x4F000000 | 1MB |
* +----------+--------------+-------------------------+
* | |
* | Rest of the memory for Linux |
* | |
* +===================================================+
*/
q6_mem_regions: q6_mem_regions@4B000000 {
no-map;
reg = <0x0 0x4B000000 0x0 0x4100000>;
};
q6_code_data: q6_code_data@4B000000 {
no-map;
reg = <0x0 0x4B000000 0x0 0x1400000>;
};
q6_ipq5018_data: q6_ipq5018_data@4C400000 {
no-map;
reg = <0x0 0x4C400000 0x0 0xD00000>;
};
m3_dump: m3_dump@4D100000 {
no-map;
reg = <0x0 0x4D100000 0x0 0x100000>;
};
q6_etr_region: q6_etr_dump@4D200000 {
no-map;
reg = <0x0 0x4D200000 0x0 0x100000>;
};
q6_qcn6122_data1: q6_qcn6122_data1@4D300000 {
no-map;
reg = <0x0 0x4D300000 0x0 0xD00000>;
};
m3_dump_qcn6122_1: m3_dump_qcn6122_1@4E000000 {
no-map;
reg = <0x0 0x4E000000 0x0 0x100000>;
};
q6_qcn6122_etr_1: q6_qcn6122_etr_1@4E100000 {
no-map;
reg = <0x0 0x4E100000 0x0 0x100000>;
};
q6_qcn6122_data2: q6_qcn6122_data2@4E200000 {
no-map;
reg = <0x0 0x4E200000 0x0 0xD00000>;
};
m3_dump_qcn6122_2: m3_dump_qcn6122_2@4EF00000 {
no-map;
reg = <0x0 0x4EF00000 0x0 0x100000>;
};
q6_qcn6122_etr_2: q6_qcn6122_etr_2@4F000000 {
no-map;
reg = <0x0 0x4F000000 0x0 0x100000>;
};
#else
/* 512MB/1GB Profiles
* +==========+==============+=========================+
* | | | |
* | Region | Start Offset | Size |
* | | | |
* +----------+--------------+-------------------------+
* | NSS | 0x40000000 | 16MB |
* +----------+--------------+-------------------------+
* | Linux | 0x41000000 | Depends on total memory |
* +----------+--------------+-------------------------+
* | uboot | 0x4A600000 | 4MB |
* +----------+--------------+-------------------------+
* | SBL | 0x4AA00000 | 1MB |
* +----------+--------------+-------------------------+
* | smem | 0x4AB00000 | 1MB |
* +----------+--------------+-------------------------+
* | TZ | 0x4AC00000 | 4MB |
* +----------+--------------+-------------------------+
* | Q6 | | |
* | code/ | 0x4B000000 | 20MB |
* | data | | |
* +----------+--------------+-------------------------+
* | IPQ5018 | | |
* | data | 0x4C400000 | 13MB |
* +----------+--------------+-------------------------+
* | IPQ5018 | | |
* | M3 Dump | 0x4D100000 | 1MB |
* +----------+--------------+-------------------------+
* | IPQ5018 | | |
* | QDSS | 0x4D200000 | 1MB |
* +----------+--------------+-------------------------+
* | IPQ5018 | | |
* | Caldb | 0x4D300000 | 2MB |
* +----------+--------------+-------------------------+
* | QCN6122_1| | |
* | data | 0x4D500000 | 13MB |
* +----------+--------------+-------------------------+
* | QCN6122_1| | |
* | M3 Dump | 0x4E200000 | 1MB |
* +----------+--------------+-------------------------+
* | QCN6122_1| | |
* | QDSS | 0x4E300000 | 1MB |
* +----------+--------------+-------------------------+
* | QCN6122_1| | |
* | Caldb | 0x4E400000 | 5MB |
* +----------+--------------+-------------------------+
* | QCN6122_2| | |
* | data | 0x4E900000 | 13MB |
* +----------+--------------+-------------------------+
* | QCN6122_2| | |
* | M3 Dump | 0x4F600000 | 1MB |
* +----------+--------------+-------------------------+
* | QCN6122_2| | |
* | QDSS | 0x4F700000 | 1MB |
* +----------+--------------+-------------------------+
* | QCN6122_2| | |
* | Caldb | 0x4F800000 | 5MB |
* +----------+--------------+-------------------------+
* | |
* | Rest of the memory for Linux |
* | |
* +===================================================+
*/
q6_mem_regions: q6_mem_regions@4B000000 {
no-map;
reg = <0x0 0x4B000000 0x0 0x4D00000>;
};
q6_code_data: q6_code_data@4B000000 {
no-map;
reg = <0x0 0x4B000000 0x0 01400000>;
};
q6_ipq5018_data: q6_ipq5018_data@4C400000 {
no-map;
reg = <0x0 0x4C400000 0x0 0xD00000>;
};
m3_dump: m3_dump@4D100000 {
no-map;
reg = <0x0 0x4D100000 0x0 0x100000>;
};
q6_etr_region: q6_etr_dump@4D200000 {
no-map;
reg = <0x0 0x4D200000 0x0 0x100000>;
};
q6_caldb_region: q6_caldb_region@4D300000 {
no-map;
reg = <0x0 0x4D300000 0x0 0x200000>;
};
q6_qcn6122_data1: q6_qcn6122_data1@4D500000 {
no-map;
reg = <0x0 0x4D500000 0x0 0xD00000>;
};
m3_dump_qcn6122_1: m3_dump_qcn6122_1@4E200000 {
no-map;
reg = <0x0 0x4E200000 0x0 0x100000>;
};
q6_qcn6122_etr_1: q6_qcn6122_etr_1@4E300000 {
no-map;
reg = <0x0 0x4E300000 0x0 0x100000>;
};
q6_qcn6122_caldb_1: q6_qcn6122_caldb_1@4E400000 {
no-map;
reg = <0x0 0x4E400000 0x0 0x500000>;
};
q6_qcn6122_data2: q6_qcn6122_data2@4E900000 {
no-map;
reg = <0x0 0x4E900000 0x0 0xD00000>;
};
m3_dump_qcn6122_2: m3_dump_qcn6122_2@4F600000 {
no-map;
reg = <0x0 0x4F600000 0x0 0x100000>;
};
q6_qcn6122_etr_2: q6_qcn6122_etr_2@4F700000 {
no-map;
reg = <0x0 0x4F700000 0x0 0x100000>;
};
q6_qcn6122_caldb_2: q6_qcn6122_caldb_2@4F800000 {
no-map;
reg = <0x0 0x4F800000 0x0 0x500000>;
};
#endif
};
soc {
serial@78af000 {
status = "ok";
};
blsp1_uart2: serial@78b0000 {
pinctrl-0 = <&blsp1_uart_pins>;
pinctrl-names = "default";
};
qpic_bam: dma@7984000{
status = "ok";
};
nand: qpic-nand@79b0000 {
pinctrl-0 = <&qspi_nand_pins>;
pinctrl-names = "default";
status = "ok";
};
spi_0: spi@78b5000 { /* BLSP1 QUP0 */
pinctrl-0 = <&blsp0_spi_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;
};
};
mdio0: mdio@88000 {
status = "ok";
ethernet-phy@0 {
reg = <7>;
};
};
mdio1: mdio@90000 {
status = "ok";
pinctrl-0 = <&mdio1_pins>;
pinctrl-names = "default";
phy-reset-gpio = <&tlmm 39 0>;
ethernet-phy@0 {
reg = <28>;
};
};
ess-instance {
num_devices = <0x1>;
ess-switch@0x39c00000 {
switch_mac_mode = <0xf>; /* mac mode for uniphy instance*/
cmnblk_clk = "internal_96MHz"; /* cmnblk clk*/
qcom,port_phyinfo {
port@0 {
port_id = <1>;
phy_address = <7>;
mdiobus = <&mdio0>;
};
port@1 {
port_id = <2>;
phy_address = <0x1c>;
mdiobus = <&mdio1>;
port_mac_sel = "QGMAC_PORT";
};
};
led_source@0 {
source = <0>;
mode = "normal";
speed = "all";
blink_en = "enable";
active = "high";
};
};
};
dp1 {
device_type = "network";
compatible = "qcom,nss-dp";
clocks = <&gcc GCC_SNOC_GMAC0_AXI_CLK>;
clock-names = "nss-snoc-gmac-axi-clk";
qcom,id = <1>;
reg = <0x39C00000 0x10000>;
interrupts = <GIC_SPI 101 IRQ_TYPE_LEVEL_HIGH>;
qcom,mactype = <2>;
qcom,link-poll = <1>;
qcom,phy-mdio-addr = <7>;
mdio-bus = <&mdio0>;
local-mac-address = [000000000000];
phy-mode = "sgmii";
qcom,rx-page-mode = <0>;
};
dp2 {
device_type = "network";
compatible = "qcom,nss-dp";
clocks = <&gcc GCC_SNOC_GMAC1_AXI_CLK>;
clock-names = "nss-snoc-gmac-axi-clk";
qcom,id = <2>;
reg = <0x39D00000 0x10000>;
interrupts = <GIC_SPI 109 IRQ_TYPE_LEVEL_HIGH>;
qcom,mactype = <2>;
qcom,link-poll = <1>;
qcom,phy-mdio-addr = <28>;
mdio-bus = <&mdio1>;
local-mac-address = [000000000000];
phy-mode = "sgmii";
qcom,rx-page-mode = <0>;
};
nss-macsec1 {
compatible = "qcom,nss-macsec";
phy_addr = <0x1c>;
mdiobus = <&mdio1>;
};
pcm: pcm@0xA3C0000{
pinctrl-0 = <&audio_pins>;
pinctrl-names = "default";
};
gpio_keys {
compatible = "gpio-keys";
pinctrl-0 = <&button_pins>;
pinctrl-names = "default";
reset {
label = "reset";
linux,code = <KEY_RESTART>;
gpios = <&tlmm 38 GPIO_ACTIVE_LOW>;
linux,input-type = <1>;
debounce-interval = <60>;
};
};
leds {
compatible = "gpio-leds";
pinctrl-0 = <&leds_pins>;
pinctrl-names = "default";
led_power: led@30 {
label = "green:power";
gpios = <&tlmm 30 GPIO_ACTIVE_HIGH>;
default-state = "on";
};
};
};
qcom,test@0 {
status = "ok";
};
thermal-zones {
status = "ok";
};
};
&tlmm {
pinctrl-0 = <&blsp0_uart_pins &phy_led_pins>;
pinctrl-names = "default";
blsp0_uart_pins: uart_pins {
blsp0_uart_rx_tx {
pins = "gpio20", "gpio21";
function = "blsp0_uart0";
bias-disable;
};
};
blsp1_uart_pins: blsp1_uart_pins {
blsp1_uart_rx_tx {
pins = "gpio23", "gpio25", "gpio24", "gpio26";
function = "blsp1_uart2";
bias-disable;
};
};
blsp0_spi_pins: blsp0_spi_pins {
mux {
pins = "gpio10", "gpio11", "gpio12", "gpio13";
function = "blsp0_spi";
drive-strength = <2>;
bias-disable;
};
};
qspi_nand_pins: qspi_nand_pins {
qspi_clock {
pins = "gpio9";
function = "qspi_clk";
drive-strength = <8>;
bias-disable;
};
qspi_cs {
pins = "gpio8";
function = "qspi_cs";
drive-strength = <8>;
bias-disable;
};
qspi_data {
pins = "gpio4", "gpio5", "gpio6", "gpio7";
function = "qspi_data";
drive-strength = <8>;
bias-disable;
};
};
mdio1_pins: mdio_pinmux {
mux_0 {
pins = "gpio36";
function = "mdc";
drive-strength = <8>;
bias-pull-up;
};
mux_1 {
pins = "gpio37";
function = "mdio";
drive-strength = <8>;
bias-pull-up;
};
};
phy_led_pins: phy_led_pins {
gephy_led_pin {
pins = "gpio46";
function = "led0";
drive-strength = <8>;
bias-pull-down;
};
};
i2c_pins: i2c_pins {
i2c_scl {
pins = "gpio25";
function = "blsp2_i2c1";
drive-strength = <8>;
bias-disable;
};
i2c_sda {
pins = "gpio26";
function = "blsp2_i2c1";
drive-strength = <8>;
bias-disable;
};
};
button_pins: button_pins {
reset_button {
pins = "gpio38";
function = "gpio";
drive-strength = <8>;
bias-pull-up;
};
};
leds_pins: leds_pins {
led_status {
pins = "gpio30";
function = "gpio";
drive-strength = <8>;
bias-pull-down;
};
};
audio_pins: audio_pinmux {
mux_1 {
pins = "gpio24";
function = "audio_rxbclk";
drive-strength = <8>;
bias-pull-down;
};
mux_2 {
pins = "gpio25";
function = "audio_rxfsync";
drive-strength = <8>;
bias-pull-down;
};
mux_3 {
pins = "gpio26";
function = "audio_rxd";
drive-strength = <8>;
bias-pull-down;
};
mux_4 {
pins = "gpio27";
function = "audio_txmclk";
drive-strength = <8>;
bias-pull-down;
};
mux_5 {
pins = "gpio28";
function = "audio_txbclk";
drive-strength = <8>;
bias-pull-down;
};
mux_6 {
pins = "gpio29";
function = "audio_txfsync";
drive-strength = <8>;
bias-pull-down;
};
mux_7 {
pins = "gpio30";
function = "audio_txd";
drive-strength = <8>;
bias-pull-down;
};
};
};
&soc {
gpio_keys {
compatible = "gpio-keys";
pinctrl-0 = <&button_pins>;
pinctrl-names = "default";
reset {
label = "reset";
linux,code = <KEY_RESTART>;
gpios = <&tlmm 38 GPIO_ACTIVE_LOW>;
linux,input-type = <1>;
debounce-interval = <60>;
};
};
};
&q6v5_wcss {
compatible = "qcom,ipq5018-q6-mpd";
#address-cells = <1>;
#size-cells = <1>;
ranges;
firmware = "IPQ5018/q6_fw.mdt";
reg = <0x0cd00000 0x4040>,
<0x1938000 0x8>,
<0x193d204 0x4>;
reg-names = "qdsp6",
"tcsr-msip",
"tcsr-q6";
resets = <&gcc GCC_WCSSAON_RESET>,
<&gcc GCC_WCSS_Q6_BCR>;
reset-names = "wcss_aon_reset",
"wcss_q6_reset";
clocks = <&gcc GCC_Q6_AXIS_CLK>,
<&gcc GCC_WCSS_ECAHB_CLK>,
<&gcc GCC_Q6_AXIM_CLK>,
<&gcc GCC_Q6_AXIM2_CLK>,
<&gcc GCC_Q6_AHB_CLK>,
<&gcc GCC_Q6_AHB_S_CLK>,
<&gcc GCC_WCSS_AXI_S_CLK>;
clock-names = "gcc_q6_axis_clk",
"gcc_wcss_ecahb_clk",
"gcc_q6_axim_clk",
"gcc_q6_axim2_clk",
"gcc_q6_ahb_clk",
"gcc_q6_ahb_s_clk",
"gcc_wcss_axi_s_clk";
#ifdef __IPQ_MEM_PROFILE_256_MB__
memory-region = <&q6_mem_regions>, <&q6_etr_region>;
#else
memory-region = <&q6_mem_regions>, <&q6_etr_region>,
<&q6_caldb_region>;
#endif
qcom,rproc = <&q6v5_wcss>;
qcom,bootargs_smem = <507>;
boot-args = <0x1 0x4 0x3 0x0F 0x0 0x0>,
<0x2 0x4 0x2 0x12 0x0 0x0>;
status = "ok";
q6_wcss_pd1: remoteproc_pd1@4ab000 {
compatible = "qcom,ipq5018-wcss-ahb-mpd";
reg = <0x4ab000 0x20>;
reg-names = "rmb";
firmware = "IPQ5018/q6_fw.mdt";
m3_firmware = "IPQ5018/m3_fw.mdt";
interrupts-extended = <&wcss_smp2p_in 8 0>,
<&wcss_smp2p_in 9 0>,
<&wcss_smp2p_in 12 0>,
<&wcss_smp2p_in 11 0>;
interrupt-names = "fatal",
"ready",
"spawn-ack",
"stop-ack";
resets = <&gcc GCC_WCSSAON_RESET>,
<&gcc GCC_WCSS_BCR>,
<&gcc GCC_CE_BCR>;
reset-names = "wcss_aon_reset",
"wcss_reset",
"ce_reset";
clocks = <&gcc GCC_WCSS_AHB_S_CLK>,
<&gcc GCC_WCSS_ACMT_CLK>,
<&gcc GCC_WCSS_AXI_M_CLK>;
clock-names = "gcc_wcss_ahb_s_clk",
"gcc_wcss_acmt_clk",
"gcc_wcss_axi_m_clk";
qcom,halt-regs = <&tcsr_q6_block 0xa000 0xd000 0x0>;
qcom,smem-states = <&wcss_smp2p_out 8>,
<&wcss_smp2p_out 9>,
<&wcss_smp2p_out 10>;
qcom,smem-state-names = "shutdown",
"stop",
"spawn";
#ifdef __IPQ_MEM_PROFILE_256_MB__
memory-region = <&q6_ipq5018_data>, <&m3_dump>,
<&q6_etr_region>;
#else
memory-region = <&q6_ipq5018_data>, <&m3_dump>,
<&q6_etr_region>, <&q6_caldb_region>;
#endif
};
q6_wcss_pd2: remoteproc_pd2 {
compatible = "qcom,ipq5018-wcss-pcie-mpd";
firmware = "IPQ5018/q6_fw.mdt";
m3_firmware = "qcn6122/m3_fw.mdt";
interrupts-extended = <&wcss_smp2p_in 16 0>,
<&wcss_smp2p_in 17 0>,
<&wcss_smp2p_in 20 0>,
<&wcss_smp2p_in 19 0>;
interrupt-names = "fatal",
"ready",
"spawn-ack",
"stop-ack";
qcom,smem-states = <&wcss_smp2p_out 16>,
<&wcss_smp2p_out 17>,
<&wcss_smp2p_out 18>;
qcom,smem-state-names = "shutdown",
"stop",
"spawn";
#ifdef __IPQ_MEM_PROFILE_256_MB__
memory-region = <&q6_qcn6122_data1>, <&m3_dump_qcn6122_1>,
<&q6_qcn6122_etr_1>;
#else
memory-region = <&q6_qcn6122_data1>, <&m3_dump_qcn6122_1>,
<&q6_qcn6122_etr_1>, <&q6_qcn6122_caldb_1>;
#endif
};
q6_wcss_pd3: remoteproc_pd3 {
compatible = "qcom,ipq5018-wcss-pcie-mpd";
firmware = "IPQ5018/q6_fw.mdt";
interrupts-extended = <&wcss_smp2p_in 24 0>,
<&wcss_smp2p_in 25 0>,
<&wcss_smp2p_in 28 0>,
<&wcss_smp2p_in 27 0>;
interrupt-names = "fatal",
"ready",
"spawn-ack",
"stop-ack";
qcom,smem-states = <&wcss_smp2p_out 24>,
<&wcss_smp2p_out 25>,
<&wcss_smp2p_out 26>;
qcom,smem-state-names = "shutdown",
"stop",
"spawn";
#ifdef __IPQ_MEM_PROFILE_256_MB__
memory-region = <&q6_qcn6122_data2>, <&m3_dump_qcn6122_2>,
<&q6_qcn6122_etr_2>;
#else
memory-region = <&q6_qcn6122_data2>, <&m3_dump_qcn6122_2>,
<&q6_qcn6122_etr_2>, <&q6_qcn6122_caldb_2>;
#endif
};
};
&i2c_0 {
pinctrl-0 = <&i2c_pins>;
pinctrl-names = "default";
};
&wifi0 {
/* IPQ5018 */
qcom,multipd_arch;
qcom,rproc = <&q6_wcss_pd1>;
qcom,userpd-subsys-name = "q6v5_wcss_userpd1";
#ifdef __IPQ_MEM_PROFILE_256_MB__
qcom,tgt-mem-mode = <2>;
#else
qcom,tgt-mem-mode = <1>;
#endif
qcom,board_id = <0x23>;
#ifdef __CNSS2__
qcom,bdf-addr = <0x4C400000 0x4C400000 0x4C400000 0x0 0x0>;
qcom,caldb-addr = <0x4D300000 0x4D300000 0 0 0>;
qcom,caldb-size = <0x200000>;
mem-region = <&q6_ipq5018_data>;
#else
memory-region = <&q6_ipq5018_data>;
#endif
status = "ok";
};
&wifi1 {
/* QCN6122 5G */
qcom,multipd_arch;
qcom,userpd-subsys-name = "q6v5_wcss_userpd2";
qcom,rproc = <&q6_wcss_pd2>;
#ifdef __IPQ_MEM_PROFILE_256_MB__
qcom,tgt-mem-mode = <2>;
#else
qcom,tgt-mem-mode = <1>;
#endif
qcom,board_id = <0x60>;
#ifdef __CNSS2__
qcom,bdf-addr = <0x4D500000 0x4D500000 0x4D300000 0x0 0x0>;
qcom,caldb-addr = <0x4E400000 0x4E400000 0 0 0>;
qcom,caldb-size = <0x500000>;
mem-region = <&q6_qcn6122_data1>;
#else
memory-region = <&q6_qcn6122_data1>;
#endif
status = "ok";
};
&wifi2 {
/* QCN6122 6G */
qcom,multipd_arch;
qcom,userpd-subsys-name = "q6v5_wcss_userpd3";
qcom,rproc = <&q6_wcss_pd3>;
#ifdef __IPQ_MEM_PROFILE_256_MB__
qcom,tgt-mem-mode = <2>;
#else
qcom,tgt-mem-mode = <1>;
#endif
qcom,board_id = <0xb0>;
#ifdef __CNSS2__
qcom,bdf-addr = <0x4E900000 0x4E900000 0x4E200000 0x0 0x0>;
qcom,caldb-addr = <0x4F800000 0x4F800000 0 0 0>;
qcom,caldb-size = <0x500000>;
mem-region = <&q6_qcn6122_data2>;
#else
memory-region = <&q6_qcn6122_data2>;
#endif
status = "disabled";
};
&usb3 {
status = "ok";
device-power-gpio = <&tlmm 24 1>;
};
&dwc_0 {
/delete-property/ #phy-cells;
/delete-property/ phys;
/delete-property/ phy-names;
};
&hs_m31phy_0 {
status = "ok";
};
&eud {
status = "ok";
};
&pcie_x1 {
perst-gpio = <&tlmm 18 GPIO_ACTIVE_LOW>;
};
&pcie_x2 {
perst-gpio = <&tlmm 15 GPIO_ACTIVE_LOW>;
};
&pcie_x1_rp {
status = "disabled";
mhi_0: qcom,mhi@0 {
reg = <0 0 0 0 0 >;
};
};
&pcie_x2_rp {
status = "disabled";
mhi_1: qcom,mhi@1 {
reg = <0 0 0 0 0 >;
};
};

View File

@@ -0,0 +1,915 @@
/dts-v1/;
/* Copyright (c) 2018-2021, The Linux Foundation. All rights reserved.
*
* Copyright (c) 2021 Qualcomm Innovation Center, Inc. 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 "ipq5018.dtsi"
#include <dt-bindings/input/input.h>
/ {
#address-cells = <0x2>;
#size-cells = <0x2>;
model = "Wallys DR5018";
compatible = "wallys,dr5018", "qcom,ipq5018-mp03.5", "qcom,ipq5018";
interrupt-parent = <&intc>;
aliases {
sdhc1 = &sdhc_1; /* SDC1 eMMC slot */
serial0 = &blsp1_uart1;
serial1 = &blsp1_uart2;
ethernet0 = "/soc/dp1";
ethernet1 = "/soc/dp2";
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 = " swiotlb=1 coherent_pool=2M";
stdout-path = "serial0";
};
reserved-memory {
#ifdef __IPQ_MEM_PROFILE_256_MB__
/* 256 MB Profile
* +==========+==============+=========================+
* | | | |
* | Region | Start Offset | Size |
* | | | |
* +----------+--------------+-------------------------+
* | NSS | 0x40000000 | 8MB |
* +----------+--------------+-------------------------+
* | Linux | 0x40800000 | Depends on total memory |
* +----------+--------------+-------------------------+
* | uboot | 0x4A600000 | 4MB |
* +----------+--------------+-------------------------+
* | SBL | 0x4AA00000 | 1MB |
* +----------+--------------+-------------------------+
* | smem | 0x4AB00000 | 1MB |
* +----------+--------------+-------------------------+
* | TZ | 0x4AC00000 | 4MB |
* +----------+--------------+-------------------------+
* | Q6 | | |
* | code/ | 0x4B000000 | 20MB |
* | data | | |
* +----------+--------------+-------------------------+
* | IPQ5018 | | |
* | data | 0x4C400000 | 13MB |
* +----------+--------------+-------------------------+
* | IPQ5018 | | |
* | M3 Dump | 0x4D100000 | 1MB |
* +----------+--------------+-------------------------+
* | IPQ5018 | | |
* | QDSS | 0x4D200000 | 1MB |
* +----------+--------------+-------------------------+
* | QCN6122_1| | |
* | data | 0x4D300000 | 13MB |
* +----------+--------------+-------------------------+
* | QCN6122_1| | |
* | M3 Dump | 0x4E000000 | 1MB |
* +----------+--------------+-------------------------+
* | QCN6122_1| | |
* | QDSS | 0x4E100000 | 1MB |
* +----------+--------------+-------------------------+
* | QCN6122_2| | |
* | data | 0x4E200000 | 13MB |
* +----------+--------------+-------------------------+
* | QCN6122_2| | |
* | M3 Dump | 0x4EF00000 | 1MB |
* +----------+--------------+-------------------------+
* | QCN6122_2| | |
* | QDSS | 0x4F000000 | 1MB |
* +----------+--------------+-------------------------+
* | |
* | Rest of the memory for Linux |
* | |
* +===================================================+
*/
q6_mem_regions: q6_mem_regions@4B000000 {
no-map;
reg = <0x0 0x4B000000 0x0 0x4100000>;
};
q6_code_data: q6_code_data@4B000000 {
no-map;
reg = <0x0 0x4B000000 0x0 0x1400000>;
};
q6_ipq5018_data: q6_ipq5018_data@4C400000 {
no-map;
reg = <0x0 0x4C400000 0x0 0xD00000>;
};
m3_dump: m3_dump@4D100000 {
no-map;
reg = <0x0 0x4D100000 0x0 0x100000>;
};
q6_etr_region: q6_etr_dump@4D200000 {
no-map;
reg = <0x0 0x4D200000 0x0 0x100000>;
};
q6_qcn6122_data1: q6_qcn6122_data1@4D300000 {
no-map;
reg = <0x0 0x4D300000 0x0 0xD00000>;
};
m3_dump_qcn6122_1: m3_dump_qcn6122_1@4E000000 {
no-map;
reg = <0x0 0x4E000000 0x0 0x100000>;
};
q6_qcn6122_etr_1: q6_qcn6122_etr_1@4E100000 {
no-map;
reg = <0x0 0x4E100000 0x0 0x100000>;
};
q6_qcn6122_data2: q6_qcn6122_data2@4E200000 {
no-map;
reg = <0x0 0x4E200000 0x0 0xD00000>;
};
m3_dump_qcn6122_2: m3_dump_qcn6122_2@4EF00000 {
no-map;
reg = <0x0 0x4EF00000 0x0 0x100000>;
};
q6_qcn6122_etr_2: q6_qcn6122_etr_2@4F000000 {
no-map;
reg = <0x0 0x4F000000 0x0 0x100000>;
};
#else
/* 512MB/1GB Profiles
* +==========+==============+=========================+
* | | | |
* | Region | Start Offset | Size |
* | | | |
* +----------+--------------+-------------------------+
* | NSS | 0x40000000 | 16MB |
* +----------+--------------+-------------------------+
* | Linux | 0x41000000 | Depends on total memory |
* +----------+--------------+-------------------------+
* | uboot | 0x4A600000 | 4MB |
* +----------+--------------+-------------------------+
* | SBL | 0x4AA00000 | 1MB |
* +----------+--------------+-------------------------+
* | smem | 0x4AB00000 | 1MB |
* +----------+--------------+-------------------------+
* | TZ | 0x4AC00000 | 4MB |
* +----------+--------------+-------------------------+
* | Q6 | | |
* | code/ | 0x4B000000 | 20MB |
* | data | | |
* +----------+--------------+-------------------------+
* | IPQ5018 | | |
* | data | 0x4C400000 | 13MB |
* +----------+--------------+-------------------------+
* | IPQ5018 | | |
* | M3 Dump | 0x4D100000 | 1MB |
* +----------+--------------+-------------------------+
* | IPQ5018 | | |
* | QDSS | 0x4D200000 | 1MB |
* +----------+--------------+-------------------------+
* | IPQ5018 | | |
* | Caldb | 0x4D300000 | 2MB |
* +----------+--------------+-------------------------+
* | QCN6122_1| | |
* | data | 0x4D500000 | 13MB |
* +----------+--------------+-------------------------+
* | QCN6122_1| | |
* | M3 Dump | 0x4E200000 | 1MB |
* +----------+--------------+-------------------------+
* | QCN6122_1| | |
* | QDSS | 0x4E300000 | 1MB |
* +----------+--------------+-------------------------+
* | QCN6122_1| | |
* | Caldb | 0x4E400000 | 5MB |
* +----------+--------------+-------------------------+
* | QCN6122_2| | |
* | data | 0x4E900000 | 13MB |
* +----------+--------------+-------------------------+
* | QCN6122_2| | |
* | M3 Dump | 0x4F600000 | 1MB |
* +----------+--------------+-------------------------+
* | QCN6122_2| | |
* | QDSS | 0x4F700000 | 1MB |
* +----------+--------------+-------------------------+
* | QCN6122_2| | |
* | Caldb | 0x4F800000 | 5MB |
* +----------+--------------+-------------------------+
* | |
* | Rest of the memory for Linux |
* | |
* +===================================================+
*/
q6_mem_regions: q6_mem_regions@4B000000 {
no-map;
reg = <0x0 0x4B000000 0x0 0x4D00000>;
};
q6_code_data: q6_code_data@4B000000 {
no-map;
reg = <0x0 0x4B000000 0x0 01400000>;
};
q6_ipq5018_data: q6_ipq5018_data@4C400000 {
no-map;
reg = <0x0 0x4C400000 0x0 0xD00000>;
};
m3_dump: m3_dump@4D100000 {
no-map;
reg = <0x0 0x4D100000 0x0 0x100000>;
};
q6_etr_region: q6_etr_dump@4D200000 {
no-map;
reg = <0x0 0x4D200000 0x0 0x100000>;
};
q6_caldb_region: q6_caldb_region@4D300000 {
no-map;
reg = <0x0 0x4D300000 0x0 0x200000>;
};
q6_qcn6122_data1: q6_qcn6122_data1@4D500000 {
no-map;
reg = <0x0 0x4D500000 0x0 0xD00000>;
};
m3_dump_qcn6122_1: m3_dump_qcn6122_1@4E200000 {
no-map;
reg = <0x0 0x4E200000 0x0 0x100000>;
};
q6_qcn6122_etr_1: q6_qcn6122_etr_1@4E300000 {
no-map;
reg = <0x0 0x4E300000 0x0 0x100000>;
};
q6_qcn6122_caldb_1: q6_qcn6122_caldb_1@4E400000 {
no-map;
reg = <0x0 0x4E400000 0x0 0x500000>;
};
q6_qcn6122_data2: q6_qcn6122_data2@4E900000 {
no-map;
reg = <0x0 0x4E900000 0x0 0xD00000>;
};
m3_dump_qcn6122_2: m3_dump_qcn6122_2@4F600000 {
no-map;
reg = <0x0 0x4F600000 0x0 0x100000>;
};
q6_qcn6122_etr_2: q6_qcn6122_etr_2@4F700000 {
no-map;
reg = <0x0 0x4F700000 0x0 0x100000>;
};
q6_qcn6122_caldb_2: q6_qcn6122_caldb_2@4F800000 {
no-map;
reg = <0x0 0x4F800000 0x0 0x500000>;
};
#endif
};
soc {
serial@78af000 {
status = "ok";
};
blsp1_uart2: serial@78b0000 {
pinctrl-0 = <&blsp1_uart_pins>;
pinctrl-names = "default";
status = "ok";
};
qpic_bam: dma@7984000{
status = "ok";
};
nand: qpic-nand@79b0000 {
pinctrl-0 = <&qspi_nand_pins>;
pinctrl-names = "default";
status = "ok";
};
spi_0: spi@78b5000 { /* BLSP1 QUP0 */
pinctrl-0 = <&blsp0_spi_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;
};
};
mdio0: mdio@88000 {
status = "ok";
ethernet-phy@0 {
reg = <7>;
};
};
mdio1: mdio@90000 {
status = "ok";
pinctrl-0 = <&mdio1_pins>;
pinctrl-names = "default";
phy-reset-gpio = <&tlmm 39 0>;
ethernet-phy@0 {
reg = <0>;
};
ethernet-phy@1 {
reg = <1>;
};
ethernet-phy@2 {
reg = <2>;
};
ethernet-phy@3 {
reg = <3>;
};
};
ess-instance {
num_devices = <0x2>;
ess-switch@0x39c00000 {
compatible = "qcom,ess-switch-ipq50xx";
device_id = <0>;
switch_mac_mode = <0xf>; /* mac mode for uniphy instance*/
cmnblk_clk = "internal_96MHz"; /* cmnblk clk*/
qcom,port_phyinfo {
port@0 {
port_id = <1>;
phy_address = <7>;
};
port@1 {
port_id = <2>;
forced-speed = <1000>;
forced-duplex = <1>;
};
};
led_source@0 {
source = <0>;
mode = "normal";
speed = "all";
blink_en = "enable";
active = "high";
};
};
ess-switch1@1 {
compatible = "qcom,ess-switch-qca83xx";
device_id = <1>;
switch_access_mode = "mdio";
mdio-bus = <&mdio1>;
reset_gpio = <&tlmm 0x27 0>;
switch_cpu_bmp = <0x40>; /* cpu port bitmap */
switch_lan_bmp = <0x1e>; /* lan port bitmap */
switch_wan_bmp = <0x0>; /* wan port bitmap */
qca,ar8327-initvals = <
0x00004 0x7600000 /* PAD0_MODE */
0x00008 0x1000000 /* PAD5_MODE */
0x0000c 0x80 /* PAD6_MODE */
0x00010 0x2613a0 /* PORT6 FORCE MODE*/
0x000e4 0xaa545 /* MAC_POWER_SEL */
0x000e0 0xc74164de /* SGMII_CTRL */
0x0007c 0x4e /* PORT0_STATUS */
0x00094 0x4e /* PORT6_STATUS */
>;
qcom,port_phyinfo {
port@0 {
port_id = <1>;
phy_address = <0>;
};
port@1 {
port_id = <2>;
phy_address = <1>;
};
port@2 {
port_id = <3>;
phy_address = <2>;
};
port@3 {
port_id = <4>;
phy_address = <3>;
};
};
};
};
dp1 {
device_type = "network";
compatible = "qcom,nss-dp";
clocks = <&gcc GCC_SNOC_GMAC0_AXI_CLK>;
clock-names = "nss-snoc-gmac-axi-clk";
qcom,id = <1>;
reg = <0x39C00000 0x10000>;
interrupts = <GIC_SPI 101 IRQ_TYPE_LEVEL_HIGH>;
qcom,mactype = <2>;
qcom,link-poll = <1>;
qcom,phy-mdio-addr = <7>;
mdio-bus = <&mdio0>;
local-mac-address = [000000000000];
phy-mode = "sgmii";
qcom,rx-page-mode = <0>;
};
dp2 {
device_type = "network";
compatible = "qcom,nss-dp";
clocks = <&gcc GCC_SNOC_GMAC1_AXI_CLK>;
clock-names = "nss-snoc-gmac-axi-clk";
qcom,id = <2>;
reg = <0x39D00000 0x10000>;
interrupts = <GIC_SPI 109 IRQ_TYPE_LEVEL_HIGH>;
qcom,mactype = <2>;
local-mac-address = [000000000000];
phy-mode = "sgmii";
qcom,rx-page-mode = <0>;
};
nss-macsec1 {
compatible = "qcom,nss-macsec";
phy_addr = <0x1c>;
mdiobus = <&mdio1>;
};
};
qcom,test@0 {
status = "ok";
};
thermal-zones {
status = "ok";
};
};
&tlmm {
pinctrl-0 = <&blsp0_uart_pins &mcu_pins>;
pinctrl-names = "default";
mcu_pins: mcu_pins {
mcu_rst {
pins = "gpio31";
function = "gpio";
drive-strength = <8>;
bias-disable;
output-low;
};
mcu_sbl {
pins = "gpio35";
function = "gpio";
drive-strength = <8>;
bias-disable;
output-low;
};
};
blsp0_uart_pins: uart_pins {
blsp0_uart_rx_tx {
pins = "gpio20", "gpio21";
function = "blsp0_uart0";
bias-disable;
};
};
blsp1_uart_pins: blsp1_uart_pins {
blsp1_uart_rx_tx {
pins = "gpio23", "gpio25", "gpio24", "gpio26";
function = "blsp1_uart2";
bias-disable;
};
};
blsp0_spi_pins: blsp0_spi_pins {
mux {
pins = "gpio10", "gpio11", "gpio12", "gpio13";
function = "blsp0_spi";
drive-strength = <2>;
bias-disable;
};
};
qspi_nand_pins: qspi_nand_pins {
qspi_clock {
pins = "gpio9";
function = "qspi_clk";
drive-strength = <8>;
bias-disable;
};
qspi_cs {
pins = "gpio8";
function = "qspi_cs";
drive-strength = <8>;
bias-disable;
};
qspi_data {
pins = "gpio4", "gpio5", "gpio6", "gpio7";
function = "qspi_data";
drive-strength = <8>;
bias-disable;
};
};
mdio1_pins: mdio_pinmux {
mux_0 {
pins = "gpio36";
function = "mdc";
drive-strength = <8>;
bias-pull-up;
};
mux_1 {
pins = "gpio37";
function = "mdio";
drive-strength = <8>;
bias-pull-up;
};
};
leds_pins: leds_pins {
led_power {
pins = "gpio30";
function = "gpio";
drive-strength = <8>;
bias-pull-down;
};
led_uplink {
pins = "gpio46";
function = "gpio";
drive-strength = <8>;
bias-pull-down;
};
};
i2c_pins: i2c_pins {
i2c_scl {
pins = "gpio33";
function = "blsp2_i2c0";
drive-strength = <8>;
bias-pull-up;
};
i2c_sda {
pins = "gpio34";
function = "blsp2_i2c0";
drive-strength = <8>;
bias-pull-up;
};
};
button_pins: button_pins {
wps_button {
pins = "gpio38";
function = "gpio";
drive-strength = <8>;
bias-pull-up;
};
};
};
&soc {
gpio-export {
compatible = "gpio-export";
#size-cells = <0>;
mcu-bootloader {
gpio-export,name = "mcu-bootloader";
gpio-export,output = <0>;
gpios = <&tlmm 35 GPIO_ACTIVE_LOW>;
};
mcu-enable {
gpio-export,name = "mcu-enable";
gpio-export,output = <0>;
gpios = <&tlmm 31 GPIO_ACTIVE_LOW>;
};
};
gpio_keys {
compatible = "gpio-keys";
pinctrl-0 = <&button_pins>;
pinctrl-names = "default";
wps {
label = "reset";
linux,code = <KEY_RESTART>;
gpios = <&tlmm 32 GPIO_ACTIVE_LOW>;
linux,input-type = <1>;
debounce-interval = <60>;
};
};
leds {
compatible = "gpio-leds";
pinctrl-0 = <&leds_pins>;
pinctrl-names = "default";
led_power: led@30 {
label = "green:power";
gpios = <&tlmm 30 GPIO_ACTIVE_HIGH>;
default-state = "on";
};
led@46 {
label = "green:uplink";
gpios = <&tlmm 46 GPIO_ACTIVE_HIGH>;
default-state = "off";
};
};
};
&q6v5_wcss {
compatible = "qcom,ipq5018-q6-mpd";
#address-cells = <1>;
#size-cells = <1>;
ranges;
firmware = "IPQ5018/q6_fw.mdt";
reg = <0x0cd00000 0x4040>,
<0x1938000 0x8>,
<0x193d204 0x4>;
reg-names = "qdsp6",
"tcsr-msip",
"tcsr-q6";
resets = <&gcc GCC_WCSSAON_RESET>,
<&gcc GCC_WCSS_Q6_BCR>;
reset-names = "wcss_aon_reset",
"wcss_q6_reset";
clocks = <&gcc GCC_Q6_AXIS_CLK>,
<&gcc GCC_WCSS_ECAHB_CLK>,
<&gcc GCC_Q6_AXIM_CLK>,
<&gcc GCC_Q6_AXIM2_CLK>,
<&gcc GCC_Q6_AHB_CLK>,
<&gcc GCC_Q6_AHB_S_CLK>,
<&gcc GCC_WCSS_AXI_S_CLK>;
clock-names = "gcc_q6_axis_clk",
"gcc_wcss_ecahb_clk",
"gcc_q6_axim_clk",
"gcc_q6_axim2_clk",
"gcc_q6_ahb_clk",
"gcc_q6_ahb_s_clk",
"gcc_wcss_axi_s_clk";
#ifdef __IPQ_MEM_PROFILE_256_MB__
memory-region = <&q6_mem_regions>, <&q6_etr_region>;
#else
memory-region = <&q6_mem_regions>, <&q6_etr_region>,
<&q6_caldb_region>;
#endif
qcom,rproc = <&q6v5_wcss>;
qcom,bootargs_smem = <507>;
boot-args = <0x1 0x4 0x3 0x0F 0x0 0x0>,
<0x2 0x4 0x2 0x12 0x0 0x0>;
status = "ok";
q6_wcss_pd1: remoteproc_pd1@4ab000 {
compatible = "qcom,ipq5018-wcss-ahb-mpd";
reg = <0x4ab000 0x20>;
reg-names = "rmb";
firmware = "IPQ5018/q6_fw.mdt";
m3_firmware = "IPQ5018/m3_fw.mdt";
interrupts-extended = <&wcss_smp2p_in 8 0>,
<&wcss_smp2p_in 9 0>,
<&wcss_smp2p_in 12 0>,
<&wcss_smp2p_in 11 0>;
interrupt-names = "fatal",
"ready",
"spawn-ack",
"stop-ack";
resets = <&gcc GCC_WCSSAON_RESET>,
<&gcc GCC_WCSS_BCR>,
<&gcc GCC_CE_BCR>;
reset-names = "wcss_aon_reset",
"wcss_reset",
"ce_reset";
clocks = <&gcc GCC_WCSS_AHB_S_CLK>,
<&gcc GCC_WCSS_ACMT_CLK>,
<&gcc GCC_WCSS_AXI_M_CLK>;
clock-names = "gcc_wcss_ahb_s_clk",
"gcc_wcss_acmt_clk",
"gcc_wcss_axi_m_clk";
qcom,halt-regs = <&tcsr_q6_block 0xa000 0xd000 0x0>;
qcom,smem-states = <&wcss_smp2p_out 8>,
<&wcss_smp2p_out 9>,
<&wcss_smp2p_out 10>;
qcom,smem-state-names = "shutdown",
"stop",
"spawn";
#ifdef __IPQ_MEM_PROFILE_256_MB__
memory-region = <&q6_ipq5018_data>, <&m3_dump>,
<&q6_etr_region>;
#else
memory-region = <&q6_ipq5018_data>, <&m3_dump>,
<&q6_etr_region>, <&q6_caldb_region>;
#endif
};
q6_wcss_pd2: remoteproc_pd2 {
compatible = "qcom,ipq5018-wcss-pcie-mpd";
firmware = "IPQ5018/q6_fw.mdt";
m3_firmware = "qcn6122/m3_fw.mdt";
interrupts-extended = <&wcss_smp2p_in 16 0>,
<&wcss_smp2p_in 17 0>,
<&wcss_smp2p_in 20 0>,
<&wcss_smp2p_in 19 0>;
interrupt-names = "fatal",
"ready",
"spawn-ack",
"stop-ack";
qcom,smem-states = <&wcss_smp2p_out 16>,
<&wcss_smp2p_out 17>,
<&wcss_smp2p_out 18>;
qcom,smem-state-names = "shutdown",
"stop",
"spawn";
#ifdef __IPQ_MEM_PROFILE_256_MB__
memory-region = <&q6_qcn6122_data1>, <&m3_dump_qcn6122_1>,
<&q6_qcn6122_etr_1>;
#else
memory-region = <&q6_qcn6122_data1>, <&m3_dump_qcn6122_1>,
<&q6_qcn6122_etr_1>, <&q6_qcn6122_caldb_1>;
#endif
};
q6_wcss_pd3: remoteproc_pd3 {
compatible = "qcom,ipq5018-wcss-pcie-mpd";
firmware = "IPQ5018/q6_fw.mdt";
interrupts-extended = <&wcss_smp2p_in 24 0>,
<&wcss_smp2p_in 25 0>,
<&wcss_smp2p_in 28 0>,
<&wcss_smp2p_in 27 0>;
interrupt-names = "fatal",
"ready",
"spawn-ack",
"stop-ack";
qcom,smem-states = <&wcss_smp2p_out 24>,
<&wcss_smp2p_out 25>,
<&wcss_smp2p_out 26>;
qcom,smem-state-names = "shutdown",
"stop",
"spawn";
#ifdef __IPQ_MEM_PROFILE_256_MB__
memory-region = <&q6_qcn6122_data2>, <&m3_dump_qcn6122_2>,
<&q6_qcn6122_etr_2>;
#else
memory-region = <&q6_qcn6122_data2>, <&m3_dump_qcn6122_2>,
<&q6_qcn6122_etr_2>, <&q6_qcn6122_caldb_2>;
#endif
};
};
&i2c_0 {
pinctrl-0 = <&i2c_pins>;
pinctrl-names = "default";
};
&wifi0 {
/* IPQ5018 */
qcom,multipd_arch;
qcom,rproc = <&q6_wcss_pd1>;
qcom,userpd-subsys-name = "q6v5_wcss_userpd1";
#ifdef __IPQ_MEM_PROFILE_256_MB__
qcom,tgt-mem-mode = <2>;
#else
qcom,tgt-mem-mode = <1>;
#endif
qcom,board_id = <0x23>;
#ifdef __CNSS2__
qcom,bdf-addr = <0x4C400000 0x4C400000 0x4C400000 0x0 0x0>;
qcom,caldb-addr = <0x4D300000 0x4D300000 0 0 0>;
qcom,caldb-size = <0x200000>;
mem-region = <&q6_ipq5018_data>;
#else
memory-region = <&q6_ipq5018_data>;
#endif
status = "ok";
};
&wifi1 {
/* QCN6122 5G */
qcom,multipd_arch;
qcom,userpd-subsys-name = "q6v5_wcss_userpd2";
qcom,rproc = <&q6_wcss_pd2>;
#ifdef __IPQ_MEM_PROFILE_256_MB__
qcom,tgt-mem-mode = <2>;
#else
qcom,tgt-mem-mode = <1>;
#endif
qcom,board_id = <0x60>;
#ifdef __CNSS2__
qcom,bdf-addr = <0x4D500000 0x4D500000 0x4D300000 0x0 0x0>;
qcom,caldb-addr = <0x4E400000 0x4E400000 0 0 0>;
qcom,caldb-size = <0x500000>;
mem-region = <&q6_qcn6122_data1>;
#else
memory-region = <&q6_qcn6122_data1>;
#endif
status = "disabled";
};
&wifi2 {
/* QCN6122 6G */
qcom,multipd_arch;
qcom,userpd-subsys-name = "q6v5_wcss_userpd3";
qcom,rproc = <&q6_wcss_pd3>;
#ifdef __IPQ_MEM_PROFILE_256_MB__
qcom,tgt-mem-mode = <2>;
#else
qcom,tgt-mem-mode = <1>;
#endif
qcom,board_id = <0xb0>;
#ifdef __CNSS2__
qcom,bdf-addr = <0x4E900000 0x4E900000 0x4E200000 0x0 0x0>;
qcom,caldb-addr = <0x4F800000 0x4F800000 0 0 0>;
qcom,caldb-size = <0x500000>;
mem-region = <&q6_qcn6122_data2>;
#else
memory-region = <&q6_qcn6122_data2>;
#endif
status = "ok";
};
&usb3 {
status = "ok";
device-power-gpio = <&tlmm 24 1>;
};
&dwc_0 {
/delete-property/ #phy-cells;
/delete-property/ phys;
/delete-property/ phy-names;
};
&hs_m31phy_0 {
status = "ok";
};
&eud {
status = "ok";
};
&pcie_x1 {
perst-gpio = <&tlmm 18 GPIO_ACTIVE_LOW>;
};
&pcie_x2 {
perst-gpio = <&tlmm 15 GPIO_ACTIVE_LOW>;
};
&pcie_x1_rp {
status = "disabled";
mhi_0: qcom,mhi@0 {
reg = <0 0 0 0 0 >;
};
};
&pcie_x2_rp {
status = "disabled";
mhi_1: qcom,mhi@1 {
reg = <0 0 0 0 0 >;
};
};

View File

@@ -40,6 +40,28 @@ define Device/cybertan_eww631_b1
endef
TARGET_DEVICES += cybertan_eww631_b1
define Device/sonicfi_rap630c_311g
DEVICE_TITLE := Sonicfi RAP630C-311G
DEVICE_DTS := qcom-ipq5018-rap630c-311g
SUPPORTED_DEVICES := sonicfi,rap630c-311g
DEVICE_PACKAGES := ath11k-wifi-sonicfi-rap630c-311g ath11k-firmware-ipq50xx-spruce ath11k-firmware-qcn6122
DEVICE_DTS_CONFIG := config@mp03.5-c1
IMAGES := sysupgrade.tar nand-factory.bin nand-factory.ubi
IMAGE/nand-factory.ubi := append-ubi
endef
TARGET_DEVICES += sonicfi_rap630c_311g
define Device/sonicfi_rap630w_311g
DEVICE_TITLE := Sonicfi RAP630W-311G
DEVICE_DTS := qcom-ipq5018-rap630w-311g
SUPPORTED_DEVICES := sonicfi,rap630w-311g
DEVICE_PACKAGES := ath11k-wifi-sonicfi-rap630w-311g ath11k-firmware-ipq50xx-spruce ath11k-firmware-qcn6122
DEVICE_DTS_CONFIG := config@mp03.5-c1
IMAGES := sysupgrade.tar nand-factory.bin nand-factory.ubi
IMAGE/nand-factory.ubi := append-ubi
endef
TARGET_DEVICES += sonicfi_rap630w_311g
define Device/edgecore_eap104
DEVICE_TITLE := EdgeCore EAP104
DEVICE_DTS := qcom-ipq5018-eap104
@@ -49,6 +71,24 @@ define Device/edgecore_eap104
endef
TARGET_DEVICES += edgecore_eap104
define Device/udaya_a6_id2
DEVICE_TITLE := Udaya A6 - ID2
DEVICE_DTS := qcom-ipq5018-udaya-a6-id2
SUPPORTED_DEVICES := udaya,a6-id2
DEVICE_PACKAGES := ath11k-wifi-udaya-a6-id2 ath11k-firmware-ipq50xx-spruce ath11k-firmware-qcn6122
DEVICE_DTS_CONFIG := config@mp03.5-c1
endef
TARGET_DEVICES += udaya_a6_id2
define Device/wallys_dr5018
DEVICE_TITLE := Wallys DR5018
DEVICE_DTS := qcom-ipq5018-wallys-dr5018
SUPPORTED_DEVICES := wallys,dr5018
DEVICE_PACKAGES := ath11k-wifi-wallys-dr5018 uboot-envtools ath11k-firmware-ipq50xx-spruce ath11k-firmware-qcn6122
DEVICE_DTS_CONFIG := config@mp03.5-c1
endef
TARGET_DEVICES += wallys_dr5018
define Device/yuncore_fap655
DEVICE_TITLE := Yuncore FAP650
DEVICE_DTS := qcom-ipq5018-yuncore-fap655
@@ -147,3 +187,15 @@ define Device/optimcloud_d60
DEVICE_DTS_CONFIG := config@mp03.1
endef
TARGET_DEVICES += optimcloud_d60
define Device/glinet_b3000
DEVICE_TITLE := GL.iNet B3000
DEVICE_DTS := qcom-ipq5018-gl-b3000
SUPPORTED_DEVICES := glinet,b3000
DEVICE_PACKAGES := ath11k-wifi-gl-b3000 ath11k-firmware-ipq50xx-spruce ath11k-firmware-qcn6122
DEVICE_DTS_CONFIG := config@mp03.5-c1
IMAGES := sysupgrade.tar nand-factory.bin
IMAGE/sysupgrade.tar := sysupgrade-tar | append-metadata
IMAGE/nand-factory.bin := append-ubi | qsdk-ipq-factory-nand
endef
TARGET_DEVICES += glinet_b3000

View File

@@ -0,0 +1,17 @@
Index: linux-5.4.164-qsdk-26349818b464f8c7b52d59ce73579d9f3dd6bd5d/drivers/mtd/nand/raw/nand_ids.c
===================================================================
--- linux-5.4.164-qsdk-26349818b464f8c7b52d59ce73579d9f3dd6bd5d.orig/drivers/mtd/nand/raw/nand_ids.c
+++ linux-5.4.164-qsdk-26349818b464f8c7b52d59ce73579d9f3dd6bd5d/drivers/mtd/nand/raw/nand_ids.c
@@ -86,6 +86,12 @@ struct nand_flash_dev nand_flash_ids[] =
{"GD5F1GQ5REYIH SPI NAND 1G 1.8V",
{ .id = {0xc8, 0x21} },
SZ_2K, SZ_128, SZ_128K, 0, 2, 64, NAND_ECC_INFO(4, SZ_512), 0},
+ {"GD5F1GM7REYIG SPI NAND 1G-BIT",
+ {.id = {0xc8, 0x81}},
+ SZ_2K, SZ_128, SZ_128K, 0, 2, 128, NAND_ECC_INFO(8,SZ_512), 0},
+ {"GD5F2GM7REYIG SPI NAND 2G 8-bit",
+ {.id = {0xc8, 0x82}},
+ SZ_2K, SZ_256, SZ_128K, 0, 2, 128, NAND_ECC_INFO(8,SZ_512), 0},
{"W25N01JW SPI NAND 1.8V 1G-BIT",
{ .id = {0xef, 0xbc} },
SZ_2K, SZ_128, SZ_128K, 0, 2, 64, NAND_ECC_INFO(4, SZ_512), 0},

View File

@@ -13,6 +13,7 @@ cig,wf188n)
ucidef_set_led_netdev "wan" "WAN" "green:wan" "eth0" "tx rx link"
ucidef_set_led_wlan "wlan5g" "WLAN5G" "green:wifi5" "phy0tpt"
ucidef_set_led_wlan "wlan2g" "WLAN2G" "green:wifi2" "phy1tpt"
ucidef_set_led_default "power" "POWER" "green:power" "on"
;;
edgecore,eap101)
ucidef_set_led_wlan "wlan5g" "WLAN5G" "green:wifi5" "phy0tpt"
@@ -20,6 +21,7 @@ edgecore,eap101)
ucidef_set_led_netdev "lan1" "lan1" "green:lan1" "eth1"
ucidef_set_led_netdev "lan2" "lan2" "green:lan2" "eth2"
ucidef_set_led_netdev "poe" "poe" "green:wan" "eth0"
ucidef_set_led_default "power" "POWER" "green:led_pwr" "on"
;;
hfcl,ion4xi|\
hfcl,ion4x|\

View File

@@ -34,6 +34,10 @@ qcom_setup_interfaces()
ucidef_set_interface_lan "eth1"
ucidef_set_interface_wan "eth0"
;;
cig,wf660a)
ucidef_set_interface_wan "eth0"
;;
yuncore,fap650)
ucidef_set_interface_lan "eth3 eth2 eth1 eth0"
ucidef_set_interface_wan "eth4"
@@ -60,7 +64,17 @@ qcom_setup_macs()
lan_mac=$(macaddr_add "$wan_mac" 1)
ucidef_set_network_device_mac eth0 $wan_mac
ucidef_set_network_device_mac eth1 $lan_mac
ucidef_set_label_macaddr $wan_mac
ucidef_set_label_macaddr $wan_mac
;;
cig,wf660a)
mmc_dev=$(find_mtd_chardev "0:APPSBLENV")
[ -z "$mmc_dev" ] && mmc_dev=$(find_mmc_part "0:APPSBLENV")
[ -z "$mmc_dev" ] && return
mac=$(grep BaseMacAddress= $mmc_dev | cut -dx -f2)
[ -z "$mac" ] && return;
wan_mac=$(macaddr_canonicalize $mac)
ucidef_set_network_device_mac eth0 $wan_mac
ip link set eth0 address $wan_mac
;;
yuncore,ax840)
wan_mac=$(cat /sys/class/net/eth1/address)

View File

@@ -36,6 +36,20 @@ ath11k_generate_macs_ion4x() {
echo -ne \\x${wifimac2//:/\\x} >> /lib/firmware/ath11k-macs
}
ath11k_generate_macs_wf660a() {
touch /lib/firmware/ath11k-macs
mmc_dev=$(find_mtd_chardev "0:APPSBLENV")
[ -z "$mmc_dev" ] && mmc_dev=$(find_mmc_part "0:APPSBLENV")
[ -n "$mmc_dev" ] && mac=$(grep BaseMacAddress= $mmc_dev | cut -dx -f2)
eth=$(macaddr_canonicalize $mac)
mac1=$(macaddr_add $eth 1)
mac2=$(macaddr_add $eth 2)
mac3=$(macaddr_add $eth 3)
echo -ne \\x${mac1//:/\\x} >> /lib/firmware/ath11k-macs
echo -ne \\x${mac2//:/\\x} >> /lib/firmware/ath11k-macs
echo -ne \\x${mac3//:/\\x} >> /lib/firmware/ath11k-macs
}
caldata_die() {
echo "caldata: " "$*"
exit 1
@@ -60,6 +74,7 @@ case "$FIRMWARE" in
"ath11k/IPQ6018/hw1.0/caldata.bin")
case "$board" in
cig,wf188n|\
cig,wf660a|\
edgecore,eap101|\
hfcl,ion4xi|\
hfcl,ion4x|\
@@ -97,6 +112,9 @@ ath11k-macs)
cig,wf188n)
ath11k_generate_macs
;;
cig,wf660a)
ath11k_generate_macs_wf660a
;;
esac
;;
ath11k/IPQ6018/hw1.0/board.bin)

View File

@@ -0,0 +1,31 @@
#!/bin/sh
. /lib/functions.sh
board=$(board_name)
case "$board" in
"edgecore,eap101")
ln -s /sys/kernel/debug/ath11k/ipq6018\ hw1.0/mac0/fw_stats/pdev_stats /tmp/pdev_stats_phy0
ln -s /sys/kernel/debug/ath11k/ipq6018\ hw1.0/mac1/fw_stats/pdev_stats /tmp/pdev_stats_phy1
;;
"edgecore,eap102")
ln -s /sys/kernel/debug/ath11k/ipq8074\ hw2.0/mac0/fw_stats/pdev_stats /tmp/pdev_stats_phy0
ln -s /sys/kernel/debug/ath11k/ipq8074\ hw2.0/mac1/fw_stats/pdev_stats /tmp/pdev_stats_phy1
;;
"edgecore,oap101e-6e"|\
"edgecore,oap101-6e")
ln -s /sys/kernel/debug/ath11k/ipq5018\ hw1.0/mac0/fw_stats/pdev_stats /tmp/pdev_stats_phy0
ln -s /sys/kernel/debug/ath11k/qcn6122_1/mac0/fw_stats/pdev_stats /tmp/pdev_stats_phy1
ln -s /sys/kernel/debug/ath11k/qcn6122_2/mac0/fw_stats/pdev_stats /tmp/pdev_stats_phy2
;;
"edgecore,oap101e"|\
"edgecore,oap101")
ln -s /sys/kernel/debug/ath11k/ipq5018\ hw1.0/mac0/fw_stats/pdev_stats /tmp/pdev_stats_phy0
ln -s /sys/kernel/debug/ath11k/qcn6122_1/mac0/fw_stats/pdev_stats /tmp/pdev_stats_phy1
;;
"edgecore,eap104")
ln -s /sys/kernel/debug/ath11k/ipq5018\ hw1.0/mac0/fw_stats/pdev_stats /tmp/pdev_stats_phy0
ln -s /sys/kernel/debug/ath11k/qcn6122_2/mac0/fw_stats/pdev_stats /tmp/pdev_stats_phy1
;;
esac

View File

@@ -49,6 +49,52 @@ do_flash_emmc() {
tar Oxf $tar_file ${board_dir}/$part | dd of=${emmcblock}
}
spi_nor_emmc_do_upgrade_bootconfig() {
local tar_file="$1"
local board_dir=$(tar tf $tar_file | grep -m 1 '^sysupgrade-.*/$')
board_dir=${board_dir%/}
[ -f /proc/boot_info/getbinary_bootconfig ] || {
echo "bootconfig does not exist"
exit
}
CI_ROOTPART="$(cat /proc/boot_info/rootfs/upgradepartition)"
CI_KERNPART="$(cat /proc/boot_info/0:HLOS/upgradepartition)"
[ -n "$CI_KERNPART" -a -n "$CI_ROOTPART" ] || {
echo "kernel or rootfs partition is unknown"
exit
}
local primary="0"
[ "$(cat /proc/boot_info/rootfs/primaryboot)" = "0" ] && primary="1"
echo "$primary" > /proc/boot_info/rootfs/primaryboot 2>/dev/null
echo "$primary" > /proc/boot_info/0:HLOS/primaryboot 2>/dev/null
cp /proc/boot_info/getbinary_bootconfig /tmp/bootconfig
do_flash_emmc $tar_file $CI_KERNPART $board_dir kernel
do_flash_emmc $tar_file $CI_ROOTPART $board_dir root
local emmcblock="$(find_mmc_part "rootfs_data")"
if [ -e "$emmcblock" ]; then
mkfs.ext4 -F "$emmcblock"
fi
for part in "0:BOOTCONFIG" "0:BOOTCONFIG1"; do
local mtdchar=$(echo $(find_mtd_chardev $part) | sed 's/^.\{5\}//')
if [ -n "$mtdchar" ]; then
echo start to update $mtdchar
mtd -qq write /proc/boot_info/getbinary_bootconfig "/dev/${mtdchar}" 2>/dev/null && echo update mtd $mtdchar
else
emmcblock=$(find_mmc_part $part)
echo erase ${emmcblock}
dd if=/dev/zero of=${emmcblock} 2> /dev/null
echo update $emmcblock
dd if=/tmp/bootconfig of=${emmcblock} 2> /dev/null
fi
done
}
emmc_do_upgrade() {
local tar_file="$1"
@@ -67,6 +113,7 @@ platform_check_image() {
local magic_long="$(get_magic_long "$1")"
board=$(board_name)
case $board in
cig,wf660a|\
cig,wf188n|\
cig,wf194c4|\
cig,wf196|\
@@ -95,6 +142,9 @@ platform_do_upgrade() {
board=$(board_name)
case $board in
cig,wf660a)
spi_nor_emmc_do_upgrade_bootconfig $1
;;
cig,wf188n|\
glinet,ax1800|\
glinet,axt1800|\

View File

@@ -0,0 +1,40 @@
// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
/*
* IPQ6018 CP01 board device tree source
*
* Copyright (c) 2019-2021 The Linux Foundation. All rights reserved.
*/
/dts-v1/;
#include "qcom-ipq6018-cp01-cig-wf660a.dtsi"
/ {
model = "Cigtech WF-660a";
compatible = "cig,wf660a", "qcom,ipq6018-ap-cp01-c1", "qcom,ipq6018-ap-cp01", "qcom,ipq6018";
};
&tlmm {
i2c_1_pins: i2c_1_pins {
mux {
pins = "gpio42", "gpio43";
function = "blsp2_i2c";
drive-strength = <8>;
bias-pull-down;
};
};
};
&i2c_1 {
pinctrl-0 = <&i2c_1_pins>;
pinctrl-names = "default";
status = "ok";
};
&sdhc_1 {
status = "ok";
};
&sdhc_2 {
status = "disable";
};

View File

@@ -0,0 +1,475 @@
// SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause)
/*
* IPQ6018 CP01 board device tree source
*
* Copyright (c) 2019-2021 The Linux Foundation. All rights reserved.
*/
/dts-v1/;
#include "ipq6018.dtsi"
#include "ipq6018-cpr-regulator.dtsi"
#include <dt-bindings/input/input.h>
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/pwm/pwm.h>
/ {
compatible = "cig,wf660a", "qcom,ipq6018-ap-cp01", "qcom,ipq6018";
aliases {
serial0 = &blsp1_uart3;
serial1 = &blsp1_uart2;
sdhc1 = &sdhc_1;
/*
* 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";
};
chosen {
stdout-path = "serial0:115200n8";
bootargs-append = " swiotlb=1";
};
};
&blsp1_uart2 {
pinctrl-0 = <&hsuart_pins>;
pinctrl-names = "default";
qca,bt-rfr-fixup;
status = "ok";
};
&blsp1_uart3 {
pinctrl-0 = <&serial_3_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;
};
};
&spi_1 { /* BLSP1 QUP1 */
pinctrl-0 = <&spi_1_pins>;
pinctrl-names = "default";
cs-select = <0>;
quartz-reset-gpio = <&tlmm 79 1>;
status = "disabled";
spidev1: spi@1 {
compatible = "qca,spidev";
reg = <0>;
spi-max-frequency = <24000000>;
};
};
&i2c_0 {
pinctrl-0 = <&i2c_0_pins>;
pinctrl-names = "default";
status = "ok";
};
&tlmm {
i2c_0_pins: i2c_0_pins {
mux {
pins = "gpio69", "gpio70";
function = "blsp1_i2c";
drive-strength = <8>;
bias-pull-down;
};
};
i2c_1_pins: i2c_1_pins {
mux {
pins = "gpio42", "gpio43";
function = "blsp2_i2c";
drive-strength = <8>;
bias-pull-down;
};
};
i2c_4_pins: i2c_4_pins {
mux {
pins = "gpio55", "gpio56";
function = "blsp4_i2c";
drive-strength = <8>;
bias-pull-down;
};
};
spi_0_pins: spi-0-pins {
pins = "gpio38", "gpio39", "gpio40", "gpio41";
function = "blsp0_spi";
drive-strength = <8>;
bias-pull-down;
};
spi_1_pins: spi_1_pins {
mux {
pins = "gpio69", "gpio71", "gpio72";
function = "blsp1_spi";
drive-strength = <8>;
bias-pull-down;
};
spi_cs {
pins = "gpio70";
function = "blsp1_spi";
drive-strength = <8>;
bias-disable;
};
quartz_interrupt {
pins = "gpio78";
function = "gpio";
input;
bias-disable;
};
quartz_reset {
pins = "gpio79";
function = "gpio";
output-low;
bias-disable;
};
};
sd_pins: sd-pinmux {
pins = "gpio62";
function = "sd_card";
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;
};
};
pwm_pins: pwm_pinmux {
mux_1 {
pins = "gpio22";
function = "pwm02";
drive-strength = <8>;
};
mux_2 {
pins = "gpio23";
function = "pwm12";
drive-strength = <8>;
};
mux_3 {
pins = "gpio24";
function = "pwm22";
drive-strength = <8>;
};
};
hsuart_pins: hsuart_pins {
mux {
pins = "gpio71", "gpio72";
function = "blsp1_uart";
drive-strength = <8>;
bias-disable;
};
};
leds_pins: leds_pins {
led_5g {
pins = "gpio35";
function = "gpio";
drive-strength = <8>;
bias-pull-down;
};
led_2g {
pins = "gpio37";
function = "gpio";
drive-strength = <8>;
bias-pull-down;
};
led_usb0 {
pins = "gpio50";
function = "gpio";
drive-strength = <8>;
bias-pull-down;
};
};
btcoex_pins: btcoex_pins {
mux_0 {
pins = "gpio51";
function = "pta1_1";
drive-strength = <6>;
bias-pull-down;
};
mux_1 {
pins = "gpio53";
function = "pta1_0";
drive-strength = <6>;
bias-pull-down;
};
mux_2 {
pins = "gpio52";
function = "pta1_2";
drive-strength = <6>;
bias-pull-down;
};
};
};
&soc {
mdio: mdio@90000 {
pinctrl-0 = <&mdio_pins>;
pinctrl-names = "default";
phy-reset-gpio = <&tlmm 77 0>;
status = "ok";
phy0: ethernet-phy@0 {
reg = <0>;
};
phy1: ethernet-phy@1 {
reg = <1>;
};
phy2: ethernet-phy@2 {
reg = <2>;
};
phy3: ethernet-phy@3 {
reg = <3>;
};
phy4: ethernet-phy@4 {
reg = <0x1c>;
};
};
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 = <28>;
phy-mode = "sgmii";
};
i2c_4: 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 = <100000>;
dmas = <&blsp_dma 21>, <&blsp_dma 20>;
dma-names = "rx", "tx";
pinctrl-0 = <&i2c_4_pins>;
status = "ok";
};
ess-switch@3a000000 {
switch_cpu_bmp = <0x1>; /* cpu port bitmap */
switch_lan_bmp = <0x0>; /* lan port bitmap */
switch_wan_bmp = <0x20>; /* 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@0 {
port_id = <1>;
phy_address = <0>;
};
port@1 {
port_id = <2>;
phy_address = <1>;
};
port@2 {
port_id = <3>;
phy_address = <2>;
};
port@3 {
port_id = <4>;
phy_address = <3>;
};
port@4 {
port_id = <5>;
phy_address = <0x1c>;
port_mac_sel = "QGMAC_PORT";
};
};
};
nss-macsec0 {
compatible = "qcom,nss-macsec";
phy_addr = <0x1c>;
phy_access_mode = <0>;
mdiobus = <&mdio>;
};
pwm {
pinctrl-0 = <&pwm_pins>;
pinctrl-names = "default";
used-pwm-indices = <1>, <1>, <1>, <0>;
dft-pwm-status = <0>, <1>, <0>, <0>;
status = "ok";
};
leds {
compatible = "gpio-leds";
pinctrl-0 = <&leds_pins>;
pinctrl-names = "default";
led@35 {
label = "led_5g";
gpios = <&tlmm 35 GPIO_ACTIVE_HIGH>;
linux,default-trigger = "led_5g";
default-state = "off";
};
led@37 {
label = "led_2g";
gpios = <&tlmm 37 GPIO_ACTIVE_HIGH>;
linux,default-trigger = "led_2g";
default-state = "off";
};
led@50 {
label = "led_usb0";
gpios = <&tlmm 50 GPIO_ACTIVE_HIGH>;
linux,default-trigger = "usb-host";
default-state = "off";
};
};
};
&qpic_bam {
status = "ok";
};
&qpic_nand {
status = "disable";
};
&pcie_phy {
status = "ok";
};
&pcie0 {
#if defined(__CNSS2__)
status = "ok";
#endif
};
&qusb_phy_0 {
status = "ok";
};
&qusb_phy_1 {
status = "ok";
};
&usb2 {
status = "ok";
};
&ssphy_0 {
status = "ok";
};
&usb3 {
status = "ok";
};
&nss_crypto {
status = "ok";
};
&sd_pwrseq {
status = "disable";
};
&ipq6018_l2 {
status = "disable";
};

View File

@@ -2,6 +2,17 @@ KERNEL_LOADADDR := 0x41080000
DEVICE_VARS += CE_TYPE
define Device/cig_wf660a
DEVICE_TITLE := Cigtech WF-660a
DEVICE_DTS := qcom-ipq6018-cig-wf660a
SUPPORTED_DEVICES := cig,wf660a
DEVICE_DTS_CONFIG := config@cp01-c1
DEVICE_PACKAGES := ath11k-wifi-cig-wf660a uboot-env uboot-envtools
IMAGES := sysupgrade.tar mmc-factory.bin
IMAGE/mmc-factory.bin := append-ubi | qsdk-ipq-factory-mmc
endef
TARGET_DEVICES += cig_wf660a
define Device/cig_wf188n
DEVICE_TITLE := Cigtech WF-188n
DEVICE_DTS := qcom-ipq6018-cig-wf188n

View File

@@ -77,6 +77,23 @@ endef
$(eval $(call KernelPackage,usb-dwc3-qcom-internal))
define KernelPackage/diag-char
TITLE:=CHAR DIAG
KCONFIG:= CONFIG_DIAG_MHI=y@ge5.4 \
CONFIG_DIAG_OVER_PCIE=n@ge5.4 \
CONFIG_DIAGFWD_BRIDGE_CODE=y \
CONFIG_DIAG_CHAR=m
DEPENDS:=+kmod-lib-crc-ccitt
FILES:=$(LINUX_DIR)/drivers/char/diag/diagchar.ko
endef
define KernelPackage/diag-char/description
CHAR DIAG
endef
$(eval $(call KernelPackage,diag-char))
define KernelPackage/bootconfig
SUBMENU:=Other modules
TITLE:=Bootconfig partition for failsafe

View File

@@ -17,10 +17,15 @@ edgecore,oap102)
ucidef_set_led_netdev "poe" "poe" "green:wan" "eth0"
ucidef_set_led_wlan "wlan5g" "WLAN5G" "green:wifi5" "phy0tpt"
ucidef_set_led_wlan "wlan2g" "WLAN2G" "green:wifi2" "phy1tpt"
ucidef_set_led_wlan "power" "POWER" "green:power" "default-on"
;;
sonicfi,rap630w-311g|\
cybertan,eww631-b1)
ucidef_set_led_default "power" "POWER" "sys:blue" "on"
;;
cig,wf196)
ucidef_set_led_default "power" "POWER" "green:status" "on"
;;
esac
board_config_flush

View File

@@ -0,0 +1,31 @@
#!/bin/sh
. /lib/functions.sh
board=$(board_name)
case "$board" in
"edgecore,eap101")
ln -s /sys/kernel/debug/ath11k/ipq6018\ hw1.0/mac0/fw_stats/pdev_stats /tmp/pdev_stats_phy0
ln -s /sys/kernel/debug/ath11k/ipq6018\ hw1.0/mac1/fw_stats/pdev_stats /tmp/pdev_stats_phy1
;;
"edgecore,eap102")
ln -s /sys/kernel/debug/ath11k/ipq8074\ hw2.0/mac0/fw_stats/pdev_stats /tmp/pdev_stats_phy0
ln -s /sys/kernel/debug/ath11k/ipq8074\ hw2.0/mac1/fw_stats/pdev_stats /tmp/pdev_stats_phy1
;;
"edgecore,oap101e-6e"|\
"edgecore,oap101-6e")
ln -s /sys/kernel/debug/ath11k/ipq5018\ hw1.0/mac0/fw_stats/pdev_stats /tmp/pdev_stats_phy0
ln -s /sys/kernel/debug/ath11k/qcn6122_1/mac0/fw_stats/pdev_stats /tmp/pdev_stats_phy1
ln -s /sys/kernel/debug/ath11k/qcn6122_2/mac0/fw_stats/pdev_stats /tmp/pdev_stats_phy2
;;
"edgecore,oap101e"|\
"edgecore,oap101")
ln -s /sys/kernel/debug/ath11k/ipq5018\ hw1.0/mac0/fw_stats/pdev_stats /tmp/pdev_stats_phy0
ln -s /sys/kernel/debug/ath11k/qcn6122_1/mac0/fw_stats/pdev_stats /tmp/pdev_stats_phy1
;;
"edgecore,eap104")
ln -s /sys/kernel/debug/ath11k/ipq5018\ hw1.0/mac0/fw_stats/pdev_stats /tmp/pdev_stats_phy0
ln -s /sys/kernel/debug/ath11k/qcn6122_2/mac0/fw_stats/pdev_stats /tmp/pdev_stats_phy1
;;
esac

View File

@@ -28,7 +28,7 @@ drv_mac80211_init_device_config() {
config_add_int beacon_int chanbw frag rts
config_add_int rxantenna txantenna antenna_gain txpower min_tx_power
config_add_int num_global_macaddr
config_add_boolean noscan ht_coex acs_exclude_dfs background_radar
config_add_boolean noscan ht_coex acs_exclude_dfs acs_exclude_6ghz_non_psc background_radar
config_add_array ht_capab
config_add_array channels
config_add_array scan_list
@@ -138,6 +138,11 @@ mac80211_hostapd_setup_base() {
[ -n "$acs_exclude_dfs" ] && [ "$acs_exclude_dfs" -gt 0 ] &&
append base_cfg "acs_exclude_dfs=1" "$N"
[ "$auto_channel" -gt 0 ] && json_get_vars acs_exclude_6ghz_non_psc
[ -n "$acs_exclude_6ghz_non_psc" ] && [ "$acs_exclude_6ghz_non_psc" -gt 0 ] &&
[ "$band" = 6g ] &&
append base_cfg "acs_exclude_6ghz_non_psc=1" "$N"
json_get_vars noscan ht_coex min_tx_power:0 tx_burst
json_get_values ht_capab_list ht_capab
json_get_values channel_list channels

View File

@@ -0,0 +1,38 @@
--- a/drivers/net/wireless/ath/ath11k/peer.c
+++ b/drivers/net/wireless/ath/ath11k/peer.c
@@ -819,8 +819,13 @@ int ath11k_peer_delete(struct ath11k *ar
}
}
#endif
- ath11k_peer_rhash_delete(ar->ab, peer);
+ if (peer->vdev_id == vdev_id)
+ ath11k_peer_rhash_delete(ar->ab, peer);
}
+
+ if (!peer)
+ peer = ath11k_peer_find(ar->ab, vdev_id, addr);
+
spin_unlock_bh(&ar->ab->base_lock);
mutex_unlock(&ar->ab->tbl_mtx_lock);
#ifdef CPTCFG_ATH11K_NSS_SUPPORT
@@ -870,8 +875,18 @@ int ath11k_peer_create(struct ath11k *ar
spin_lock_bh(&ar->ab->base_lock);
peer = ath11k_peer_find_by_addr(ar->ab, param->peer_addr);
if (peer) {
- spin_unlock_bh(&ar->ab->base_lock);
- return -EINVAL;
+ if (peer->vdev_id == param->vdev_id) {
+ spin_unlock_bh(&ar->ab->base_lock);
+ return -EINVAL;
+ }
+
+ /* Assume sta is transitioning to another band.
+ * Remove here the peer from rhash.
+ */
+ mutex_lock(&ar->ab->tbl_mtx_lock);
+ ath11k_peer_rhash_delete(ar->ab, peer);
+ mutex_unlock(&ar->ab->tbl_mtx_lock);
+
}
spin_unlock_bh(&ar->ab->base_lock);

View File

@@ -0,0 +1,30 @@
From f3eaf64231edde8b6553f869cf33ff2b2897be38 Mon Sep 17 00:00:00 2001
From: Venkat Chimata <venkata@shasta.cloud>
Date: Mon, 8 Jul 2024 19:23:34 +0530
Subject: [PATCH] mac80211: Update tx stats correctly in case of AP mode
In the backports driver the tx stats are updated in ieee80211_8023_xmit.
However in AP mode the packets are transmitted in ieee80211_8023_xmit_ap.
ieee80211_8023_xmit is not hit in case of AP mode. Update the stats just
before calling ieee80211_8023_xmit_ap
Signed-off-by: Venkat Chimata <venkata@shasta.cloud>
---
net/mac80211/tx.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index d6181be..9e978f9 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -4526,6 +4526,7 @@ void ieee80211_8023_xmit_ap(struct ieee80211_sub_if_data *sdata,
control.sta = pubsta;
+ ieee80211_tx_stats(dev, skb->len);
drv_tx(local, &control, skb);
if (sta)
--
2.34.1

View File

@@ -0,0 +1,26 @@
--- a/drivers/net/wireless/ath/ath11k/rx_desc.h
+++ b/drivers/net/wireless/ath/ath11k/rx_desc.h
@@ -1375,11 +1375,9 @@ struct hal_rx_desc_ipq8074 {
__le32 mpdu_end_tag;
struct rx_mpdu_end mpdu_end;
u8 rx_padding1[HAL_RX_DESC_PADDING1_BYTES];
-#ifndef CPTCFG_ATH11K_MEM_PROFILE_512M
__le32 hdr_status_tag;
__le32 phy_ppdu_id;
u8 hdr_status[HAL_RX_DESC_HDR_STATUS_LEN];
-#endif
u8 msdu_payload[0];
} __packed;
@@ -1396,11 +1394,9 @@ struct hal_rx_desc_qcn9074 {
__le32 mpdu_end_tag;
struct rx_mpdu_end mpdu_end;
u8 rx_padding1[HAL_RX_DESC_PADDING1_BYTES];
-#ifndef CPTCFG_ATH11K_MEM_PROFILE_512M
__le32 hdr_status_tag;
__le32 phy_ppdu_id;
u8 hdr_status[HAL_RX_DESC_HDR_STATUS_LEN];
-#endif
u8 msdu_payload[0];
} __packed;

View File

@@ -57,9 +57,9 @@ Index: qca-ssdk/src/init/ssdk_init.c
+ entry.fid = fdb_entry.fid;
+
+ if (SW_OK != fal_fdb_entry_del_bymac(0, &entry))
+ printk("failed to delete FDB entry\n");
+ SSDK_INFO("failed to delete FDB entry\n");
+ else
+ printk("deleted %s/%d\n", data, entry.fid);
+ SSDK_INFO("deleted %s/%d\n", data, entry.fid);
+ }
+
+ ret = fal_fdb_entry_extend_getnext(0, &fdb_op, &fdb_entry);

View File

@@ -252,7 +252,7 @@ hostapd_prepare_device_config() {
[ "$maxassoc_ignore_probe" -gt 0 ] && append base_cfg "no_probe_resp_if_max_sta=1" "$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"
[ "$multiple_bssid" -gt 0 ] && append base_cfg "mbssid=$multiple_bssid" "$N"
[ "$ema" -gt 0 ] && append base_cfg "ema=$ema" "$N"
[ "$mlo" -gt 0 ] && append base_cfg "mlo=1" "$N"
[ "$acs_exclude_dfs" -gt 0 ] && append base_cfg "acs_exclude_dfs=$acs_exclude_dfs" "$N"

View File

@@ -1,6 +1,8 @@
#!/bin/sh
. /lib/functions/uci-defaults.sh
. /lib/functions.sh
. /lib/functions/system.sh
ipq53xx_setup_interfaces()
{
@@ -10,7 +12,9 @@ ipq53xx_setup_interfaces()
qcom,ipq9574-ap-al02-c4)
ucidef_set_interfaces_lan_wan "eth1 eth2 eth3 eth4 eth5" "eth0"
;;
cig,wf189|\
cig,wf189)
ucidef_set_interfaces_lan_wan "eth0" "eth1"
;;
edgecore,eap105|\
sercomm,ap72tip)
ucidef_set_interfaces_lan_wan "eth1" "eth0"
@@ -18,9 +22,36 @@ ipq53xx_setup_interfaces()
esac
}
qcom_setup_macs()
{
local board="$1"
case $board in
cig,wf189)
mtd=$(find_mtd_chardev "0:APPSBLENV")
[ -z "$mtd" ] && return;
mac=$(grep BaseMacAddress= $mtd | cut -dx -f2)
[ -z "$mac" ] && return;
wan_mac=$(macaddr_canonicalize $mac)
lan_mac=$(macaddr_add "$wan_mac" 1)
ucidef_set_network_device_mac eth0 $lan_mac
ucidef_set_network_device_mac eth1 $wan_mac
ucidef_set_label_macaddr $wan_mac
;;
*)
wan_mac=$(cat /sys/class/net/eth1/address)
lan_mac=$(macaddr_add "$wan_mac" 1)
;;
esac
[ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" $lan_mac
[ -n "$wan_mac" ] && ucidef_set_interface_macaddr "wan" $wan_mac
[ -n "$wan_mac" ] && ucidef_set_label_macaddr "$wan_mac"
}
board_config_update
board=$(board_name)
ipq53xx_setup_interfaces $board
qcom_setup_macs $board
board_config_flush
exit 0

View File

@@ -0,0 +1,13 @@
#!/bin/sh
. /lib/functions.sh
board=$(board_name)
case "$board" in
"edgecore,eap105")
ln -s /sys/kernel/debug/ath12k/ipq5332\ hw1.0_c000000.wifi/mac0/fw_stats/pdev_stats /tmp/pdev_stats_phy0
ln -s /sys/kernel/debug/ath12k/qcn9274\ hw2.0_0001:01:00.0/mac0/fw_stats/pdev_stats /tmp/pdev_stats_phy1
ln -s /sys/kernel/debug/ath12k/qcn9274\ hw2.0_0001:01:00.0/mac1/fw_stats/pdev_stats /tmp/pdev_stats_phy2
;;
esac

View File

@@ -47,8 +47,8 @@ hostapd_append_wpa_key_mgmt() {
[ "${ieee80211w:-0}" -gt 0 ] && append wpa_key_mgmt "WPA-${auth_type_l}-SHA256"
;;
eap192)
append wpa_key_mgmt "WPA-EAP-SUITE-B-192"
[ "${ieee80211r:-0}" -gt 0 ] && append wpa_key_mgmt "FT-EAP"
[ "${ieee80211r:-0}" -gt 0 ] || append wpa_key_mgmt "WPA-EAP-SUITE-B-192"
[ "${ieee80211r:-0}" -gt 0 ] && append wpa_key_mgmt "FT-EAP-SHA384"
;;
eap-eap2)
append wpa_key_mgmt "WPA-EAP"
@@ -73,6 +73,10 @@ hostapd_append_wpa_key_mgmt() {
owe)
append wpa_key_mgmt "OWE"
;;
psk2-radius)
append wpa_key_mgmt "WPA-PSK"
[ "${ieee80211r:-0}" -gt 0 ] && append wpa_key_mgmt "FT-PSK"
;;
esac
[ "$fils" -gt 0 ] && {
@@ -126,9 +130,30 @@ hostapd_common_add_device_config() {
config_add_boolean multiple_bssid rnr_beacon he_co_locate ema
config_add_boolean afc
config_add_string \
afc_request_version afc_request_id afc_serial_number \
afc_location_type afc_location afc_height afc_height_type
config_add_array afc_cert_ids afc_freq_range afc_op_class
config_add_int \
afc_min_power afc_major_axis afc_minor_axis afc_orientation \
afc_vertical_tolerance
hostapd_add_log_config
}
hostapd_get_list() {
local var="$1"
local field="$2"
local cur __val_list
json_get_values __val_list "$field"
for cur in $__val_list; do
append "$var" "$cur" ","
done
}
hostapd_prepare_device_config() {
local config="$1"
local driver="$2"
@@ -139,7 +164,7 @@ hostapd_prepare_device_config() {
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 \
multiple_bssid he_co_locate rnr_beacon ema acs_exclude_dfs \
maxassoc_ignore_probe
maxassoc_ignore_probe band
hostapd_set_log_options base_cfg
@@ -252,6 +277,45 @@ hostapd_prepare_device_config() {
[ "$multiple_bssid" -gt 0 ] && append base_cfg "multiple_bssid=$multiple_bssid" "$N"
[ "$ema" -gt 0 ] && append base_cfg "ema=$ema" "$N"
[ "$acs_exclude_dfs" -gt 0 ] && append base_cfg "acs_exclude_dfs=$acs_exclude_dfs" "$N"
if [ "$band" = "6g" ]; then
json_get_vars afc he_6ghz_reg_pwr_type
else
afc=0
he_6ghz_reg_pwr_type=
fi
set_default afc 0
[ "$afc" -gt 0 ] && {
for v in afc_request_version afc_request_id afc_serial_number afc_min_power afc_height afc_height_type afc_vertical_tolerance \
afc_major_axis afc_minor_axis afc_orientation; do
json_get_var val $v
append base_cfg "$v=$val" "$N"
done
for v in afc_cert_ids afc_op_class afc_freq_range; do
val=
hostapd_get_list val $v
append base_cfg "$v=$val" "$N"
done
json_get_vars afc_location_type afc_location
case "$afc_location_type" in
ellipse)
append base_cfg "afc_location_type=0" "$N"
append base_cfg "afc_linear_polygon=$afc_location" "$N"
;;
linear_polygon)
append base_cfg "afc_location_type=1" "$N"
append base_cfg "afc_linear_polygon=$afc_location" "$N"
;;
radial_polygon)
append base_cfg "afc_location_type=2" "$N"
append base_cfg "afc_radial_polygon=$afc_location" "$N"
;;
esac
he_6ghz_reg_pwr_type=1
}
[ -n "$he_6ghz_reg_pwr_type" ] && append base_cfg "he_6ghz_reg_pwr_type=$he_6ghz_reg_pwr_type" "$N"
json_get_values opts hostapd_options
for val in $opts; do
@@ -344,8 +408,8 @@ hostapd_common_add_bss_config() {
config_add_string lci civic
config_add_boolean ieee80211r pmk_r1_push ft_psk_generate_local ft_over_ds
config_add_int r0_key_lifetime reassociation_deadline
config_add_string mobility_domain r1_key_holder
config_add_int r0_key_lifetime reassociation_deadline ft_l2_refresh
config_add_string mobility_domain r1_key_holder ft_key
config_add_array r0kh r1kh
config_add_int ieee80211w_max_timeout ieee80211w_retry_timeout
@@ -439,6 +503,7 @@ hostapd_set_psk() {
local ifname="$1"
rm -f /var/run/hostapd-${ifname}.psk
touch /var/run/hostapd-${ifname}.psk
for_each_station hostapd_set_psk_file ${ifname}
}
@@ -602,7 +667,7 @@ append_radius_server() {
set_default dae_port 3799
set_default request_cui 0
[ "$eap_server" -eq 0 ] && {
[ "$eap_server" -eq 0 -a -n "$auth_server" ] && {
append bss_conf "auth_server_addr=$auth_server" "$N"
append bss_conf "auth_server_port=$auth_port" "$N"
append bss_conf "auth_server_shared_secret=$auth_secret" "$N"
@@ -724,8 +789,7 @@ hostapd_set_bss_options() {
[ -n "$wpa_strict_rekey" ] && append bss_conf "wpa_strict_rekey=$wpa_strict_rekey" "$N"
}
set_default nasid "${macaddr//\:}"
append bss_conf "nas_identifier=$nasid" "$N"
[ -n "$nasid" ] && append bss_conf "nas_identifier=$nasid" "$N"
[ -n "$acct_server" ] && {
append bss_conf "acct_server_addr=$acct_server" "$N"
@@ -772,9 +836,7 @@ hostapd_set_bss_options() {
# with WPS enabled, we got to be in unconfigured state.
wps_not_configured=1
vlan_possible=1
[ "$macfilter" = radius ] && {
append_radius_server
}
append_radius_server
;;
psk|sae|psk-sae)
json_get_vars key wpa_psk_file
@@ -793,6 +855,7 @@ hostapd_set_bss_options() {
}
[ "$eapol_version" -ge "1" -a "$eapol_version" -le "2" ] && append bss_conf "eapol_version=$eapol_version" "$N"
append_radius_server
set_default dynamic_vlan 0
vlan_possible=1
wps_possible=1
@@ -925,10 +988,11 @@ hostapd_set_bss_options() {
set_default ieee80211r 0
if [ "$ieee80211r" -gt "0" ]; then
json_get_vars mobility_domain ft_psk_generate_local ft_over_ds reassociation_deadline
json_get_vars mobility_domain ft_psk_generate_local ft_over_ds reassociation_deadline ft_l2_refresh
set_default mobility_domain "$(echo "$ssid" | md5sum | head -c 4)"
set_default ft_over_ds 1
set_default ft_l2_refresh 30
set_default reassociation_deadline 1000
skip_kh_setup=0
@@ -951,9 +1015,10 @@ hostapd_set_bss_options() {
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 "reassociation_deadline=$reassociation_deadline" "$N"
[ -n "$ft_l2_refresh" ] && append bss_conf "ft_l2_refresh=$ft_l2_refresh" "$N"
if [ "$skip_kh_setup" -eq "0" ]; then
json_get_vars r0_key_lifetime r1_key_holder pmk_r1_push
json_get_vars r0_key_lifetime r1_key_holder pmk_r1_push ft_key
json_get_values r0kh r0kh
json_get_values r1kh r1kh
@@ -961,12 +1026,15 @@ hostapd_set_bss_options() {
set_default pmk_r1_push 0
[ -n "$r0kh" -a -n "$r1kh" ] || {
key=`echo -n "$mobility_domain/$auth_secret" | md5sum | awk '{print $1}'`
[ -z "$ft_key" ] && {
key=`echo -n "$mobility_domain/$auth_secret" | md5sum | awk '{print $1}'`
set_default r0kh "ff:ff:ff:ff:ff:ff,*,$key"
set_default r1kh "00:00:00:00:00:00,00:00:00:00:00:00,$key"
set_default r0kh "ff:ff:ff:ff:ff:ff,*,$key"
set_default r1kh "00:00:00:00:00:00,00:00:00:00:00:00,$key"
}
}
[ -n "$ft_key" ] && append bss_conf "ft_key=$ft_key" "$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 "pmk_r1_push=$pmk_r1_push" "$N"

View File

@@ -292,7 +292,7 @@
- wpa_msg(hapd->msg_ctx, MSG_INFO, AP_STA_CONNECTED "%s%s%s%s",
- buf, ip_addr, keyid_buf, dpp_pkhash_buf);
+ hostapd_ubus_notify_authorized(hapd, sta, auth_alg);
+ hostapd_ubus_notify_authorized(hapd, sta);
+ wpa_msg(hapd->msg_ctx, MSG_INFO, AP_STA_CONNECTED "%s%s%s%s%s",
+ buf, ip_addr, keyid_buf, dpp_pkhash_buf, alg_buf);
@@ -458,16 +458,6 @@
}
@@ -352,6 +355,9 @@ void hostapd_handle_radio_measurement(st
mgmt->u.action.u.rrm.action, MAC2STR(mgmt->sa));
switch (mgmt->u.action.u.rrm.action) {
+ case WLAN_RRM_LINK_MEASUREMENT_REPORT:
+ hostapd_ubus_handle_link_measurement(hapd, buf, len);
+ break;
case WLAN_RRM_RADIO_MEASUREMENT_REPORT:
hostapd_handle_radio_msmt_report(hapd, buf, len);
break;
--- a/src/ap/vlan_init.c
+++ b/src/ap/vlan_init.c
@@ -22,6 +22,7 @@

View File

@@ -88,6 +88,14 @@
void hostapd_new_assoc_sta(struct hostapd_data *hapd, struct sta_info *sta,
int reassoc);
void hostapd_interface_deinit_free(struct hostapd_iface *iface);
@@ -732,6 +741,7 @@ hostapd_switch_channel_fallback(struct h
void hostapd_cleanup_cs_params(struct hostapd_data *hapd);
void hostapd_periodic_iface(struct hostapd_iface *iface);
int hostapd_owe_trans_get_info(struct hostapd_data *hapd);
+void hostapd_owe_update_trans(struct hostapd_iface *iface);
void hostapd_ocv_check_csa_sa_query(void *eloop_ctx, void *timeout_ctx);
void hostapd_switch_color(struct hostapd_data *hapd, u64 bitmap);
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
@@ -252,6 +252,8 @@ int hostapd_reload_config(struct hostapd
@@ -107,6 +115,15 @@
hostapd_ubus_free_bss(hapd);
accounting_deinit(hapd);
hostapd_deinit_wpa(hapd);
@@ -538,7 +541,7 @@ void hostapd_free_hapd_data(struct hosta
* Most of the modules that are initialized in hostapd_setup_bss() are
* deinitialized here.
*/
-static void hostapd_cleanup(struct hostapd_data *hapd)
+void hostapd_cleanup(struct hostapd_data *hapd)
{
wpa_printf(MSG_DEBUG, "%s(hapd=%p (%s))", __func__, hapd,
hapd->conf ? hapd->conf->iface : "N/A");
@@ -600,6 +603,7 @@ void hostapd_cleanup_iface_partial(struc
static void hostapd_cleanup_iface(struct hostapd_iface *iface)
{
@@ -123,17 +140,25 @@
return 0;
}
@@ -1211,8 +1216,7 @@ static int hostapd_start_beacon(struct h
@@ -1211,7 +1216,7 @@ static int hostapd_start_beacon(struct h
* initialized. Most of the modules that are initialized here will be
* deinitialized in hostapd_cleanup().
*/
-static int hostapd_setup_bss(struct hostapd_data *hapd, int first,
- bool start_beacon)
+int hostapd_setup_bss(struct hostapd_data *hapd, int first, bool start_beacon)
+int hostapd_setup_bss(struct hostapd_data *hapd, int first,
bool start_beacon)
{
struct hostapd_bss_config *conf = hapd->conf;
u8 ssid[SSID_MAX_LEN + 1];
@@ -2698,7 +2702,7 @@ hostapd_alloc_bss_data(struct hostapd_if
@@ -2237,7 +2242,7 @@ static int hostapd_owe_iface_iter2(struc
#endif /* CONFIG_OWE */
-static void hostapd_owe_update_trans(struct hostapd_iface *iface)
+void hostapd_owe_update_trans(struct hostapd_iface *iface)
{
#ifdef CONFIG_OWE
/* Check whether the enabled BSS can complete OWE transition mode
@@ -2698,7 +2703,7 @@ hostapd_alloc_bss_data(struct hostapd_if
}
@@ -142,7 +167,7 @@
{
if (!hapd)
return;
@@ -3491,7 +3495,8 @@ int hostapd_remove_iface(struct hapd_int
@@ -3491,7 +3496,8 @@ int hostapd_remove_iface(struct hapd_int
hapd_iface = interfaces->iface[i];
if (hapd_iface == NULL)
return -1;
@@ -353,7 +378,7 @@
tb[NL80211_ATTR_CENTER_FREQ1],
tb[NL80211_ATTR_CENTER_FREQ2],
tb[NL80211_ATTR_PUNCT_BITMAP],
+ NULL,
+ NULL,
1);
break;
case NL80211_CMD_DISCONNECT:
@@ -551,3 +576,148 @@
.send_mlme = driver_nl80211_send_mlme,
.get_hw_feature_data = nl80211_get_hw_feature_data,
.sta_add = wpa_driver_nl80211_sta_add,
--- a/src/ap/ieee802_11.c
+++ b/src/ap/ieee802_11.c
@@ -547,11 +547,16 @@ static const char * sae_get_password(str
struct sae_pt **s_pt,
const struct sae_pk **s_pk)
{
+ struct hostapd_bss_config *conf = hapd->conf;
+ struct hostapd_ssid *ssid = &conf->ssid;
+ struct hostapd_sta_wpa_psk_short *psk;
const char *password = NULL;
- struct sae_password_entry *pw;
- struct sae_pt *pt = NULL;
- const struct sae_pk *pk = NULL;
- struct hostapd_sta_wpa_psk_short *psk = NULL;
+ struct sae_password_entry *pw = NULL;
+ struct sae_pt *pt = NULL;
+ const struct sae_pk *pk = NULL;
+
+ if (sta && sta->use_sta_psk)
+ goto use_sta_psk;
for (pw = hapd->conf->sae_passwords; pw; pw = pw->next) {
if (!is_broadcast_ether_addr(pw->peer_addr) &&
@@ -582,6 +587,31 @@ static const char * sae_get_password(str
}
}
+use_sta_psk:
+ if (!password && sta) {
+ for (psk = sta->psk; psk; psk = psk->next) {
+ if (!psk->is_passphrase)
+ continue;
+
+ password = psk->passphrase;
+ if (!sta->use_sta_psk)
+ break;
+
+ if (sta->sae_pt) {
+ pt = sta->sae_pt;
+ break;
+ }
+
+ pt = sae_derive_pt(conf->sae_groups, ssid->ssid,
+ ssid->ssid_len,
+ (const u8 *) password,
+ os_strlen(password),
+ NULL);
+ sta->sae_pt = pt;
+ break;
+ }
+ }
+
if (pw_entry)
*pw_entry = pw;
if (s_pt)
@@ -3105,6 +3135,12 @@ static void handle_auth(struct hostapd_d
goto fail;
}
+ res = hostapd_ucode_sta_auth(hapd, sta);
+ if (res) {
+ resp = res;
+ goto fail;
+ }
+
sta->flags &= ~WLAN_STA_PREAUTH;
ieee802_1x_notify_pre_auth(sta->eapol_sm, 0);
--- a/src/ap/sta_info.c
+++ b/src/ap/sta_info.c
@@ -425,6 +425,9 @@ void ap_free_sta(struct hostapd_data *ha
forced_memzero(sta->last_tk, WPA_TK_MAX_LEN);
#endif /* CONFIG_TESTING_OPTIONS */
+ if (sta->sae_pt)
+ sae_deinit_pt(sta->sae_pt);
+
os_free(sta);
}
@@ -1326,6 +1329,8 @@ void ap_sta_set_authorized(struct hostap
sta->flags &= ~WLAN_STA_AUTHORIZED;
}
+ if (authorized)
+ hostapd_ucode_sta_connected(hapd, sta);
#ifdef CONFIG_P2P
if (hapd->p2p_group == NULL) {
if (sta->p2p_ie != NULL &&
--- a/src/ap/sta_info.h
+++ b/src/ap/sta_info.h
@@ -198,6 +198,9 @@ struct sta_info {
int vlan_id_bound; /* updated by ap_sta_bind_vlan() */
/* PSKs from RADIUS authentication server */
struct hostapd_sta_wpa_psk_short *psk;
+ struct sae_pt *sae_pt;
+ int use_sta_psk;
+ int psk_idx;
char *identity; /* User-Name from RADIUS */
char *radius_cui; /* Chargeable-User-Identity from RADIUS */
--- a/src/ap/wpa_auth_glue.c
+++ b/src/ap/wpa_auth_glue.c
@@ -341,6 +341,7 @@ static const u8 * hostapd_wpa_auth_get_p
struct sta_info *sta = ap_get_sta(hapd, addr);
const u8 *psk;
+ sta->psk_idx = 0;
if (vlan_id)
*vlan_id = 0;
if (psk_len)
@@ -387,13 +388,18 @@ static const u8 * hostapd_wpa_auth_get_p
* returned psk which should not be returned again.
* logic list (all hostapd_get_psk; all sta->psk)
*/
+ if (sta && sta->use_sta_psk)
+ psk = NULL;
if (sta && sta->psk && !psk) {
struct hostapd_sta_wpa_psk_short *pos;
+ int psk_idx;
if (vlan_id)
*vlan_id = 0;
psk = sta->psk->psk;
+ sta->psk_idx = psk_idx = 1;
for (pos = sta->psk; pos; pos = pos->next) {
+ psk_idx++;
if (pos->is_passphrase) {
if (pbkdf2_sha1(pos->passphrase,
hapd->conf->ssid.ssid,
@@ -406,10 +412,14 @@ static const u8 * hostapd_wpa_auth_get_p
pos->is_passphrase = 0;
}
if (pos->psk == prev_psk) {
+ sta->psk_idx = psk_idx;
psk = pos->next ? pos->next->psk : NULL;
break;
}
}
+
+ if (!psk)
+ sta->psk_idx = 0;
}
return psk;
}

View File

@@ -0,0 +1,539 @@
--- a/src/ap/wpa_auth.h
+++ b/src/ap/wpa_auth.h
@@ -16,7 +16,11 @@
struct vlan_description;
struct mld_info;
-
+struct rate_description {
+ u32 rx;
+ u32 tx;
+};
+
#define MAX_OWN_IE_OVERRIDE 256
#ifdef _MSC_VER
@@ -88,6 +92,7 @@ struct ft_rrb_frame {
#define FT_RRB_IDENTITY 15
#define FT_RRB_RADIUS_CUI 16
#define FT_RRB_SESSION_TIMEOUT 17 /* le32 seconds */
+#define FT_RRB_RATE_LIMIT 18
struct ft_rrb_tlv {
le16 type;
@@ -368,6 +373,10 @@ struct wpa_auth_callbacks {
struct vlan_description *vlan);
int (*get_vlan)(void *ctx, const u8 *sta_addr,
struct vlan_description *vlan);
+ int (*set_rate_limit)(void *ctx, const u8 *sta_addr,
+ struct rate_description *rate);
+ int (*get_rate_limit)(void *ctx, const u8 *sta_addr,
+ struct rate_description *rate);
int (*set_identity)(void *ctx, const u8 *sta_addr,
const u8 *identity, size_t identity_len);
size_t (*get_identity)(void *ctx, const u8 *sta_addr, const u8 **buf);
@@ -536,7 +545,7 @@ int wpa_ft_fetch_pmk_r1(struct wpa_authe
struct vlan_description *vlan,
const u8 **identity, size_t *identity_len,
const u8 **radius_cui, size_t *radius_cui_len,
- int *session_timeout);
+ int *session_timeout, struct rate_description *rate);
#endif /* CONFIG_IEEE80211R_AP */
--- a/src/ap/wpa_auth_glue.c
+++ b/src/ap/wpa_auth_glue.c
@@ -1200,6 +1200,40 @@ static int hostapd_wpa_auth_get_vlan(voi
}
+static int hostapd_wpa_auth_set_rate_limit(void *ctx, const u8 *sta_addr,
+ struct rate_description *rate)
+{
+ struct hostapd_data *hapd = ctx;
+ struct sta_info *sta;
+
+ sta = ap_get_sta(hapd, sta_addr);
+ if (!sta || !sta->wpa_sm)
+ return -1;
+
+ memcpy(sta->bandwidth, rate, sizeof(*rate));
+ hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
+ HOSTAPD_LEVEL_INFO, "rate-limit %d %d", sta->bandwidth[0], sta->bandwidth[1]);
+
+ return 0;
+}
+
+
+static int hostapd_wpa_auth_get_rate_limit(void *ctx, const u8 *sta_addr,
+ struct rate_description *rate)
+{
+ struct hostapd_data *hapd = ctx;
+ struct sta_info *sta;
+
+ sta = ap_get_sta(hapd, sta_addr);
+ if (!sta)
+ return -1;
+
+ memcpy(rate, sta->bandwidth, sizeof(*rate));
+
+ return 0;
+}
+
+
static int
hostapd_wpa_auth_set_identity(void *ctx, const u8 *sta_addr,
const u8 *identity, size_t identity_len)
@@ -1640,6 +1674,8 @@ int hostapd_setup_wpa(struct hostapd_dat
.add_tspec = hostapd_wpa_auth_add_tspec,
.set_vlan = hostapd_wpa_auth_set_vlan,
.get_vlan = hostapd_wpa_auth_get_vlan,
+ .set_rate_limit = hostapd_wpa_auth_set_rate_limit,
+ .get_rate_limit = hostapd_wpa_auth_get_rate_limit,
.set_identity = hostapd_wpa_auth_set_identity,
.get_identity = hostapd_wpa_auth_get_identity,
.set_radius_cui = hostapd_wpa_auth_set_radius_cui,
--- a/src/ap/wpa_auth_ft.c
+++ b/src/ap/wpa_auth_ft.c
@@ -379,6 +379,14 @@ static size_t wpa_ft_vlan_len(const stru
return tlv_len;
}
+static size_t wpa_ft_rate_limit_len(const struct rate_description *rate)
+{
+ if (!rate || (!rate->rx && !rate->tx))
+ return 0;
+
+ return (sizeof(struct ft_rrb_tlv) + 8);
+}
+
static size_t wpa_ft_vlan_lin(const struct vlan_description *vlan,
u8 *start, u8 *endpos)
@@ -434,10 +442,48 @@ static size_t wpa_ft_vlan_lin(const stru
}
+static size_t wpa_ft_rate_limit_lin(const struct rate_description *rate,
+ u8 *start, u8 *endpos)
+{
+ size_t tlv_len;
+ int i, len;
+ struct ft_rrb_tlv *hdr;
+ u8 *pos = start;
+
+ if (!rate)
+ return 0;
+
+ tlv_len = 0;
+ if (rate->rx || rate->tx) {
+ tlv_len += sizeof(*hdr);
+ if (start + tlv_len > endpos)
+ return tlv_len;
+ hdr = (struct ft_rrb_tlv *) pos;
+ hdr->type = host_to_le16(FT_RRB_RATE_LIMIT);
+ hdr->len = host_to_le16(2 * sizeof(le32));
+ pos = start + tlv_len;
+
+ tlv_len += sizeof(u32);
+ if (start + tlv_len > endpos)
+ return tlv_len;
+ WPA_PUT_LE32(pos, rate->rx);
+ pos = start + tlv_len;
+ tlv_len += sizeof(u32);
+ if (start + tlv_len > endpos)
+ return tlv_len;
+ WPA_PUT_LE32(pos, rate->tx);
+ pos = start + tlv_len;
+ }
+
+ return tlv_len;
+}
+
+
static int wpa_ft_rrb_lin(const struct tlv_list *tlvs1,
const struct tlv_list *tlvs2,
const struct vlan_description *vlan,
- u8 **plain, size_t *plain_len)
+ u8 **plain, size_t *plain_len,
+ const struct rate_description *rate)
{
u8 *pos, *endpos;
size_t tlv_len;
@@ -445,6 +491,7 @@ static int wpa_ft_rrb_lin(const struct t
tlv_len = wpa_ft_tlv_len(tlvs1);
tlv_len += wpa_ft_tlv_len(tlvs2);
tlv_len += wpa_ft_vlan_len(vlan);
+ tlv_len += wpa_ft_rate_limit_len(rate);
*plain_len = tlv_len;
*plain = os_zalloc(tlv_len);
@@ -458,6 +505,7 @@ static int wpa_ft_rrb_lin(const struct t
pos += wpa_ft_tlv_lin(tlvs1, pos, endpos);
pos += wpa_ft_tlv_lin(tlvs2, pos, endpos);
pos += wpa_ft_vlan_lin(vlan, pos, endpos);
+ pos += wpa_ft_rate_limit_lin(rate, pos, endpos);
/* validity check */
if (pos != endpos) {
@@ -526,7 +574,8 @@ static int wpa_ft_rrb_build(const u8 *ke
const struct tlv_list *tlvs_auth,
const struct vlan_description *vlan,
const u8 *src_addr, u8 type,
- u8 **packet, size_t *packet_len)
+ u8 **packet, size_t *packet_len,
+ const struct rate_description *rate)
{
u8 *plain = NULL, *auth = NULL, *pos, *tmp;
size_t plain_len = 0, auth_len = 0;
@@ -534,10 +583,10 @@ static int wpa_ft_rrb_build(const u8 *ke
size_t pad_len = 0;
*packet = NULL;
- if (wpa_ft_rrb_lin(tlvs_enc0, tlvs_enc1, vlan, &plain, &plain_len) < 0)
+ if (wpa_ft_rrb_lin(tlvs_enc0, tlvs_enc1, vlan, &plain, &plain_len, rate) < 0)
goto out;
- if (wpa_ft_rrb_lin(tlvs_auth, NULL, NULL, &auth, &auth_len) < 0)
+ if (wpa_ft_rrb_lin(tlvs_auth, NULL, NULL, &auth, &auth_len, NULL) < 0)
goto out;
*packet_len = sizeof(u16) + auth_len + plain_len;
@@ -700,6 +749,24 @@ static int wpa_ft_get_vlan(struct wpa_au
}
+static int wpa_ft_get_rate_limit(struct wpa_authenticator *wpa_auth,
+ const u8 *sta_addr, struct rate_description *rate)
+{
+ if (!wpa_auth->cb->get_rate_limit)
+ return -1;
+ return wpa_auth->cb->get_rate_limit(wpa_auth->cb_ctx, sta_addr, rate);
+}
+
+
+static int wpa_ft_set_rate_limit(struct wpa_authenticator *wpa_auth,
+ const u8 *sta_addr, struct rate_description *rate)
+{
+ if (!wpa_auth->cb->set_rate_limit)
+ return -1;
+ return wpa_auth->cb->set_rate_limit(wpa_auth->cb_ctx, sta_addr, rate);
+}
+
+
static int
wpa_ft_set_identity(struct wpa_authenticator *wpa_auth, const u8 *sta_addr,
const u8 *identity, size_t identity_len)
@@ -1025,7 +1092,7 @@ wpa_ft_rrb_seq_req(struct wpa_authentica
if (wpa_ft_rrb_build(key, key_len, NULL, NULL, seq_req_auth, NULL,
wpa_auth->addr, FT_PACKET_R0KH_R1KH_SEQ_REQ,
- &packet, &packet_len) < 0) {
+ &packet, &packet_len, NULL) < 0) {
item = NULL; /* some other seq resp might still accept this */
goto err;
}
@@ -1208,6 +1275,7 @@ struct wpa_ft_pmk_r0_sa {
u8 spa[ETH_ALEN];
int pairwise; /* Pairwise cipher suite, WPA_CIPHER_* */
struct vlan_description *vlan;
+ struct rate_description *rate;
os_time_t expiration; /* 0 for no expiration */
u8 *identity;
size_t identity_len;
@@ -1226,6 +1294,7 @@ struct wpa_ft_pmk_r1_sa {
u8 spa[ETH_ALEN];
int pairwise; /* Pairwise cipher suite, WPA_CIPHER_* */
struct vlan_description *vlan;
+ struct rate_description *rate;
u8 *identity;
size_t identity_len;
u8 *radius_cui;
@@ -1254,6 +1323,7 @@ static void wpa_ft_free_pmk_r0(struct wp
os_memset(r0->pmk_r0, 0, PMK_LEN_MAX);
os_free(r0->vlan);
+ os_free(r0->rate);
os_free(r0->identity);
os_free(r0->radius_cui);
os_free(r0);
@@ -1307,6 +1377,7 @@ static void wpa_ft_free_pmk_r1(struct wp
eloop_cancel_timeout(wpa_ft_expire_pmk_r1, r1, NULL);
os_memset(r1->pmk_r1, 0, PMK_LEN_MAX);
+ os_free(r1->rate);
os_free(r1->vlan);
os_free(r1->identity);
os_free(r1->radius_cui);
@@ -1360,7 +1431,8 @@ static int wpa_ft_store_pmk_r0(struct wp
const struct vlan_description *vlan,
int expires_in, int session_timeout,
const u8 *identity, size_t identity_len,
- const u8 *radius_cui, size_t radius_cui_len)
+ const u8 *radius_cui, size_t radius_cui_len,
+ struct rate_description *rate)
{
struct wpa_ft_pmk_cache *cache = wpa_auth->ft_pmk_cache;
struct wpa_ft_pmk_r0_sa *r0;
@@ -1388,6 +1460,14 @@ static int wpa_ft_store_pmk_r0(struct wp
}
*r0->vlan = *vlan;
}
+ if (rate) {
+ r0->rate = os_zalloc(sizeof(*rate));
+ if (!r0->rate) {
+ bin_clear_free(r0, sizeof(*r0));
+ return -1;
+ }
+ *r0->rate = *rate;
+ }
if (identity) {
r0->identity = os_malloc(identity_len);
if (r0->identity) {
@@ -1447,7 +1527,8 @@ static int wpa_ft_store_pmk_r1(struct wp
const struct vlan_description *vlan,
int expires_in, int session_timeout,
const u8 *identity, size_t identity_len,
- const u8 *radius_cui, size_t radius_cui_len)
+ const u8 *radius_cui, size_t radius_cui_len,
+ struct rate_description *rate)
{
struct wpa_ft_pmk_cache *cache = wpa_auth->ft_pmk_cache;
int max_expires_in = wpa_auth->conf.r1_max_key_lifetime;
@@ -1477,6 +1558,14 @@ static int wpa_ft_store_pmk_r1(struct wp
}
*r1->vlan = *vlan;
}
+ if (rate) {
+ r1->rate = os_zalloc(sizeof(*rate));
+ if (!r1->rate) {
+ bin_clear_free(r1, sizeof(*r1));
+ return -1;
+ }
+ *r1->rate = *rate;
+ }
if (identity) {
r1->identity = os_malloc(identity_len);
if (r1->identity) {
@@ -1513,7 +1602,7 @@ int wpa_ft_fetch_pmk_r1(struct wpa_authe
struct vlan_description *vlan,
const u8 **identity, size_t *identity_len,
const u8 **radius_cui, size_t *radius_cui_len,
- int *session_timeout)
+ int *session_timeout, struct rate_description *rate)
{
struct wpa_ft_pmk_cache *cache = wpa_auth->ft_pmk_cache;
struct wpa_ft_pmk_r1_sa *r1;
@@ -1533,6 +1622,12 @@ int wpa_ft_fetch_pmk_r1(struct wpa_authe
*vlan = *r1->vlan;
if (vlan && !r1->vlan)
os_memset(vlan, 0, sizeof(*vlan));
+ if (rate) {
+ if (r1->rate)
+ *rate = *r1->rate;
+ else
+ memset(rate, 0, sizeof(*rate));
+ }
if (identity && identity_len) {
*identity = r1->identity;
*identity_len = r1->identity_len;
@@ -2059,7 +2154,7 @@ static int wpa_ft_pull_pmk_r1(struct wpa
if (wpa_ft_rrb_build(key, key_len, req_enc, NULL, req_auth, NULL,
sm->wpa_auth->addr, FT_PACKET_R0KH_R1KH_PULL,
- &packet, &packet_len) < 0)
+ &packet, &packet_len, NULL) < 0)
return -1;
ft_pending_req_ies = wpabuf_alloc_copy(ies, ies_len);
@@ -2088,6 +2183,7 @@ int wpa_ft_store_pmk_fils(struct wpa_sta
{
int expires_in = sm->wpa_auth->conf.r0_key_lifetime;
struct vlan_description vlan;
+ struct rate_description rate;
const u8 *identity, *radius_cui;
size_t identity_len, radius_cui_len;
int session_timeout;
@@ -2099,6 +2195,7 @@ int wpa_ft_store_pmk_fils(struct wpa_sta
MAC2STR(sm->addr));
return -1;
}
+ wpa_ft_get_rate_limit(sm->wpa_auth, sm->addr, &rate);
identity_len = wpa_ft_get_identity(sm->wpa_auth, sm->addr, &identity);
radius_cui_len = wpa_ft_get_radius_cui(sm->wpa_auth, sm->addr,
@@ -2108,7 +2205,7 @@ int wpa_ft_store_pmk_fils(struct wpa_sta
return wpa_ft_store_pmk_r0(sm->wpa_auth, sm->addr, pmk_r0, pmk_r0_len,
pmk_r0_name, sm->pairwise, &vlan, expires_in,
session_timeout, identity, identity_len,
- radius_cui, radius_cui_len);
+ radius_cui, radius_cui_len, &rate);
}
@@ -2172,6 +2269,7 @@ void wpa_auth_ft_store_keys(struct wpa_s
int psk_local = sm->wpa_auth->conf.ft_psk_generate_local;
int expires_in = sm->wpa_auth->conf.r0_key_lifetime;
struct vlan_description vlan;
+ struct rate_description rate;
const u8 *identity, *radius_cui;
size_t identity_len, radius_cui_len;
int session_timeout;
@@ -2185,6 +2283,8 @@ void wpa_auth_ft_store_keys(struct wpa_s
return;
}
+ wpa_ft_get_rate_limit(sm->wpa_auth, sm->addr, &rate);
+
identity_len = wpa_ft_get_identity(sm->wpa_auth, sm->addr, &identity);
radius_cui_len = wpa_ft_get_radius_cui(sm->wpa_auth, sm->addr,
&radius_cui);
@@ -2195,11 +2295,12 @@ void wpa_auth_ft_store_keys(struct wpa_s
pmk_r0_name,
sm->pairwise, &vlan, expires_in,
session_timeout, identity, identity_len,
- radius_cui, radius_cui_len);
+ radius_cui, radius_cui_len, &rate);
wpa_ft_store_pmk_r1(sm->wpa_auth, sm->addr, pmk_r1, key_len,
sm->pmk_r1_name, sm->pairwise, &vlan,
expires_in, session_timeout, identity,
- identity_len, radius_cui, radius_cui_len);
+ identity_len, radius_cui, radius_cui_len,
+ &rate);
}
@@ -3100,7 +3201,8 @@ static int wpa_ft_local_derive_pmk_r1(st
const u8 **radius_cui,
size_t *radius_cui_len,
int *out_session_timeout,
- size_t *pmk_r1_len)
+ size_t *pmk_r1_len,
+ struct rate_description *rate)
{
struct wpa_auth_config *conf = &wpa_auth->conf;
const struct wpa_ft_pmk_r0_sa *r0;
@@ -3136,7 +3238,8 @@ static int wpa_ft_local_derive_pmk_r1(st
out_pmk_r1_name,
sm->pairwise, r0->vlan, expires_in, session_timeout,
r0->identity, r0->identity_len,
- r0->radius_cui, r0->radius_cui_len);
+ r0->radius_cui, r0->radius_cui_len,
+ r0->rate);
*out_pairwise = sm->pairwise;
if (vlan) {
@@ -3146,6 +3249,13 @@ static int wpa_ft_local_derive_pmk_r1(st
os_memset(vlan, 0, sizeof(*vlan));
}
+ if (rate) {
+ if (r0->rate)
+ *rate = *r0->rate;
+ else
+ os_memset(rate, 0, sizeof(*rate));
+ }
+
if (identity && identity_len) {
*identity = r0->identity;
*identity_len = r0->identity_len;
@@ -3178,6 +3288,7 @@ static int wpa_ft_process_auth_req(struc
u8 *pos, *end;
int pairwise, session_timeout = 0;
struct vlan_description vlan;
+ struct rate_description rate = {};
const u8 *identity, *radius_cui;
size_t identity_len = 0, radius_cui_len = 0;
size_t pmk_r1_len, kdk_len, len;
@@ -3274,7 +3385,7 @@ static int wpa_ft_process_auth_req(struc
pmk_r1, &pmk_r1_len, &pairwise, &vlan,
&identity, &identity_len, &radius_cui,
&radius_cui_len,
- &session_timeout) == 0) {
+ &session_timeout, &rate) == 0) {
wpa_printf(MSG_DEBUG,
"FT: Found PMKR1Name (using SHA%zu) from local cache",
pmk_r1_len * 8);
@@ -3290,7 +3401,7 @@ static int wpa_ft_process_auth_req(struc
pmk_r1_name, pmk_r1, &pairwise,
&vlan, &identity, &identity_len,
&radius_cui, &radius_cui_len,
- &session_timeout, &pmk_r1_len) == 0) {
+ &session_timeout, &pmk_r1_len, &rate) == 0) {
wpa_printf(MSG_DEBUG,
"FT: Generated PMK-R1 based on local PMK-R0");
goto pmk_r1_derived;
@@ -3392,6 +3503,7 @@ pmk_r1_derived:
wpa_printf(MSG_DEBUG, "FT: Failed to configure VLAN");
goto out;
}
+ wpa_ft_set_rate_limit(sm->wpa_auth, sm->addr, &rate);
if (wpa_ft_set_identity(sm->wpa_auth, sm->addr,
identity, identity_len) < 0 ||
wpa_ft_set_radius_cui(sm->wpa_auth, sm->addr,
@@ -3973,7 +4085,7 @@ static int wpa_ft_rrb_build_r0(const u8
ret = wpa_ft_rrb_build(key, key_len, tlvs, sess_tlv, tlv_auth,
pmk_r0->vlan, src_addr, type,
- packet, packet_len);
+ packet, packet_len, pmk_r0->rate);
forced_memzero(pmk_r1, sizeof(pmk_r1));
@@ -4113,7 +4225,7 @@ static int wpa_ft_rrb_rx_pull(struct wpa
ret = wpa_ft_rrb_build(key, key_len, resp, NULL, resp_auth,
NULL, wpa_auth->addr,
FT_PACKET_R0KH_R1KH_RESP,
- &packet, &packet_len);
+ &packet, &packet_len, NULL);
} else {
ret = wpa_ft_rrb_build_r0(key, key_len, resp, r0, f_r1kh_id,
f_s1kh_id, resp_auth, wpa_auth->addr,
@@ -4165,11 +4277,15 @@ static int wpa_ft_rrb_rx_r1(struct wpa_a
size_t f_expires_in_len;
size_t f_identity_len, f_radius_cui_len;
size_t f_session_timeout_len;
+ size_t f_rate_len;
+ const u8 *f_rate;
int pairwise;
int ret = -1;
int expires_in;
int session_timeout;
struct vlan_description vlan;
+ struct rate_description rate;
+ int has_rate = 0;
size_t pmk_r1_len;
RRB_GET_AUTH(FT_RRB_R0KH_ID, r0kh_id, msgtype, -1);
@@ -4279,6 +4395,13 @@ static int wpa_ft_rrb_rx_r1(struct wpa_a
wpa_printf(MSG_DEBUG, "FT: vlan %d%s",
le_to_host16(vlan.untagged), vlan.tagged[0] ? "+" : "");
+ RRB_GET_OPTIONAL(FT_RRB_RATE_LIMIT, rate, msgtype, 2 * sizeof(le32));
+ if (f_rate) {
+ memcpy(&rate, f_rate, sizeof(rate));
+ rate.rx = le_to_host32(rate.rx);
+ rate.tx = le_to_host32(rate.tx);
+ has_rate = 1;
+ };
RRB_GET_OPTIONAL(FT_RRB_IDENTITY, identity, msgtype, -1);
if (f_identity)
wpa_hexdump_ascii(MSG_DEBUG, "FT: Identity", f_identity,
@@ -4301,7 +4424,7 @@ static int wpa_ft_rrb_rx_r1(struct wpa_a
f_pmk_r1_name,
pairwise, &vlan, expires_in, session_timeout,
f_identity, f_identity_len, f_radius_cui,
- f_radius_cui_len) < 0)
+ f_radius_cui_len, has_rate ? &rate : 0) < 0)
goto out;
ret = 0;
@@ -4614,7 +4737,7 @@ static int wpa_ft_rrb_rx_seq_req(struct
if (wpa_ft_rrb_build(key, key_len, NULL, NULL, seq_resp_auth, NULL,
wpa_auth->addr, FT_PACKET_R0KH_R1KH_SEQ_RESP,
- &packet, &packet_len) < 0)
+ &packet, &packet_len, NULL) < 0)
goto out;
wpa_ft_rrb_oui_send(wpa_auth, src_addr,

View File

@@ -0,0 +1,10 @@
--- a/src/ap/wpa_auth_i.h
+++ b/src/ap/wpa_auth_i.h
@@ -54,6 +54,7 @@ struct wpa_state_machine {
bool MICVerified;
bool GUpdateStationKeys;
u8 ANonce[WPA_NONCE_LEN];
+ struct os_reltime ANonce_time;
u8 SNonce[WPA_NONCE_LEN];
u8 alt_SNonce[WPA_NONCE_LEN];
u8 alt_replay_counter[WPA_REPLAY_COUNTER_LEN];

View File

@@ -0,0 +1,147 @@
--- a/src/ap/ieee802_11.c
+++ b/src/ap/ieee802_11.c
@@ -522,6 +522,7 @@ static void handle_auth_ft_finish(void *
hostapd_logger(hapd, dst, HOSTAPD_MODULE_IEEE80211,
HOSTAPD_LEVEL_DEBUG, "authentication OK (FT)");
+ hostapd_ubus_notify(hapd, "ft-finish", sta->addr);
sta->flags |= WLAN_STA_AUTH;
mlme_authenticate_indication(hapd, sta);
}
@@ -5273,6 +5274,8 @@ static void handle_assoc(struct hostapd_
}
sta = ap_get_sta(hapd, mgmt->sa);
+ if (sta && reassoc)
+ memcpy(sta->origin_ap, mgmt->u.reassoc_req.current_ap, 6);
#ifdef CONFIG_IEEE80211R_AP
if (sta && sta->auth_alg == WLAN_AUTH_FT &&
(sta->flags & WLAN_STA_AUTH) == 0) {
@@ -5426,6 +5429,7 @@ static void handle_assoc(struct hostapd_
.type = HOSTAPD_UBUS_ASSOC_REQ,
.mgmt_frame = mgmt,
.ssi_signal = rssi,
+ .reassoc = reassoc,
};
/* followed by SSID and Supported rates; and HT capabilities if 802.11n
@@ -6496,7 +6500,7 @@ static void handle_assoc_cb(struct hosta
* Open, static WEP, FT protocol, or FILS; no separate
* authorization step.
*/
- ap_sta_set_authorized(hapd, sta, 1);
+ _ap_sta_set_authorized(hapd, sta, 1, reassoc);
}
if (reassoc)
--- a/src/ap/ubus.c
+++ b/src/ap/ubus.c
@@ -1870,6 +1870,8 @@ int hostapd_ubus_handle_event(struct hos
if (req->ssi_signal)
blobmsg_add_u32(&b, "signal", req->ssi_signal);
blobmsg_add_u32(&b, "freq", hapd->iface->freq);
+ if (req->reassoc && req->mgmt_frame)
+ blobmsg_add_macaddr(&b, "origin", req->mgmt_frame->u.reassoc_req.current_ap);
if (req->elems) {
if(req->elems->ht_capabilities)
@@ -1940,6 +1942,7 @@ void hostapd_ubus_notify(struct hostapd_
blob_buf_init(&b, 0);
blobmsg_add_macaddr(&b, "address", addr);
blobmsg_add_string(&b, "ifname", hapd->conf->iface);
+ blobmsg_printf(&b, "target", MACSTR, MAC2STR(hapd->conf->bssid));
ubus_notify(ctx, &hapd->ubus.obj, type, b.head, -1);
}
@@ -1958,7 +1961,7 @@ void hostapd_ubus_notify_csa(struct host
}
-void hostapd_ubus_notify_authorized(struct hostapd_data *hapd, struct sta_info *sta)
+void hostapd_ubus_notify_authorized(struct hostapd_data *hapd, struct sta_info *sta, int reassoc)
{
if (!hapd->ubus.obj.has_subscribers)
return;
@@ -1975,6 +1978,9 @@ void hostapd_ubus_notify_authorized(stru
blobmsg_add_u32(&b, "", sta->bandwidth[1]);
blobmsg_close_array(&b, r);
}
+ if (reassoc)
+ blobmsg_add_macaddr(&b, "origin", sta->origin_ap);
+ blobmsg_printf(&b, "target", MACSTR, MAC2STR(hapd->conf->bssid));
ubus_notify(ctx, &hapd->ubus.obj, "sta-authorized", b.head, -1);
}
--- a/src/ap/ubus.h
+++ b/src/ap/ubus.h
@@ -22,6 +22,7 @@ struct hostapd_ubus_request {
const struct ieee802_11_elems *elems;
int ssi_signal; /* dBm */
const u8 *addr;
+ int reassoc;
};
struct hostapd_iface;
@@ -49,7 +50,7 @@ void hostapd_ubus_remove_vlan(struct hos
int hostapd_ubus_handle_event(struct hostapd_data *hapd, struct hostapd_ubus_request *req);
void hostapd_ubus_notify(struct hostapd_data *hapd, const char *type, const u8 *mac);
-void hostapd_ubus_notify_authorized(struct hostapd_data *hapd, struct sta_info *sta);
+void hostapd_ubus_notify_authorized(struct hostapd_data *hapd, struct sta_info *sta, int reassoc);
void hostapd_ubus_notify_beacon_report(struct hostapd_data *hapd,
const u8 *addr, u8 token, u8 rep_mode,
struct rrm_measurement_beacon_report *rep,
--- a/src/ap/sta_info.c
+++ b/src/ap/sta_info.c
@@ -1297,8 +1297,8 @@ const u8 * ap_sta_wpa_get_dpp_pkhash(str
}
-void ap_sta_set_authorized(struct hostapd_data *hapd, struct sta_info *sta,
- int authorized)
+void _ap_sta_set_authorized(struct hostapd_data *hapd, struct sta_info *sta,
+ int authorized, int reassoc)
{
const u8 *dev_addr = NULL;
char buf[100];
@@ -1404,7 +1404,7 @@ void ap_sta_set_authorized(struct hostap
dpp_pkhash, SHA256_MAC_LEN);
}
- hostapd_ubus_notify_authorized(hapd, sta);
+ hostapd_ubus_notify_authorized(hapd, sta, reassoc);
wpa_msg(hapd->msg_ctx, MSG_INFO, AP_STA_CONNECTED "%s%s%s%s%s",
buf, ip_addr, keyid_buf, dpp_pkhash_buf, alg_buf);
@@ -1434,6 +1434,11 @@ void ap_sta_set_authorized(struct hostap
}
#endif /* CONFIG_FST */
}
+void ap_sta_set_authorized(struct hostapd_data *hapd, struct sta_info *sta,
+ int authorized)
+{
+ _ap_sta_set_authorized(hapd, sta, authorized, 0);
+}
void ap_sta_disconnect(struct hostapd_data *hapd, struct sta_info *sta,
--- a/src/ap/sta_info.h
+++ b/src/ap/sta_info.h
@@ -102,6 +102,7 @@ struct sta_info {
struct sta_info *next; /* next entry in sta list */
struct sta_info *hnext; /* next entry in hash table list */
u8 addr[6];
+ u8 origin_ap[6];
be32 ipaddr;
struct dl_list ip6addr; /* list head for struct ip6addr */
u16 aid; /* STA's unique AID (1 .. 2007) or 0 if not yet assigned */
@@ -398,6 +399,9 @@ const u8 * ap_sta_wpa_get_dpp_pkhash(str
void ap_sta_disconnect(struct hostapd_data *hapd, struct sta_info *sta,
const u8 *addr, u16 reason);
+void _ap_sta_set_authorized(struct hostapd_data *hapd,
+ struct sta_info *sta, int authorized,
+ int reassoc);
void ap_sta_set_authorized(struct hostapd_data *hapd,
struct sta_info *sta, int authorized);
static inline int ap_sta_is_authorized(struct sta_info *sta)

View File

@@ -0,0 +1,86 @@
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
@@ -3152,6 +3152,8 @@ static int hostapd_config_fill(struct ho
bss->ft_over_ds = atoi(pos);
} else if (os_strcmp(buf, "ft_psk_generate_local") == 0) {
bss->ft_psk_generate_local = atoi(pos);
+ } else if (os_strcmp(buf, "ft_l2_refresh") == 0) {
+ bss->ft_l2_refresh = atoi(pos);
#endif /* CONFIG_IEEE80211R_AP */
#ifndef CONFIG_NO_CTRL_IFACE
} else if (os_strcmp(buf, "ctrl_interface") == 0) {
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
@@ -401,6 +401,7 @@ struct hostapd_bss_config {
int pmk_r1_push;
int ft_over_ds;
int ft_psk_generate_local;
+ int ft_l2_refresh;
int r1_max_key_lifetime;
#endif /* CONFIG_IEEE80211R_AP */
--- a/src/ap/wpa_auth_glue.c
+++ b/src/ap/wpa_auth_glue.c
@@ -1495,6 +1495,28 @@ static void hostapd_request_radius_psk(v
#endif /* CONFIG_NO_RADIUS */
+static void wpa_ft_refresh(void *eloop_data, void *user_data)
+{
+ struct hostapd_data *hapd = eloop_data;
+ struct ft_rrb_frame *frame;
+ struct l2_ethhdr *buf;
+ size_t len;
+
+ len = sizeof(*buf) + sizeof(*frame);
+ buf = os_zalloc(len);
+ frame = (struct ft_rrb_frame *)(buf + 1);
+ frame->frame_type = RSN_REMOTE_FRAME_TYPE_FT_RRB;
+ frame->packet_type = FT_PACKET_REQUEST;
+ memset(buf->h_dest, 0xff, ETH_ALEN);
+ os_memcpy(buf->h_source, hapd->own_addr, ETH_ALEN);
+ buf->h_proto = host_to_be16(ETH_P_RRB);
+ l2_packet_send(hapd->l2, buf->h_dest, ETH_P_RRB, (u8 *) buf, len);
+ os_free(buf);
+
+ eloop_register_timeout(hapd->conf->ft_l2_refresh, 0, wpa_ft_refresh,
+ hapd, NULL);
+}
+
int hostapd_setup_wpa(struct hostapd_data *hapd)
{
struct wpa_auth_config _conf;
@@ -1640,6 +1662,9 @@ int hostapd_setup_wpa(struct hostapd_dat
"Failed to open ETH_P_OUI interface");
return -1;
}
+
+ if (hapd->conf->ft_l2_refresh)
+ wpa_ft_refresh(hapd, NULL);
}
#endif /* CONFIG_IEEE80211R_AP */
@@ -1655,7 +1680,6 @@ void hostapd_reconfig_wpa(struct hostapd
wpa_reconfig(hapd->wpa_auth, &wpa_auth_conf);
}
-
void hostapd_deinit_wpa(struct hostapd_data *hapd)
{
ieee80211_tkip_countermeasures_deinit(hapd);
@@ -1679,6 +1703,7 @@ void hostapd_deinit_wpa(struct hostapd_d
"information element from interface %s",
hapd->conf->iface);
}
+
}
ieee802_1x_deinit(hapd);
@@ -1687,6 +1712,7 @@ void hostapd_deinit_wpa(struct hostapd_d
hostapd_wpa_ft_rrb_rx_later(hapd, NULL); /* flush without delivering */
eloop_cancel_timeout(hostapd_oui_deliver_later, hapd, ELOOP_ALL_CTX);
hostapd_oui_deliver_later(hapd, NULL); /* flush without delivering */
+ eloop_cancel_timeout(wpa_ft_refresh, hapd, ELOOP_ALL_CTX);
l2_packet_deinit(hapd->l2);
hapd->l2 = NULL;
hostapd_wpa_unregister_ft_oui(hapd);

View File

@@ -0,0 +1,27 @@
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
@@ -1995,6 +1995,13 @@ static int hostapd_owe_iface_iter(struct
is_zero_ether_addr(bss->own_addr))
continue;
+ if (!os_memcmp(hapd->conf->owe_transition_bssid, bss->own_addr,
+ ETH_ALEN) &&
+ hapd->conf->owe_transition_ssid_len == bss->conf->ssid.ssid_len &&
+ !os_memcmp(hapd->conf->owe_transition_ssid, bss->conf->ssid.ssid,
+ bss->conf->ssid.ssid_len))
+ return 0;
+
os_memcpy(hapd->conf->owe_transition_bssid, bss->own_addr,
ETH_ALEN);
os_memcpy(hapd->conf->owe_transition_ssid,
@@ -2011,10 +2018,6 @@ static int hostapd_owe_iface_iter(struct
int hostapd_owe_trans_get_info(struct hostapd_data *hapd)
{
- if (hapd->conf->owe_transition_ssid_len > 0 &&
- !is_zero_ether_addr(hapd->conf->owe_transition_bssid))
- return 0;
-
/* Find transition mode SSID/BSSID information from a BSS operated by
* this hostapd instance. */
if (!hapd->iface->interfaces ||

View File

@@ -0,0 +1,53 @@
From 98b6503b87bb36bf2f5ae16e52e230e8870c867f Mon Sep 17 00:00:00 2001
From: Venkat Chimata <venkata@shasta.cloud>
Date: Fri, 28 Jun 2024 14:39:31 +0530
Subject: [PATCH] hostapd: Fix DVLAN + 802.1x issue
In case of swconfig switches, the basename of the interface should be based on the last dot.
Earlier it was done based on the first dot, which would result in incorrect basename.
For example if the interface name is eth0.4087 then the vlan->ifname would be eth0.4087. (A dot at the end) .
Before this patch, the basename was returned as eth0. It should be eth0.4087
Also fixed the return code by adding a default value of 0 and removed an unncessary check
for if_add before ubus add call.
Signed-off-by: Venkat Chimata <venkata@shasta.cloud>
---
src/ap/vlan_init.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/ap/vlan_init.c b/src/ap/vlan_init.c
index 3e27671..cfeb1e5 100644
--- a/src/ap/vlan_init.c
+++ b/src/ap/vlan_init.c
@@ -23,7 +23,8 @@ static int vlan_if_add(struct hostapd_data *hapd, struct hostapd_vlan *vlan,
int existsok)
{
bool vlan_exists = iface_exists(vlan->ifname);
- int ret;
+ int ret = 0;
+
#ifdef CONFIG_WEP
int i;
@@ -38,7 +39,7 @@ static int vlan_if_add(struct hostapd_data *hapd, struct hostapd_vlan *vlan,
#endif /* CONFIG_WEP */
if (!hapd->driver || !hapd->driver->if_add) {
- char *dot = strstr(vlan->ifname, ".");
+ char *dot = strrchr(vlan->ifname, '.');
if (dot)
*dot = '\0';
ret = 0;
@@ -59,7 +60,7 @@ static int vlan_if_add(struct hostapd_data *hapd, struct hostapd_vlan *vlan,
if (hapd->wpa_auth)
ret = wpa_auth_ensure_group(hapd->wpa_auth, vlan->vlan_id);
- if (!ret && !vlan_exists && hapd->driver->if_add)
+ if (!ret && !vlan_exists)
hostapd_ubus_add_vlan(hapd, vlan);
if (ret == 0)
--
2.34.1

View File

@@ -0,0 +1,11 @@
--- a/src/radius/radius.c
+++ b/src/radius/radius.c
@@ -755,7 +755,7 @@ struct radius_attr_hdr * radius_msg_add_
ext->length = sizeof(*ext) + 1 + alen;
ext->ext_type = ext_type;
wpabuf_put_u8(msg->buf, data_len > alen ? 0x80 : 0);
- wpabuf_put_data(msg->buf, data, data_len);
+ wpabuf_put_data(msg->buf, data, alen);
data += alen;
data_len -= alen;
if (radius_msg_add_attr_to_array(

View File

@@ -0,0 +1,69 @@
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
@@ -3154,6 +3154,8 @@ static int hostapd_config_fill(struct ho
bss->ft_psk_generate_local = atoi(pos);
} else if (os_strcmp(buf, "ft_l2_refresh") == 0) {
bss->ft_l2_refresh = atoi(pos);
+ } else if (os_strcmp(buf, "ft_key") == 0) {
+ strncpy(bss->ft_key, pos, sizeof(bss->ft_key));
#endif /* CONFIG_IEEE80211R_AP */
#ifndef CONFIG_NO_CTRL_IFACE
} else if (os_strcmp(buf, "ctrl_interface") == 0) {
@@ -4996,8 +4998,22 @@ struct hostapd_config * hostapd_config_r
fclose(f);
- for (i = 0; i < conf->num_bss; i++)
+ for (i = 0; i < conf->num_bss; i++) {
+ if (*conf->bss[i]->ft_key) {
+ u8 buffer[128];
+ sprintf(buffer, "%02X:%02X:%02X:%02X:%02X:%02X %02X%02X%02X%02X%02X%02X %s", MAC2STR(conf->bss[i]->bssid), MAC2STR(conf->bss[i]->bssid), conf->bss[i]->ft_key);
+ add_r0kh(conf->bss[i], buffer);
+ sprintf(buffer, "%02X:%02X:%02X:%02X:%02X:%02X %02X:%02X:%02X:%02X:%02X:%02X %s", MAC2STR(conf->bss[i]->bssid), MAC2STR(conf->bss[i]->bssid), conf->bss[i]->ft_key);
+ add_r1kh(conf->bss[i], buffer);
+ sprintf(buffer, "ff:ff:ff:ff:ff:ff * %s", conf->bss[i]->ft_key);
+ add_r0kh(conf->bss[i], buffer);
+ sprintf(buffer, "00:00:00:00:00:00 00:00:00:00:00:00 %s", conf->bss[i]->ft_key);
+ add_r1kh(conf->bss[i], buffer);
+ hexstr2bin(conf->bss[i]->bssid, conf->bss[i]->r1_key_holder, FT_R1KH_ID_LEN);
+ conf->bss[i]->r0_key_holder_bssid = 1;
+ }
hostapd_set_security_params(conf->bss[i], 1);
+ }
if (hostapd_config_check(conf, 1))
errors++;
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
@@ -403,6 +403,7 @@ struct hostapd_bss_config {
int ft_psk_generate_local;
int ft_l2_refresh;
int r1_max_key_lifetime;
+ u8 ft_key[65];
#endif /* CONFIG_IEEE80211R_AP */
char *ctrl_interface; /* directory for UNIX domain sockets */
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
@@ -390,6 +390,7 @@ struct hostapd_bss_config {
/* IEEE 802.11r - Fast BSS Transition */
u8 mobility_domain[MOBILITY_DOMAIN_ID_LEN];
u8 r1_key_holder[FT_R1KH_ID_LEN];
+ int r0_key_holder_bssid;
u32 r0_key_lifetime; /* PMK-R0 lifetime seconds */
int rkh_pos_timeout;
int rkh_neg_timeout;
--- a/src/ap/wpa_auth_glue.c
+++ b/src/ap/wpa_auth_glue.c
@@ -80,7 +80,10 @@ static void hostapd_wpa_auth_conf(struct
os_memcpy(wconf->ssid, conf->ssid.ssid, wconf->ssid_len);
os_memcpy(wconf->mobility_domain, conf->mobility_domain,
MOBILITY_DOMAIN_ID_LEN);
- if (conf->nas_identifier &&
+ if (1 || conf->r0_key_holder_bssid) {
+ sprintf(wconf->r0_key_holder, "%02X%02X%02X%02X%02X%02X", MAC2STR(conf->bssid));
+ wconf->r0_key_holder_len = 12;
+ } else if (conf->nas_identifier &&
os_strlen(conf->nas_identifier) <= FT_R0KH_ID_MAX_LEN) {
wconf->r0_key_holder_len = os_strlen(conf->nas_identifier);
os_memcpy(wconf->r0_key_holder, conf->nas_identifier,

View File

@@ -431,6 +431,10 @@ radius_user_parse_methods(struct eap_user *eap, struct blob_attr *data)
eap->ttls_auth |= EAP_TTLS_AUTH_MSCHAPV2;
continue;
}
if (!strcmp(method, "MACACL")) {
eap->macacl = 1;
continue;
}
}
n++;
}

View File

@@ -276,24 +276,10 @@ hostapd_bss_get_clients(struct ubus_context *ctx, struct ubus_object *obj,
blobmsg_add_u8(&b, sta_flags[i].name,
!!(sta->flags & sta_flags[i].flag));
#ifdef CONFIG_MBO
blobmsg_add_u8(&b, "mbo", !!(sta->cell_capa));
#endif
r = blobmsg_open_array(&b, "rrm");
for (i = 0; i < ARRAY_SIZE(sta->rrm_enabled_capa); i++)
blobmsg_add_u32(&b, "", sta->rrm_enabled_capa[i]);
blobmsg_close_array(&b, r);
r = blobmsg_open_array(&b, "extended_capabilities");
/* Check if client advertises extended capabilities */
if (sta->ext_capability && sta->ext_capability[0] > 0) {
for (i = 0; i < sta->ext_capability[0]; i++) {
blobmsg_add_u32(&b, "", sta->ext_capability[1 + i]);
}
}
blobmsg_close_array(&b, r);
blobmsg_add_u32(&b, "aid", sta->aid);
#ifdef CONFIG_TAXONOMY
r = blobmsg_alloc_string_buffer(&b, "signature", 1024);
@@ -323,7 +309,7 @@ hostapd_bss_get_clients(struct ubus_context *ctx, struct ubus_object *obj,
blobmsg_add_u32(&b, "retries", sta_driver_data.tx_retry_count);
blobmsg_add_u32(&b, "failed", sta_driver_data.tx_retry_failed);
blobmsg_add_u32(&b, "signal", sta_driver_data.signal);
r = blobmsg_open_table(&b, "mcs");
if (sta_driver_data.rx_hemcs) {
blobmsg_add_u32(&b, "he", 1);
@@ -353,7 +339,7 @@ hostapd_bss_get_clients(struct ubus_context *ctx, struct ubus_object *obj,
blobmsg_add_u32(&b, "tx", sta_driver_data.tx_mcs);
}
blobmsg_close_table(&b, r);
if (sta->signal_mgmt)
blobmsg_add_u32(&b, "signal_mgmt", sta->signal_mgmt);
}
@@ -383,6 +369,32 @@ hostapd_bss_get_features(struct ubus_context *ctx, struct ubus_object *obj,
return 0;
}
/* Imported from iw/util.c
* https://git.kernel.org/pub/scm/linux/kernel/git/jberg/iw.git/tree/util.c?id=4b25ae3537af48dbf9d0abf94132e5ba01b32c18#n200
*/
int ieee80211_frequency_to_channel(int freq)
{
/* see 802.11-2007 17.3.8.3.2 and Annex J */
if (freq == 2484)
return 14;
/* see 802.11ax D6.1 27.3.23.2 and Annex E */
else if (freq == 5935)
return 2;
else if (freq < 2484)
return (freq - 2407) / 5;
else if (freq >= 4910 && freq <= 4980)
return (freq - 4000) / 5;
else if (freq < 5950)
return (freq - 5000) / 5;
else if (freq <= 45000) /* DMG band lower limit */
/* see 802.11ax D6.1 27.3.23.2 */
return (freq - 5950) / 5;
else if (freq >= 58320 && freq <= 70200)
return (freq - 56160) / 2160;
else
return 0;
}
static int
hostapd_bss_get_status(struct ubus_context *ctx, struct ubus_object *obj,
struct ubus_request_data *req, const char *method,
@@ -417,12 +429,6 @@ hostapd_bss_get_status(struct ubus_context *ctx, struct ubus_object *obj,
blobmsg_add_u32(&b, "channel", channel);
blobmsg_add_u32(&b, "op_class", op_class);
blobmsg_add_u32(&b, "beacon_interval", hapd->iconf->beacon_int);
#ifdef CONFIG_IEEE80211AX
blobmsg_add_u32(&b, "bss_color", hapd->iface->conf->he_op.he_bss_color_disabled ? -1 :
hapd->iface->conf->he_op.he_bss_color);
#else
blobmsg_add_u32(&b, "bss_color", -1);
#endif
snprintf(phy_name, 17, "%s", hapd->iface->phy);
blobmsg_add_string(&b, "phy", phy_name);
@@ -523,6 +529,7 @@ hostapd_bss_del_client_cb(struct hostapd_iface *iface, void *ctx)
hwaddr_aton(blobmsg_data(tb[DEL_CLIENT_ADDR]), addr);
syslog(0, "blogic %s:%s[%d]\n", __FILE__, __func__, __LINE__);
for (i = 0; i < iface->num_bss; i++) {
struct hostapd_data *bss = iface->bss[i];
@@ -540,7 +547,7 @@ hostapd_bss_del_client(struct ubus_context *ctx, struct ubus_object *obj,
struct hostapd_data *hapd = container_of(obj, struct hostapd_data, ubus.obj);
struct sta_info *sta;
bool deauth = false, global = false;
int reason, ban_time = 0;
int reason, ban_time = 0;;
u8 addr[ETH_ALEN];
blobmsg_parse(del_policy, __DEL_CLIENT_MAX, tb, blob_data(msg), blob_len(msg));
@@ -560,9 +567,6 @@ hostapd_bss_del_client(struct ubus_context *ctx, struct ubus_object *obj,
if (tb[DEL_CLIENT_GLOBAL_BAN])
global = blobmsg_get_bool(tb[DEL_CLIENT_GLOBAL_BAN]);
if (tb[DEL_CLIENT_GLOBAL_BAN])
global = blobmsg_get_bool(tb[DEL_CLIENT_GLOBAL_BAN]);
sta = ap_get_sta(hapd, addr);
if (sta) {
if (deauth) {
@@ -575,7 +579,7 @@ hostapd_bss_del_client(struct ubus_context *ctx, struct ubus_object *obj,
}
if (tb[DEL_CLIENT_BAN_TIME]) {
ban_time = blobmsg_get_u32(tb[DEL_CLIENT_BAN_TIME]);
ban_time = blobmsg_get_u32(tb[DEL_CLIENT_BAN_TIME]);
if (global)
hapd->iface->interfaces->for_each_interface(hapd->iface->interfaces, hostapd_bss_del_client_cb, tb);
else
@@ -844,11 +848,8 @@ hostapd_switch_chan(struct ubus_context *ctx, struct ubus_object *obj,
css.freq_params.sec_channel_offset,
chwidth, seg0, seg1,
iconf->vht_capab,
mode ? &mode->he_capab[IEEE80211_MODE_AP] :
NULL,
mode ? &mode->eht_capab[IEEE80211_MODE_AP] :
NULL);
mode ? &mode->he_capab[IEEE80211_MODE_AP] : NULL,
mode ? &mode->eht_capab[IEEE80211_MODE_AP] : NULL);
for (i = 0; i < hapd->iface->num_bss; i++) {
struct hostapd_data *bss = hapd->iface->bss[i];
@@ -950,7 +951,6 @@ hostapd_rrm_print_nr(struct hostapd_neighbor_entry *nr)
enum {
BSS_MGMT_EN_NEIGHBOR,
BSS_MGMT_EN_BEACON,
BSS_MGMT_EN_LINK_MEASUREMENT,
#ifdef CONFIG_WNM_AP
BSS_MGMT_EN_BSS_TRANSITION,
#endif
@@ -978,14 +978,6 @@ __hostapd_bss_mgmt_enable_f(struct hostapd_data *hapd, int flag)
WLAN_RRM_CAPS_BEACON_REPORT_ACTIVE |
WLAN_RRM_CAPS_BEACON_REPORT_TABLE;
if (bss->radio_measurements[0] & flags == flags)
return false;
bss->radio_measurements[0] |= (u8) flags;
return true;
case BSS_MGMT_EN_LINK_MEASUREMENT:
flags = WLAN_RRM_CAPS_LINK_MEASUREMENT;
if (bss->radio_measurements[0] & flags == flags)
return false;
@@ -1023,7 +1015,6 @@ __hostapd_bss_mgmt_enable(struct hostapd_data *hapd, uint32_t flags)
static const struct blobmsg_policy bss_mgmt_enable_policy[__BSS_MGMT_EN_MAX] = {
[BSS_MGMT_EN_NEIGHBOR] = { "neighbor_report", BLOBMSG_TYPE_BOOL },
[BSS_MGMT_EN_BEACON] = { "beacon_report", BLOBMSG_TYPE_BOOL },
[BSS_MGMT_EN_LINK_MEASUREMENT] = { "link_measurement", BLOBMSG_TYPE_BOOL },
#ifdef CONFIG_WNM_AP
[BSS_MGMT_EN_BSS_TRANSITION] = { "bss_transition", BLOBMSG_TYPE_BOOL },
#endif
@@ -1052,8 +1043,6 @@ hostapd_bss_mgmt_enable(struct ubus_context *ctx, struct ubus_object *obj,
}
__hostapd_bss_mgmt_enable(hapd, flags);
return 0;
}
@@ -1304,105 +1293,13 @@ hostapd_rrm_beacon_req(struct ubus_context *ctx, struct ubus_object *obj,
return 0;
}
enum {
LM_REQ_ADDR,
LM_REQ_TX_POWER_USED,
LM_REQ_TX_POWER_MAX,
__LM_REQ_MAX,
};
static const struct blobmsg_policy lm_req_policy[__LM_REQ_MAX] = {
[LM_REQ_ADDR] = { "addr", BLOBMSG_TYPE_STRING },
[LM_REQ_TX_POWER_USED] = { "tx-power-used", BLOBMSG_TYPE_INT32 },
[LM_REQ_TX_POWER_MAX] = { "tx-power-max", BLOBMSG_TYPE_INT32 },
};
static int
hostapd_rrm_lm_req(struct ubus_context *ctx, struct ubus_object *obj,
struct ubus_request_data *ureq, const char *method,
struct blob_attr *msg)
{
struct hostapd_data *hapd = container_of(obj, struct hostapd_data, ubus.obj);
struct blob_attr *tb[__LM_REQ_MAX];
struct wpabuf *buf;
u8 addr[ETH_ALEN];
int ret;
int8_t txp_used, txp_max;
txp_used = 0;
txp_max = 0;
blobmsg_parse(lm_req_policy, __LM_REQ_MAX, tb, blob_data(msg), blob_len(msg));
if (!tb[LM_REQ_ADDR])
return UBUS_STATUS_INVALID_ARGUMENT;
if (tb[LM_REQ_TX_POWER_USED])
txp_used = (int8_t) blobmsg_get_u32(tb[LM_REQ_TX_POWER_USED]);
if (tb[LM_REQ_TX_POWER_MAX])
txp_max = (int8_t) blobmsg_get_u32(tb[LM_REQ_TX_POWER_MAX]);
if (hwaddr_aton(blobmsg_data(tb[LM_REQ_ADDR]), addr))
return UBUS_STATUS_INVALID_ARGUMENT;
buf = wpabuf_alloc(5);
if (!buf)
return UBUS_STATUS_UNKNOWN_ERROR;
wpabuf_put_u8(buf, WLAN_ACTION_RADIO_MEASUREMENT);
wpabuf_put_u8(buf, WLAN_RRM_LINK_MEASUREMENT_REQUEST);
wpabuf_put_u8(buf, 1);
/* TX-Power used */
wpabuf_put_u8(buf, txp_used);
/* Max TX Power */
wpabuf_put_u8(buf, txp_max);
ret = hostapd_drv_send_action(hapd, hapd->iface->freq, 0, addr,
wpabuf_head(buf), wpabuf_len(buf));
wpabuf_free(buf);
if (ret < 0)
return -ret;
return 0;
}
void hostapd_ubus_handle_link_measurement(struct hostapd_data *hapd, const u8 *data, size_t len)
{
const struct ieee80211_mgmt *mgmt = (const struct ieee80211_mgmt *) data;
const u8 *pos, *end;
u8 token;
end = data + len;
token = mgmt->u.action.u.rrm.dialog_token;
pos = mgmt->u.action.u.rrm.variable;
if (end - pos < 8)
return;
if (!hapd->ubus.obj.has_subscribers)
return;
blob_buf_init(&b, 0);
blobmsg_add_macaddr(&b, "address", mgmt->sa);
blobmsg_add_u16(&b, "dialog-token", token);
blobmsg_add_u16(&b, "rx-antenna-id", pos[4]);
blobmsg_add_u16(&b, "tx-antenna-id", pos[5]);
blobmsg_add_u16(&b, "rcpi", pos[6]);
blobmsg_add_u16(&b, "rsni", pos[7]);
ubus_notify(ctx, &hapd->ubus.obj, "link-measurement-report", b.head, -1);
}
#ifdef CONFIG_WNM_AP
static int
hostapd_bss_tr_send(struct hostapd_data *hapd, u8 *addr, bool disassoc_imminent, bool abridged,
u16 disassoc_timer, u8 validity_period, u8 dialog_token,
struct blob_attr *neighbors, u8 mbo_reason, u8 cell_pref, u8 reassoc_delay)
struct blob_attr *neighbors)
{
struct blob_attr *cur;
struct sta_info *sta;
@@ -1410,8 +1307,6 @@ hostapd_bss_tr_send(struct hostapd_data *hapd, u8 *addr, bool disassoc_imminent,
int rem;
u8 *nr = NULL;
u8 req_mode = 0;
u8 mbo[10];
size_t mbo_len = 0;
sta = ap_get_sta(hapd, addr);
if (!sta)
@@ -1463,37 +1358,8 @@ hostapd_bss_tr_send(struct hostapd_data *hapd, u8 *addr, bool disassoc_imminent,
if (disassoc_imminent)
req_mode |= WNM_BSS_TM_REQ_DISASSOC_IMMINENT;
#ifdef CONFIG_MBO
u8 *mbo_pos = mbo;
if (mbo_reason > MBO_TRANSITION_REASON_PREMIUM_AP)
return UBUS_STATUS_INVALID_ARGUMENT;
if (cell_pref != 0 && cell_pref != 1 && cell_pref != 255)
return UBUS_STATUS_INVALID_ARGUMENT;
if (reassoc_delay > 65535 || (reassoc_delay && !disassoc_imminent))
return UBUS_STATUS_INVALID_ARGUMENT;
*mbo_pos++ = MBO_ATTR_ID_TRANSITION_REASON;
*mbo_pos++ = 1;
*mbo_pos++ = mbo_reason;
*mbo_pos++ = MBO_ATTR_ID_CELL_DATA_PREF;
*mbo_pos++ = 1;
*mbo_pos++ = cell_pref;
if (reassoc_delay) {
*mbo_pos++ = MBO_ATTR_ID_ASSOC_RETRY_DELAY;
*mbo_pos++ = 2;
WPA_PUT_LE16(mbo_pos, reassoc_delay);
mbo_pos += 2;
}
mbo_len = mbo_pos - mbo;
#endif
if (wnm_send_bss_tm_req(hapd, sta, req_mode, disassoc_timer, validity_period, NULL,
dialog_token, NULL, nr, nr_len, mbo_len ? mbo : NULL, mbo_len))
dialog_token, NULL, nr, nr_len, NULL, 0))
return UBUS_STATUS_UNKNOWN_ERROR;
return 0;
@@ -1507,11 +1373,6 @@ enum {
BSS_TR_NEIGHBORS,
BSS_TR_ABRIDGED,
BSS_TR_DIALOG_TOKEN,
#ifdef CONFIG_MBO
BSS_TR_MBO_REASON,
BSS_TR_CELL_PREF,
BSS_TR_REASSOC_DELAY,
#endif
__BSS_TR_DISASSOC_MAX
};
@@ -1523,11 +1384,6 @@ static const struct blobmsg_policy bss_tr_policy[__BSS_TR_DISASSOC_MAX] = {
[BSS_TR_NEIGHBORS] = { "neighbors", BLOBMSG_TYPE_ARRAY },
[BSS_TR_ABRIDGED] = { "abridged", BLOBMSG_TYPE_BOOL },
[BSS_TR_DIALOG_TOKEN] = { "dialog_token", BLOBMSG_TYPE_INT32 },
#ifdef CONFIG_MBO
[BSS_TR_MBO_REASON] = { "mbo_reason", BLOBMSG_TYPE_INT32 },
[BSS_TR_CELL_PREF] = { "cell_pref", BLOBMSG_TYPE_INT32 },
[BSS_TR_REASSOC_DELAY] = { "reassoc_delay", BLOBMSG_TYPE_INT32 },
#endif
};
static int
@@ -1544,9 +1400,6 @@ hostapd_bss_transition_request(struct ubus_context *ctx, struct ubus_object *obj
u32 dialog_token = 1;
bool abridged;
bool da_imminent;
u8 mbo_reason;
u8 cell_pref;
u8 reassoc_delay;
blobmsg_parse(bss_tr_policy, __BSS_TR_DISASSOC_MAX, tb, blob_data(msg), blob_len(msg));
@@ -1568,19 +1421,52 @@ hostapd_bss_transition_request(struct ubus_context *ctx, struct ubus_object *obj
da_imminent = !!(tb[BSS_TR_DA_IMMINENT] && blobmsg_get_bool(tb[BSS_TR_DA_IMMINENT]));
abridged = !!(tb[BSS_TR_ABRIDGED] && blobmsg_get_bool(tb[BSS_TR_ABRIDGED]));
#ifdef CONFIG_MBO
if (tb[BSS_TR_MBO_REASON])
mbo_reason = blobmsg_get_u32(tb[BSS_TR_MBO_REASON]);
if (tb[BSS_TR_CELL_PREF])
cell_pref = blobmsg_get_u32(tb[BSS_TR_CELL_PREF]);
if (tb[BSS_TR_REASSOC_DELAY])
reassoc_delay = blobmsg_get_u32(tb[BSS_TR_REASSOC_DELAY]);
#endif
return hostapd_bss_tr_send(hapd, addr, da_imminent, abridged, da_timer, valid_period,
dialog_token, tb[BSS_TR_NEIGHBORS], mbo_reason, cell_pref, reassoc_delay);
dialog_token, tb[BSS_TR_NEIGHBORS]);
}
enum {
WNM_DISASSOC_ADDR,
WNM_DISASSOC_DURATION,
WNM_DISASSOC_NEIGHBORS,
WNM_DISASSOC_ABRIDGED,
__WNM_DISASSOC_MAX,
};
static const struct blobmsg_policy wnm_disassoc_policy[__WNM_DISASSOC_MAX] = {
[WNM_DISASSOC_ADDR] = { "addr", BLOBMSG_TYPE_STRING },
[WNM_DISASSOC_DURATION] { "duration", BLOBMSG_TYPE_INT32 },
[WNM_DISASSOC_NEIGHBORS] { "neighbors", BLOBMSG_TYPE_ARRAY },
[WNM_DISASSOC_ABRIDGED] { "abridged", BLOBMSG_TYPE_BOOL },
};
static int
hostapd_wnm_disassoc_imminent(struct ubus_context *ctx, struct ubus_object *obj,
struct ubus_request_data *ureq, const char *method,
struct blob_attr *msg)
{
struct hostapd_data *hapd = container_of(obj, struct hostapd_data, ubus.obj);
struct blob_attr *tb[__WNM_DISASSOC_MAX];
struct sta_info *sta;
int duration = 10;
u8 addr[ETH_ALEN];
bool abridged;
blobmsg_parse(wnm_disassoc_policy, __WNM_DISASSOC_MAX, tb, blob_data(msg), blob_len(msg));
if (!tb[WNM_DISASSOC_ADDR])
return UBUS_STATUS_INVALID_ARGUMENT;
if (hwaddr_aton(blobmsg_data(tb[WNM_DISASSOC_ADDR]), addr))
return UBUS_STATUS_INVALID_ARGUMENT;
if (tb[WNM_DISASSOC_DURATION])
duration = blobmsg_get_u32(tb[WNM_DISASSOC_DURATION]);
abridged = !!(tb[WNM_DISASSOC_ABRIDGED] && blobmsg_get_bool(tb[WNM_DISASSOC_ABRIDGED]));
return hostapd_bss_tr_send(hapd, addr, true, abridged, duration, duration,
1, tb[WNM_DISASSOC_NEIGHBORS]);
}
#endif
@@ -1715,8 +1601,8 @@ static const struct ubus_method bss_methods[] = {
UBUS_METHOD_NOARG("rrm_nr_list", hostapd_rrm_nr_list),
UBUS_METHOD("rrm_nr_set", hostapd_rrm_nr_set, nr_set_policy),
UBUS_METHOD("rrm_beacon_req", hostapd_rrm_beacon_req, beacon_req_policy),
UBUS_METHOD("link_measurement_req", hostapd_rrm_lm_req, lm_req_policy),
#ifdef CONFIG_WNM_AP
UBUS_METHOD("wnm_disassoc_imminent", hostapd_wnm_disassoc_imminent, wnm_disassoc_policy),
UBUS_METHOD("bss_transition_request", hostapd_bss_transition_request, bss_tr_policy),
#endif
};
@@ -1758,7 +1644,7 @@ hostapd_wired_get_clients(struct ubus_context *ctx, struct ubus_object *obj,
blobmsg_add_u8(&b, sta_flags[i].name,
!!(sta->flags & sta_flags[i].flag));
blobmsg_close_table(&b, c);
blobmsg_close_table(&b, c);
}
blobmsg_close_array(&b, list);
ubus_send_reply(ctx, req, b.head);
@@ -1814,21 +1700,21 @@ hostapd_wired_mac_auth(struct ubus_context *ctx, struct ubus_object *obj,
{
struct hostapd_data *hapd = container_of(obj, struct hostapd_data, ubus.obj);
struct blob_attr *tb[__MAC_AUTH_MAX];
struct radius_sta rad_info;
struct radius_sta rad_info;
struct sta_info *sta;
u8 addr[ETH_ALEN];
int acl_res;
blobmsg_parse(mac_auth_policy, __MAC_AUTH_MAX, tb, blob_data(msg), blob_len(msg));
if (hwaddr_aton(blobmsg_data(tb[MAC_AUTH_ADDR]), addr))
return UBUS_STATUS_INVALID_ARGUMENT;
acl_res = hostapd_allowed_address(hapd, addr, NULL, 0, &rad_info, 0);
if (acl_res == HOSTAPD_ACL_REJECT) {
wpa_printf(MSG_ERROR, "Ignore new peer notification\n");
return UBUS_STATUS_INVALID_ARGUMENT;
}
acl_res = hostapd_allowed_address(hapd, addr, NULL, 0, &rad_info, 0);
if (acl_res == HOSTAPD_ACL_REJECT) {
wpa_printf(MSG_ERROR, "Ignore new peer notification\n");
return UBUS_STATUS_INVALID_ARGUMENT;
}
return 0;
}
@@ -1944,7 +1830,8 @@ ubus_event_cb(struct ubus_notify_request *req, int idx, int ret)
{
struct ubus_event_req *ureq = container_of(req, struct ubus_event_req, nreq);
ureq->resp = ret;
if (!ureq->resp)
ureq->resp = ret;
}
int hostapd_ubus_handle_event(struct hostapd_data *hapd, struct hostapd_ubus_request *req)
@@ -1977,6 +1864,7 @@ int hostapd_ubus_handle_event(struct hostapd_data *hapd, struct hostapd_ubus_req
blob_buf_init(&b, 0);
blobmsg_add_macaddr(&b, "address", addr);
blobmsg_add_string(&b, "ifname", hapd->conf->iface);
if (req->mgmt_frame)
blobmsg_add_macaddr(&b, "target", req->mgmt_frame->da);
if (req->ssi_signal)
@@ -2069,8 +1957,8 @@ void hostapd_ubus_notify_csa(struct hostapd_data *hapd, int freq)
ubus_notify(ctx, &hapd->ubus.obj, "channel-switch", b.head, -1);
}
void hostapd_ubus_notify_authorized(struct hostapd_data *hapd, struct sta_info *sta,
const char *auth_alg)
void hostapd_ubus_notify_authorized(struct hostapd_data *hapd, struct sta_info *sta)
{
if (!hapd->ubus.obj.has_subscribers)
return;
@@ -2078,10 +1966,8 @@ void hostapd_ubus_notify_authorized(struct hostapd_data *hapd, struct sta_info *
blob_buf_init(&b, 0);
blobmsg_add_macaddr(&b, "address", sta->addr);
if (sta->vlan_id)
blobmsg_add_u32(&b, "vlan", sta->vlan_id);
blobmsg_add_u32(&b, "vlan", sta->vlan_id);
blobmsg_add_string(&b, "ifname", hapd->conf->iface);
if (auth_alg)
blobmsg_add_string(&b, "auth-alg", auth_alg);
if (sta->bandwidth[0] || sta->bandwidth[1]) {
void *r = blobmsg_open_array(&b, "rate-limit");
@@ -2089,6 +1975,7 @@ void hostapd_ubus_notify_authorized(struct hostapd_data *hapd, struct sta_info *
blobmsg_add_u32(&b, "", sta->bandwidth[1]);
blobmsg_close_array(&b, r);
}
ubus_notify(ctx, &hapd->ubus.obj, "sta-authorized", b.head, -1);
}
@@ -2114,7 +2001,6 @@ void hostapd_ubus_notify_beacon_report(
blobmsg_add_macaddr(&b, "bssid", rep->bssid);
blobmsg_add_u16(&b, "antenna-id", rep->antenna_id);
blobmsg_add_u16(&b, "parent-tsf", rep->parent_tsf);
blobmsg_add_u16(&b, "rep-mode", rep_mode);
ubus_notify(ctx, &hapd->ubus.obj, "beacon-report", b.head, -1);
}

View File

@@ -48,8 +48,8 @@ void hostapd_ubus_add_vlan(struct hostapd_data *hapd, struct hostapd_vlan *vlan)
void hostapd_ubus_remove_vlan(struct hostapd_data *hapd, struct hostapd_vlan *vlan);
int hostapd_ubus_handle_event(struct hostapd_data *hapd, struct hostapd_ubus_request *req);
void hostapd_ubus_handle_link_measurement(struct hostapd_data *hapd, const u8 *data, size_t len);
void hostapd_ubus_notify(struct hostapd_data *hapd, const char *type, const u8 *mac);
void hostapd_ubus_notify_authorized(struct hostapd_data *hapd, struct sta_info *sta);
void hostapd_ubus_notify_beacon_report(struct hostapd_data *hapd,
const u8 *addr, u8 token, u8 rep_mode,
struct rrm_measurement_beacon_report *rep,
@@ -66,8 +66,7 @@ void hostapd_ubus_free(struct hapd_interfaces *interfaces);
int hostapd_ubus_notify_bss_transition_query(
struct hostapd_data *hapd, const u8 *addr, u8 dialog_token, u8 reason,
const u8 *candidate_list, u16 candidate_list_len);
void hostapd_ubus_notify_authorized(struct hostapd_data *hapd, struct sta_info *sta,
const char *auth_alg);
void hostapd_ubus_notify_csa(struct hostapd_data *hapd, int freq);
#else
@@ -102,10 +101,6 @@ static inline int hostapd_ubus_handle_event(struct hostapd_data *hapd, struct ho
return 0;
}
static inline void hostapd_ubus_handle_link_measurement(struct hostapd_data *hapd, const u8 *data, size_t len)
{
}
static inline void hostapd_ubus_notify(struct hostapd_data *hapd, const char *type, const u8 *mac)
{
}
@@ -143,13 +138,6 @@ static inline int hostapd_ubus_notify_bss_transition_query(
{
return 0;
}
static inline void
hostapd_ubus_notify_authorized(struct hostapd_data *hapd, struct sta_info *sta,
const char *auth_alg)
{
}
#endif
#endif

View File

@@ -9,6 +9,7 @@
#include "ap_drv_ops.h"
#include "dfs.h"
#include "acs.h"
#include "ieee802_11_auth.h"
#include <libubox/uloop.h>
static uc_resource_type_t *global_type, *bss_type, *iface_type;
@@ -51,7 +52,7 @@ hostapd_ucode_update_bss_list(struct hostapd_iface *iface, uc_value_t *if_bss, u
int i;
list = ucv_array_new(vm);
for (i = 0; i < iface->num_bss; i++) {
for (i = 0; iface->bss && i < iface->num_bss; i++) {
struct hostapd_data *hapd = iface->bss[i];
uc_value_t *val = hostapd_ucode_bss_get_uval(hapd);
@@ -255,6 +256,7 @@ uc_hostapd_bss_set_config(uc_vm_t *vm, size_t nargs)
hostapd_setup_bss(hapd, hapd == iface->bss[0], true);
hostapd_ucode_update_interfaces();
hostapd_owe_update_trans(iface);
done:
ret = 0;
@@ -375,6 +377,7 @@ uc_hostapd_iface_add_bss(uc_vm_t *vm, size_t nargs)
conf->bss[idx] = NULL;
ret = hostapd_ucode_bss_get_uval(hapd);
hostapd_ucode_update_interfaces();
hostapd_owe_update_trans(iface);
goto out;
deinit_ctrl:
@@ -603,6 +606,7 @@ out:
ieee802_11_set_beacon(hapd);
}
hostapd_owe_update_trans(iface);
return ucv_boolean_new(true);
}
@@ -694,6 +698,7 @@ uc_hostapd_bss_rename(uc_vm_t *vm, size_t nargs)
hostapd_ubus_add_bss(hapd);
hostapd_ucode_update_interfaces();
hostapd_owe_update_trans(hapd->iface);
out:
if (interfaces->ctrl_iface_init)
interfaces->ctrl_iface_init(hapd);
@@ -701,6 +706,113 @@ out:
return ret ? NULL : ucv_boolean_new(true);
}
int hostapd_ucode_sta_auth(struct hostapd_data *hapd, struct sta_info *sta)
{
char addr[sizeof(MACSTR)];
uc_value_t *val, *cur;
int ret = 0;
if (wpa_ucode_call_prepare("sta_auth"))
return 0;
uc_value_push(ucv_get(ucv_string_new(hapd->conf->iface)));
snprintf(addr, sizeof(addr), MACSTR, MAC2STR(sta->addr));
val = ucv_string_new(addr);
uc_value_push(ucv_get(val));
val = wpa_ucode_call(2);
cur = ucv_object_get(val, "psk", NULL);
if (ucv_type(cur) == UC_ARRAY) {
struct hostapd_sta_wpa_psk_short *p, **next;
size_t len = ucv_array_length(cur);
next = &sta->psk;
hostapd_free_psk_list(*next);
*next = NULL;
for (size_t i = 0; i < len; i++) {
uc_value_t *cur_psk;
const char *str;
size_t str_len;
cur_psk = ucv_array_get(cur, i);
str = ucv_string_get(cur_psk);
str_len = strlen(str);
if (!str || str_len < 8 || str_len > 64)
continue;
p = os_zalloc(sizeof(*p));
if (len == 64) {
if (hexstr2bin(str, p->psk, PMK_LEN) < 0) {
free(p);
continue;
}
} else {
p->is_passphrase = 1;
memcpy(p->passphrase, str, str_len + 1);
}
*next = p;
next = &p->next;
}
}
cur = ucv_object_get(val, "force_psk", NULL);
sta->use_sta_psk = ucv_is_truish(cur);
cur = ucv_object_get(val, "status", NULL);
if (ucv_type(cur) == UC_INTEGER)
ret = ucv_int64_get(cur);
ucv_put(val);
ucv_gc(vm);
return ret;
}
void hostapd_ucode_sta_connected(struct hostapd_data *hapd, struct sta_info *sta)
{
struct hostapd_sta_wpa_psk_short *psk = sta->psk;
char addr[sizeof(MACSTR)];
uc_value_t *val, *cur;
int ret = 0;
if (wpa_ucode_call_prepare("sta_connected"))
return;
uc_value_push(ucv_get(ucv_string_new(hapd->conf->iface)));
snprintf(addr, sizeof(addr), MACSTR, MAC2STR(sta->addr));
val = ucv_string_new(addr);
uc_value_push(ucv_get(val));
val = ucv_object_new(vm);
if (sta->psk_idx)
ucv_object_add(val, "psk_idx", ucv_int64_new(sta->psk_idx - 1));
if (sta->psk)
ucv_object_add(val, "psk", ucv_string_new(sta->psk->passphrase));
uc_value_push(ucv_get(val));
val = wpa_ucode_call(3);
if (ucv_type(val) != UC_OBJECT)
goto out;
cur = ucv_object_get(val, "vlan", NULL);
if (ucv_type(cur) == UC_INTEGER) {
struct vlan_description vdesc = {
.notempty = 1,
.untagged = ucv_int64_get(cur),
};
ap_sta_set_vlan(hapd, sta, &vdesc);
ap_sta_bind_vlan(hapd, sta);
}
out:
ucv_put(val);
}
int hostapd_ucode_init(struct hapd_interfaces *ifaces)
{
@@ -765,6 +877,34 @@ void hostapd_ucode_free_iface(struct hostapd_iface *iface)
wpa_ucode_registry_remove(iface_registry, iface->ucode.idx);
}
int hostapd_ucode_afc_request(struct hostapd_iface *iface, const char *request,
char *buf, size_t len)
{
uc_value_t *val;
size_t ret_len;
int ret = -1;
if (wpa_ucode_call_prepare("afc_request"))
return -1;
uc_value_push(ucv_get(ucv_string_new(iface->phy)));
uc_value_push(ucv_get(ucv_string_new(request)));
val = wpa_ucode_call(2);
if (ucv_type(val) != UC_STRING)
goto out;
ret_len = ucv_string_length(val);
if (ret_len >= len)
goto out;
memcpy(buf, ucv_string_get(val), ret_len + 1);
ret = (int)ret_len;
out:
ucv_put(val);
return ret;
}
void hostapd_ucode_add_bss(struct hostapd_data *hapd)
{
uc_value_t *val;

View File

@@ -23,9 +23,13 @@ int hostapd_ucode_init(struct hapd_interfaces *ifaces);
void hostapd_ucode_free(void);
void hostapd_ucode_free_iface(struct hostapd_iface *iface);
int hostapd_ucode_sta_auth(struct hostapd_data *hapd, struct sta_info *sta);
void hostapd_ucode_sta_connected(struct hostapd_data *hapd, struct sta_info *sta);
void hostapd_ucode_add_bss(struct hostapd_data *hapd);
void hostapd_ucode_free_bss(struct hostapd_data *hapd);
void hostapd_ucode_reload_bss(struct hostapd_data *hapd);
int hostapd_ucode_afc_request(struct hostapd_iface *iface, const char *request,
char *buf, size_t len);
#else
@@ -42,6 +46,13 @@ static inline void hostapd_ucode_free_iface(struct hostapd_iface *iface)
static inline void hostapd_ucode_reload_bss(struct hostapd_data *hapd)
{
}
static inline int hostapd_ucode_sta_auth(struct hostapd_data *hapd, struct sta_info *sta)
{
return 0;
}
static inline void hostapd_ucode_sta_connected(struct hostapd_data *hapd, struct sta_info *sta)
{
}
static inline void hostapd_ucode_add_bss(struct hostapd_data *hapd)
{
}

View File

@@ -52,12 +52,12 @@ uc_value_t *uc_wpa_freq_info(uc_vm_t *vm, size_t nargs)
uc_value_t *sec = uc_fn_arg(1);
int width = ucv_uint64_get(uc_fn_arg(2));
int freq_val, center_idx, center_ofs;
enum oper_chan_width chanwidth;
enum hostapd_hw_mode hw_mode;
u8 op_class, channel, tmp_channel;
const char *modestr;
int sec_channel = 0;
uc_value_t *ret;
int chanwidth;
if (ucv_type(freq) != UC_INTEGER)
return NULL;
@@ -77,13 +77,13 @@ uc_value_t *uc_wpa_freq_info(uc_vm_t *vm, size_t nargs)
switch (width) {
case 0:
chanwidth = CONF_OPER_CHWIDTH_USE_HT;
chanwidth = CHANWIDTH_USE_HT;
break;
case 1:
chanwidth = CONF_OPER_CHWIDTH_80MHZ;
chanwidth = CHANWIDTH_80MHZ;
break;
case 2:
chanwidth = CONF_OPER_CHWIDTH_160MHZ;
chanwidth = CHANWIDTH_160MHZ;
break;
default:
return NULL;

Some files were not shown because too many files have changed in this diff Show More