-
Notifications
You must be signed in to change notification settings - Fork 2.1k
drivers/netdev: Add info on transmission #14625
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
Conversation
* | ||
* @pre `(dev != NULL) && (iolist != NULL` | ||
* | ||
* @param[in] dev Network device descriptor. Must not be NULL. | ||
* @param[in] iolist IO vector list to send. Elements of this list may | ||
* @param[in] dev Network device descriptor. Must not be NULL. | ||
* @param[in] iolist IO vector list to send. Elements of this list may | ||
* have iolist_t::iol_data == NULL or | ||
* iolist_t::iol_size == 0. However, unless otherwise | ||
* specified by the device, the *first* element | ||
* must contain data. | ||
* @param[out] info Status information of the transmission. Might | ||
* be of different type for different netdev devices. | ||
* May be NULL if not needed or applicable. | ||
* | ||
* @return negative errno on error | ||
* @return number of bytes sent | ||
*/ | ||
int (*send)(netdev_t *dev, const iolist_t *iolist); | ||
int (*send)(netdev_t *dev, const iolist_t *iolist, void *info); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the actual change of this PR; The remaining stuff is just porting the code to this API change.
Note: Please wait with the in-depth review until Murdock is happy. I intent to fix all compilation issues up front. |
547bcbb
to
c5d5fac
Compare
As this was originally not introduced since there was no use case, the question is obvious: what is your use case? |
Specifically, I would like to implement PTP. For that, I need to have the exact time stamp when a frame was send (the start of frame delimiter specifically). Other use cases would be:
|
Extend `netdev_driver_t::send()` to take an additional `void *info` parameter to allow passing info on the transmission in the same fashion `netdev_driver_t::recv()` passes info about the received frame.
We had an offline conversation once with @miri64 about such a feature and I think it's nice to have. My only concern is about putting this in the The use cases you descirbe there would require to block the send function (as opposed to a handler in TX_START or TX_END). |
I indeed have, but I decided against this for two reasons:
With the new Radio HAL and an explicit |
Hmmm, but that would mean all drivers should be implemented as blocking. I'm not against the concept, but IMO it should be at least consistent with all implementations (or at least classes of device drivers). Otherwise getting TX info might not be feasible for several devices (e.g AT86RF2xx writes TX information on TX_DONE event, and the current implementation is non-blocking) |
I agree.
I also agree. But I'm not sure if it is worth the effort to touch all the If have two options in mind:
|
I agree and this would be my preferred option. The problem with 1. is the fact that is hard to implement upper layers if the function can be blocking or non-blocking depending of the implementation. For instance, if all IEEE802.15.4 drivers are blocking, one could think of a retransmission procedure like: while (retrans-- > 0) {
int res = dev->driver->send(...);
if (res == 0) {
break;
}
} If the |
I'll open a new PR for this and keep this as reference. I should be able to open the PR some time today. |
Alternative proposal got merged, this is not needed anymore |
Contribution description
Extend
netdev_driver_t::send()
to take an additionalvoid *info
parameter to allow passing info on the transmission in the same fashionnetdev_driver_t::recv()
passes info about the received frame.Testing procedure
Issues/PRs references