-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
6lo gnrc fragmentation expects driver to block on TX #7474
Comments
We most definitely need to find a solution that is independent of the stack above. I think the most ideal would be to do proper state handling where |
@miri64 that sounds like the best solution, long term. Do you have any plans on working in this in the near future, or is this only an idea for future improvements? |
No plans yet, just an idea. |
Another thing to consider is that an interface thread can deadspin due to the events and NETAPI messages going to the same queue in GNRC (NETAPI messages would just be returned to the queue in case of TX_COMPLETE not executed yet => would hog the queue => NETDEV_EVENT_ISR messages can't come in) |
Wait... I thought about this a bit more. Is "being busy" meant to wait for an ACK or actually sending? If it is the first: this shouldn't be a problem since the ACK contains a sequence number. If it is the latter: I'm also not sure what the problem with locking a mutex until done is. |
@miri64 busy means either transmitting a packet, or waiting for the RxAck, or in the process of receiving the Ack packet. I solved it for kw41zrf by using a mutex, see https://github.com/RIOT-OS/RIOT/pull/7107/files#diff-463bd50a4a529968ce504e2f13f66b2cR175. This is probably the best solution for the system as a whole, the CPU is freed and can do other things while the transceiver is transmitting and waiting for the Ack. But this has to be done the same way for every network device driver which wants to support 6lowpan fragmentation. Doing this as a busy loop instead of using a mutex, like the at86rf2xx driver does, will prevent the CPU from doing anything useful and also cost more in terms of power consumption. |
Ok so can we close this issue (and maybe open a fix/issue to fix the at86rf2xx in that regard?) |
I still think that the documentation for netdev needs to be improved to clarify that the send method should be blocking. |
I just stumbled upon the same issue for my rewrite of the I would like to point out that an increasing number of network device driver are adding workarounds for this issue, which results in a lot of code duplication. It would clearly better to use, as @miri64 suggested, to wait for |
Adding a note here that LWMAC (and GoMacH perhaps?) also expects blocking until TX is complete. In this case however the kw41zrf mutex solution isn't satisfying the requirement, because LWMAC wants to sleep the radio as soon as TX is complete, which means that netdev_send() really mustn't return until the radio is idle. |
#18139 allows drivers to provide async TX using |
The 6lowpan fragmentation code in gnrc doesn't work when a driver returns an error code if the device is already busy transmitting another packet, instead of blocking the driver thread. This is the case for kw2xrf (#4822) and kw41zrf.
The at86rf2xx driver works with gnrc, but it uses a busy wait until the device reports that it is idle, wasting CPU cycles on doing nothing but reading the spi bus over and over.
The netdev api documentation does not give a clear description which behaviour is correct. It just says that the send method shall return <0 on error, without specifying what should be considered an error.
Either the netdev api documentation needs to be updated to explicitly say that the driver should block if the device is busy, or the gnrc fragmentation code needs to be improved.
Also, it seems like the return value from netdev send is discarded by gnrc, so it doesn't seem to really matter what the driver does on errors.
PS I am working on a solution for the kw41zrf using a mutex to make the thread sleep while waiting for TX to finish, just to get this working properly for a project, but it won't exactly be what I would call a clean solution.
The text was updated successfully, but these errors were encountered: