sys/net/gnrc/sock: cleanup & fix aux handling
The logic used to check whether the RX timestamp was provided in the GNRC implementation of `sock_ip_recv_buf_aux()` is incorrect: It still uses in-band signalling via a timestamp of zero, but a dedicated flag was added to allow for timestamps of zero. Additionally, it is not necessary to check if a bit is set only to clear it - clearing it unconditionally is faster and smaller.
This commit is contained in:
parent
3fdf9f925e
commit
8f24cc840c
@ -158,18 +158,13 @@ ssize_t sock_ip_recv_buf_aux(sock_ip_t *sock, void **data, void **buf_ctx,
|
|||||||
return -EPROTO;
|
return -EPROTO;
|
||||||
}
|
}
|
||||||
#if IS_USED(MODULE_SOCK_AUX_LOCAL)
|
#if IS_USED(MODULE_SOCK_AUX_LOCAL)
|
||||||
if ((aux != NULL) && (aux->flags & SOCK_AUX_GET_LOCAL)) {
|
if (aux != NULL) {
|
||||||
aux->flags &= ~(SOCK_AUX_GET_LOCAL);
|
aux->flags &= ~(SOCK_AUX_GET_LOCAL);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if IS_USED(MODULE_SOCK_AUX_TIMESTAMP)
|
#if IS_USED(MODULE_SOCK_AUX_TIMESTAMP)
|
||||||
if ((aux != NULL) && (aux->flags & SOCK_AUX_GET_TIMESTAMP)) {
|
if ((aux != NULL) && (_aux.flags & GNRC_SOCK_RECV_AUX_FLAG_TIMESTAMP)) {
|
||||||
/* check if network interface did provide a timestamp; this depends on
|
aux->flags &= ~(SOCK_AUX_GET_TIMESTAMP);
|
||||||
* hardware support. A timestamp of zero is used to indicate a missing
|
|
||||||
* timestamp */
|
|
||||||
if (aux->timestamp > 0) {
|
|
||||||
aux->flags &= ~SOCK_AUX_GET_TIMESTAMP;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
*data = pkt->data;
|
*data = pkt->data;
|
||||||
|
|||||||
@ -258,13 +258,8 @@ ssize_t sock_udp_recv_buf_aux(sock_udp_t *sock, void **data, void **buf_ctx,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if IS_USED(MODULE_SOCK_AUX_TIMESTAMP)
|
#if IS_USED(MODULE_SOCK_AUX_TIMESTAMP)
|
||||||
if ((aux != NULL) && (aux->flags & SOCK_AUX_GET_TIMESTAMP)) {
|
if ((aux != NULL) && (_aux.flags & GNRC_SOCK_RECV_AUX_FLAG_TIMESTAMP)) {
|
||||||
/* check if network interface did provide a timestamp; this depends on
|
aux->flags &= ~SOCK_AUX_GET_TIMESTAMP;
|
||||||
* hardware support. A timestamp of zero is used to indicate a missing
|
|
||||||
* timestamp */
|
|
||||||
if (_aux.flags & GNRC_SOCK_RECV_AUX_FLAG_TIMESTAMP) {
|
|
||||||
aux->flags &= ~SOCK_AUX_GET_TIMESTAMP;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
*data = pkt->data;
|
*data = pkt->data;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user