Skip to content

drivers: wifi: nrf7002: Add support for multiple virtual interfaces (… #86618

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 0 commits into from

Conversation

hanan619
Copy link

@hanan619 hanan619 commented Mar 4, 2025

Description:
The nRF7002 firmware supports two virtual interfaces (VIFs) that can operate in different modes (e.g., AP and STA). However, the existing Zephyr driver only utilizes a single VIF, preventing full multi-interface support.

This PR extends the nRF7002 driver to support multiple VIFs by making the following modifications:

  • VIF Context Handling: The driver already contains an array of vif_ctx_zep, but only the first element was being used. Now, a second Ethernet device is registered using vif_ctx_zep[1], enabling multi-VIF operation.
  • Tracking Interfaces: Introduced vif_ctx_cnt to keep track of active interfaces and manage their state effectively.
  • FMAC Initialization: Ensured that FMAC (Firmware MAC) is initialized only once, avoiding redundant initializations when multiple VIFs are present.
  • Command Response Handling: The UMAC control commands previously did not associate responses with the issuing VIF. A queue is now introduced to track the originating VIF for each command and correctly route the response event to the corresponding interface.

Testing:
Verified that two virtual interfaces can be registered and operate simultaneously.
Tested AP mode on one VIF and STA mode on another VIF concurrently.
Ensured that UMAC command responses are correctly matched to their respective VIFs.
Dependencies:
This PR depends on the corresponding hostap PR, which introduces multiple control channels in WPA supplicant to handle separate interfaces.

Copy link

github-actions bot commented Mar 4, 2025

Hello @hanan619, and thank you very much for your first pull request to the Zephyr project!
Our Continuous Integration pipeline will execute a series of checks on your Pull Request commit messages and code, and you are expected to address any failures by updating the PR. Please take a look at our commit message guidelines to find out how to format your commit messages, and at our contribution workflow to understand how to update your Pull Request. If you haven't already, please make sure to review the project's Contributor Expectations and update (by amending and force-pushing the commits) your pull request if necessary.
If you are stuck or need help please join us on Discord and ask your question there. Additionally, you can escalate the review when applicable. 😊

@munir-zin
Copy link
Contributor

@jukkar @rlezuo1 @MaochenWang1 @sachinthegreen @Kludentwo Can anyone please review this MR and let us know the changes required. We are waiting for thi PR to be verified so that we can integrate it in our application.

@jukkar
Copy link
Member

jukkar commented Mar 18, 2025

You need to update manifest file west.yml and make it point to hostap pr so that we can test this PR. After the hostap PR is merged, the manifest needs to be updated to correct commit id.

@zephyrbot
Copy link

zephyrbot commented Mar 20, 2025

The following west manifest projects have changed revision in this Pull Request:

Name Old Revision New Revision Diff

All manifest checks OK

Note: This message is automatically posted and updated by the Manifest GitHub Action.

@zephyrbot zephyrbot added manifest manifest-hostap DNM (manifest) This PR should not be merged (controlled by action-manifest) labels Mar 20, 2025
@hanan619
Copy link
Author

@jukkar west.yml updated with hostap pr. Kindly proceed with review

@Kludentwo Kludentwo removed their request for review March 20, 2025 11:12
Copy link
Contributor

@krish2718 krish2718 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no merge commits please, use git rebase over git merge when rebasing to main.

@krish2718
Copy link
Contributor

no merge commits please, use git rebase over git merge when rebasing to main.

I can still see the merge commits in the latest push.

@hanan619 hanan619 closed this Mar 25, 2025
@hanan619 hanan619 reopened this Mar 25, 2025
@hanan619 hanan619 force-pushed the main branch 2 times, most recently from 7d6f275 to 55c2e41 Compare March 27, 2025 09:12
@github-actions github-actions bot removed manifest manifest-hostap DNM (manifest) This PR should not be merged (controlled by action-manifest) labels Mar 27, 2025
@hanan619 hanan619 closed this Mar 27, 2025
@hanan619 hanan619 reopened this Mar 27, 2025
@github-actions github-actions bot added area: Networking area: Base OS Base OS Library (lib/os) area: Shields Shields (add-on boards) labels May 29, 2025
@github-actions github-actions bot requested review from avisconti and kartben May 29, 2025 07:40
@krish2718
Copy link
Contributor

@krish2718 Should I add wlan1 in nrf7002ek.overlay? Or create a separate shield nrf7002_dual.overlay?

I would just add it to the nrf7002ek.overlay itself, it would just be unused by default, but that's fine.

@hanan619
Copy link
Author

@krish2718 Please re-run the tests

@krish2718
Copy link
Contributor

@krish2718 Please re-run the tests

Twister is still failing, so, I have not done any manual testing, can you please do below locally and fix any issues before the next push? Once CI is green, I can run my manual tests and we can merge it, thanks.

  1. Run the failing p2p test
    INFO    - west twister -p native_sim/native -s wifi.build.p2p --no-detailed-test-id
    INFO    - or with west:
    INFO    - west build -p -b native_sim/native tests/net/wifi/configs -T wifi.build.p2p
    
  2. Run the test on actual platform nRF7002DK (Assuming you have one) where you test STA + SoftAP, pinging on both interfaces should be the pass criterion (you need to build with CONFIG_NRF_WIFI_RPU_RECOVERY=n to avoid known issue)

@hanan619
Copy link
Author

hanan619 commented Jun 4, 2025

@munir-zin reference

@hanan619 hanan619 force-pushed the main branch 4 times, most recently from 1b279c7 to 4eccb63 Compare June 18, 2025 13:03
@hanan619
Copy link
Author

@krish2718 Please re-run the tests

Twister is still failing, so, I have not done any manual testing, can you please do below locally and fix any issues before the next push? Once CI is green, I can run my manual tests and we can merge it, thanks.

  1. Run the failing p2p test
    INFO    - west twister -p native_sim/native -s wifi.build.p2p --no-detailed-test-id
    INFO    - or with west:
    INFO    - west build -p -b native_sim/native tests/net/wifi/configs -T wifi.build.p2p
    
  2. Run the test on actual platform nRF7002DK (Assuming you have one) where you test STA + SoftAP, pinging on both interfaces should be the pass criterion (you need to build with CONFIG_NRF_WIFI_RPU_RECOVERY=n to avoid known issue)

@krish2718 Please re-run the tests

Twister is still failing, so, I have not done any manual testing, can you please do below locally and fix any issues before the next push? Once CI is green, I can run my manual tests and we can merge it, thanks.

  1. Run the failing p2p test
    INFO    - west twister -p native_sim/native -s wifi.build.p2p --no-detailed-test-id
    INFO    - or with west:
    INFO    - west build -p -b native_sim/native tests/net/wifi/configs -T wifi.build.p2p
    
  2. Run the test on actual platform nRF7002DK (Assuming you have one) where you test STA + SoftAP, pinging on both interfaces should be the pass criterion (you need to build with CONFIG_NRF_WIFI_RPU_RECOVERY=n to avoid known issue)

@krish2718 Please re-run the tests

@hanan619 hanan619 force-pushed the main branch 2 times, most recently from 7faf4b7 to f9f1f56 Compare June 19, 2025 06:45
@hanan619
Copy link
Author

@krish2718
I think all the tests run have passed

@krish2718
Copy link
Contributor

@krish2718 I think all the tests run have passed

No, two twister Jobs got cancelled, I re-ran them now.

@hanan619
Copy link
Author

@krish2718 I think all the tests run have passed

No, two twister Jobs got cancelled, I re-ran them now.

They are cancelled again

@krish2718
Copy link
Contributor

@hanan619 the problem of jobs getting cancelled is because of the source branch named main, from Discord (@kartben )

yeah - pro tip, don't submit PRs to an upstream project from a branch named the same as the upstream's main branch 🙂 That's what's happening here.

Can you please recreate the PR with a different source branch?

@hanan619 hanan619 closed this Jun 19, 2025
@github-actions github-actions bot removed manifest manifest-hostap DNM (manifest) This PR should not be merged (controlled by action-manifest) labels Jun 19, 2025
@hanan619
Copy link
Author

@krish2718 Duplicate PR created with the different source branch
#91916

Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Base OS Base OS Library (lib/os) area: Networking area: Shields Shields (add-on boards) area: Wi-Fi Wi-Fi platform: nRF Nordic nRFx
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants