Open M-Hazik opened 3 weeks ago
Hi @M-Hazik! We appreciate you submitting your first issue for our open-source project. 🌟
Even though I'm a bot, I can assure you that the whole community is genuinely grateful for your time and effort. 🤖💙
Quick feedback: IMHO, existing Wi-Fi management layer in Zephyr is thin and most of the Wi-Fi is managed by drivers or WPA supplicant. Different Wi-Fi chips have different concurrency restrictions (both mode and channel concurrency), so, this should be managed with-in the driver itself. I think the alternative that you had tried i.e., creating a separate VIF for AP is the right way to go, Application can then choose the appropriate interface of its choice, see PR https://github.com/zephyrproject-rtos/zephyr/pull/73119/commits/844d2f2594aa3d24a4ce22bc7cfe348e61470656 that add's Wi-Fi interface mode knowledge to the Wi-Fi NM (still under review).
we noticed that ZephyrOS uses only single net_if interface to manage IP addresses irrespective of the device's mode (STA or AP), thus further restricting AP+STA mode support in ZephyrOS
It's not the Zephyr OS but the driver that is using a single net_if here, Zephyr Wi-Fi management just calls the driver interface ops, the interface and type mapping/management is up to the driver.
We tried to create a virtual interface and attached it to default interface of ESP32. When we tried to make network request using this virtual interface it return error:-134
Can you please share some details and logs? This approach is right and we can root cause the failure.
This is how I was creating VIF
It gave me error -ENOTSUP
, For Reference, screenshot is attached.
When I was looking for the reason I found inwifi_mgmt.c
that it checks for the function pointer related to net_mgmt
request. I might have not use VIF properly. can we pass net_wifi_mgmt_offload
instead of virtual_interface_api
to it? What is right way of of using VIF with wifi driver?
From docs i found NET_DEVICE_DT_INST_DEFINE_INSTANCE
, as per my understanding it creates multiple netif
bound to the same network device. it did'nt work. It give me following error. I might have not understand it's usage correctly.
.
The PR you mentioned will indeed be helpful for enabling AP+STA mode. Because it separates the netif for STA
and softAP
. But still some changes are needed to be done on driver sides and we are willing to make that changes.
I would like to ask how would I define multiple netif instances and tell register it lower network layer as STA and AP netif?
It gave me error -ENOTSUP, For Reference, screenshot is attached.
Isn't this because the VIF doesn't define wifi_mgmt_api
?
From docs i found NET_DEVICE_DT_INST_DEFINE_INSTANCE, as per my understanding it creates multiple netif bound to the same network device. it did'nt work. It give me following error. I
I haven't tried defining multiple interfaces myself, but you have one physical interface + multiple virtual interfaces tied to the same physical interfaces, so, the above macro should work, let me give it a shot myself.
So, I tried a quick hack using a downstream driver (I am most familiar with) to cook up multiple VIFs, I used See https://github.com/krish2718/zephyr/commit/a4be2ade0247e05cb1d2b402eb1312b94a0d13dd
ETH_NET_DEVICE_DT_INST_DEFINE
to define multiple instances, the OPs are all same, just the per-interface data is different.DT_DRV_COMPAT
instances compatible = "nordic,wlan";
, wlan0
and wlan1`And it worked. For testing, I hacked Wi-Fi shell https://github.com/krish2718/zephyr/commit/934f7950597cca83a337e824669999d70a0d83a5 and able to scan on both the interfaces.
It's purely up to the driver to manage these interfaces i.e., whether they belong to same radio or different radio etc. Wi-Fi management is agnostic and just relies on wifi_mgmt_api
(and WPA supplicant on wifi_drv_ops
) all of these OPs are designed to be per-interface.
Is your enhancement proposal related to a problem? Please describe. During working with the ESP32 on ZephyrOS, wifi driver does not allow for AP+STA mode to be active concurrently, presenting a significant limitation. After modifying ESP32 WiFi driver to enable both modes, we noticed that ZephyrOS uses only single net_if interface to manage IP addresses irrespective of the device's mode (STA or AP), thus further restricting AP+STA mode support in ZephyrOS. We also tried to work with virtual interfaces so we can assign one interface to AP and the other to STA but network(net_mgmt) requests which uses virtual interface gives error -134.
Describe the solution you'd like Add support to active both(AP+STA) modes simultaneously by defining two interfaces for WiFi one for STA and one for AP.
Logic For enabling ESP32 AP+STA mode:
Describe alternatives you've considered