-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
Enable SimpleLink socket blocking/non-blocking mode to be set via fcntl() #11891
Comments
@GAnthony, #11438 introduced Do you transfer socket offload maintainership to Vincent? Can you introduce him to these matters and invite to the discussions in these tickets? |
@pfalcon, thanks for your comment.
Yes to both. I recommended updating the socket_offload struct with fcntl() as a solution for a few reasons:
So, my suggestion would be to update the socket_offload_ops first; then start to move socket offload over to the new socket offload point (whatever that will be in a few months time). |
To clarify a bit more, we are in the process of such 'transfer of ownership', but I would say this month is mainly taken up by "ramp-up" activities (oh, and I guess a bit of holiday time). For this month, I should probably still be considered as "owner". |
As long as we accept that it's going to be "wasted work" in the end, yes ;-).
Well, it was merged in 2018-10, it exists as an implementation for much longer than that, and from day 1, a concern was raised that a proper offloading implementation should not hog the entire socket subsys for itself, there should be a way for different socket impls to co-exists, and #11438 implements just that.
#11438 is exactly the answer to those challenges. We of course may need to tweak things (more so specifically for re-incorporating offloading features in that framework), but otherwise it already has laid the ground where there's a framework for integrating different socket types under a common API.
Again, that's not the scope #11438, it extended fdtable approach as implemented previously to extend beyond just file operations (read/write/ioctl) to all individual socket operations (poll/select aren't directly addressed, yeah). It effectively pushed what offloading did a level up in the architecture, with support for multiple such "offloadings". Even native plain Zephyr sockets are now "offloaded" to their own implementation.
Sounds good to me, given that conversion to sock_op_table probably won't fit into 1.14. Otherwise, wanted to share the perspective, and surely, things may change, there's e.g. cleanup/elaboration to do for that infra. |
Hello @GAnthony Is there any work in progress regarding adding support to I agree with @pfalcon that eventually we should switch to the extended fdtable with socket offloading, but there's no need to rush things IMO, let's allow the API to settle. |
IMHO, with such approach we just do extra legwork and accumulate technical debt (which we have a lot already). |
|
Note that one idea I have is to make ioctl(FIONBIO) to be primary means to set non-blocking mode, and route fcntl() via it. More background: https://stackoverflow.com/questions/1150635/unix-nonblocking-i-o-o-nonblock-vs-fionbio |
This commit implements fcntl() in the SimpleLink Wifi driver to set and get the non-blocking mode on a socket. Fixes zephyrproject-rtos#11891. Signed-off-by: Vincent Wan <vincent.wan@linaro.org>
In Zephyr (and for POSIX sockets), setting blocking/non-blocking mode for TCP sockets is done using
fcntl()
:However, the SimpleLink host driver currently used in by the cc3220sf WiFi socket offload driver only allows setting of the blocking mode via its
setsockopt()
API.This fix is needed for the samples/net/sockets/echo_async sample program to work, as well as other future networking apps.
A possible solution:
Add a new
fcntl()
function field in thesocket_offload_ops.h:struct socket_offload
structure, and implement that fcntl function in simplelink_sockets.c to callsl_SetSockOpt()
.The text was updated successfully, but these errors were encountered: