-
Notifications
You must be signed in to change notification settings - Fork 7.5k
Race between SimpleLink WiFi driver FastConnect and networking app startup. #11889
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
Comments
The option 2. is probably the best one to implement. Our network config library is quite simple still and needs some TLC indeed. If the user does not set hard coded IP addresses in prj.conf file, then the net config library cannot add any addresses itself. So there should be no issue with this in real life, except that by default all the samples set some IP address to the application. But I would argue that the samples need typically tweaking anyway and should not be used blindly. Suggestions how to make this more user friendly are welcome of course. One thing we could do is to create |
Yes, option 2 would be a more generic approach. Perhaps the first step would be to get net/lib/config/init.c to build if Regarding adding a new wifi_settings.c, it may not be necessary if the race in awaiting an This isn't strictly waiting for a "connection event", but for the SimpleLink case this would work because the DHCP is always enabled, and a net_if_ipv4_addr_add() always occurs soon after. |
An interesting idea, but thinking about this some more, it gets a bit complex:
Given this, and LTS coming soon (?), we're thinking to opt for solution 1) to not inadvertently impact other users of |
The SimpleLink wifi driver enables the Fast Connect method of WiFi provisioning, which allows the network coprocessor to reconnect to a previously connected Access Point (AP) on startup. Previously, if Fast Connect failed to connect, any network socket applications would inevitably fail, as there would have been no wifi connection. This patch adds a configurable timeout for the Fast Connect feature, after which timeout, an error is logged informing the user to manually reconnect to an AP. Reconnection is typically accomplished by separately running the wifi sample shell program. Fixes: zephyrproject-rtos#11889 Signed-off-by: Gil Pitney <[email protected]>
The SimpleLink wifi driver enables the Fast Connect method of WiFi provisioning, which allows the network coprocessor to reconnect to a previously connected Access Point (AP) on startup. Previously, if Fast Connect failed to connect, any network socket applications would inevitably fail, as there would have been no wifi connection. This patch adds a configurable timeout for the Fast Connect feature, after which timeout, an error is logged informing the user to manually reconnect to an AP. Reconnection is typically accomplished by separately running the wifi sample shell program. Fixes: #11889 Signed-off-by: Gil Pitney <[email protected]>
To simplify the WiFi provisioning of the SimpleLink WiFi based device, the SimpleLink WiFi driver is configured to do an automatic connect ("FastConnect") to the previously connected Access Point (AP).
The initialization of the WiFi driver occurs in the driver's iface_init call:
simplelink_iface_init()
, which is called by the networking subsystem before the main networking application begins. However, the WiFi connection may complete sometime later, after the main networking application begins, so networking apps may simply fail in their socket orgetaddrinfo()
calls, due to the lack of WiFi connection.There is a provision in the networking subsystem to configure a synchronization point between networking events and the start of the main application:
CONFIG_NET_CONFIG_AUTO_INIT
, which causes a call toinit_net_app()
before the main application starts, which can wait with a timeout for configured networking events (likeNET_EVENT_IPV4_ADD_ADD
for example).However, there are issues with this approach:
init_net_app()
registers a handler to listen for it - so the event is missed;init_net_app()
does not listen for WiFi connections (as that could be an option instead of IPV4);init_net_app()
requires settingCONFIG_NET_CONFIG_SETTINGS
, which forces hardcoded values for IP address, which is not desired for an offload driver which already handles DHCP, and brings in other unnecessary functions.To reproduce, build/run the samples/net/sockets/http_get example on the cc3220sf_launchxl.
This example often fails unless there is a breakpoint at main allowing some time to for the WiFi connection to succeed.
Some options for a solution:
simplelink_iface_init()
until the connection is made. This would be the simplest fix, not involving any changes to the networking config module.The text was updated successfully, but these errors were encountered: