Skip to content
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

zephyr: Update SoftAP event functions of Zephyr with hostapd enabled #72

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

nxf58150
Copy link
Contributor

Update SoftAP event functions of Zephyr with hostapd enabled.

supplicant_send_wifi_mgmt_ap_status(iface,
NET_EVENT_WIFI_CMD_AP_ENABLE_RESULT,
WIFI_STATUS_AP_SUCCESS);
#endif /* __ZEPHYR__ && CONFIG_WIFI_NM_HOSTAPD_AP */
#endif /* CONFIG_WIFI_NM_HOSTAPD_AP */
#endif /* __ZEPHYR__ */

Choose a reason for hiding this comment

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

There is something nasty here. iface is a struct hostapd_iface *. However, supplicant_send_wifi_mgmt_ap_status() cast it in struct wpa_supplicant *.

In addition, this compile time condition prevent to choose AP or supplicant mode during runtime (even if it not yet supported, we probably want to do it in the future).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is for softAP with hostapd only so I removed function call of supplicant_send_wifi_mgmt_ap_status() here.
I think this PR is targeting on hostapd support split. For choosing mode at runtime, more changes could be made in the future once the feature is required and have detailed plan.
Thanks!

#else
supplicant_send_wifi_mgmt_ap_sta_event(hapd->iface->owner,
event,
sta);
#endif
#endif /* CONFIG_WIFI_NM_HOSTAPD_AP */
#endif /* __ZEPHYR__ */

Choose a reason for hiding this comment

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

Ditto. I believe we need to evaluate this condition during runtime:

    if (IS_ENABLED(CONFIG_WIFI_NM_HOSTAPD_AP) && is_softap_running) {
        hostapd_send_wifi_mgmt_ap_sta_event(...);
    } else if (IS_ENABLED(CONFIG_WIFI_NM_WPA_SUPPLICANT) && !is_softap_running) {
        supplicant_send_wifi_mgmt_ap_sta_event(...);
    } else {
       /* Panic! */
    }

BTW, I feel this code should be relocated in zephyr.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Same as previous reply, for choosing mode at runtime, more changes could be made in the future once the feature is required and have detailed plan.
Thanks!

Choose a reason for hiding this comment

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

I believe my comment is still relevant even if is_softap_running does not exist:

    if (IS_ENABLED(CONFIG_WIFI_NM_HOSTAPD_AP)) {
        hostapd_send_wifi_mgmt_ap_sta_event(...);
    } else {
        supplicant_send_wifi_mgmt_ap_sta_event(...);
    }

(In order to compile this, you have to include hapd_events.h and supp_events.h unconditionally).

BTW, rather than duplicating this pattern everywhere in hostapd, isn't it possible to locate it in one/two functions in the Zephyr side?

@jukkar
Copy link
Member

jukkar commented Feb 3, 2025

ping @nxf58150 could you address the comments from @jerome-pouiller

@nxf58150
Copy link
Contributor Author

nxf58150 commented Feb 8, 2025

ping @nxf58150 could you address the comments from @jerome-pouiller

Just back to office from Chinese New Year Holiday. Will update PR soon. Thanks!

Update SoftAP event functions of Zephyr with hostapd enabled to support
hostapd split in glue layer.

Signed-off-by: Hui Bai <[email protected]>
#include <supp_events.h>
#endif /* CONFIG_WIFI_NM_HOSTAPD_AP */

Choose a reason for hiding this comment

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

Is supp_events.h still required?

#else
supplicant_send_wifi_mgmt_ap_sta_event(hapd->iface->owner,
event,
sta);
#endif
#endif /* CONFIG_WIFI_NM_HOSTAPD_AP */
#endif /* __ZEPHYR__ */

Choose a reason for hiding this comment

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

I believe my comment is still relevant even if is_softap_running does not exist:

    if (IS_ENABLED(CONFIG_WIFI_NM_HOSTAPD_AP)) {
        hostapd_send_wifi_mgmt_ap_sta_event(...);
    } else {
        supplicant_send_wifi_mgmt_ap_sta_event(...);
    }

(In order to compile this, you have to include hapd_events.h and supp_events.h unconditionally).

BTW, rather than duplicating this pattern everywhere in hostapd, isn't it possible to locate it in one/two functions in the Zephyr side?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants