Merge pull request #15042 from maribu/gnrc_dont_include_xtimer_when_not_used
sys/net/gnrc/netif: Fix compilation on waspmote-pro
This commit is contained in:
commit
711ea275e9
@ -23,14 +23,16 @@
|
||||
#include "net/ethernet.h"
|
||||
#include "net/ipv6.h"
|
||||
#include "net/gnrc.h"
|
||||
#ifdef MODULE_GNRC_IPV6_NIB
|
||||
#if IS_USED(MODULE_GNRC_IPV6_NIB)
|
||||
#include "net/gnrc/ipv6/nib.h"
|
||||
#include "net/gnrc/ipv6.h"
|
||||
#endif /* MODULE_GNRC_IPV6_NIB */
|
||||
#endif /* IS_USED(MODULE_GNRC_IPV6_NIB) */
|
||||
#if IS_USED(MODULE_GNRC_NETIF_PKTQ)
|
||||
#include "net/gnrc/netif/pktq.h"
|
||||
#ifdef MODULE_NETSTATS
|
||||
#endif /* IS_USED(MODULE_GNRC_NETIF_PKTQ) */
|
||||
#if IS_USED(MODULE_NETSTATS)
|
||||
#include "net/netstats.h"
|
||||
#endif
|
||||
#endif /* IS_USED(MODULE_NETSTATS) */
|
||||
#include "fmt.h"
|
||||
#include "log.h"
|
||||
#include "sched.h"
|
||||
@ -1386,21 +1388,23 @@ static void _process_events_await_msg(gnrc_netif_t *netif, msg_t *msg)
|
||||
|
||||
static void _send_queued_pkt(gnrc_netif_t *netif)
|
||||
{
|
||||
if (IS_USED(MODULE_GNRC_NETIF_PKTQ)) {
|
||||
(void)netif;
|
||||
#if IS_USED(MODULE_GNRC_NETIF_PKTQ)
|
||||
gnrc_pktsnip_t *pkt;
|
||||
|
||||
if ((pkt = gnrc_netif_pktq_get(netif)) != NULL) {
|
||||
_send(netif, pkt, true);
|
||||
gnrc_netif_pktq_sched_get(netif);
|
||||
}
|
||||
}
|
||||
#endif /* IS_USED(MODULE_GNRC_NETIF_PKTQ) */
|
||||
}
|
||||
|
||||
static void _send(gnrc_netif_t *netif, gnrc_pktsnip_t *pkt, bool push_back)
|
||||
{
|
||||
(void)push_back; /* only used with IS_USED(MODULE_GNRC_NETIF_PKTQ) */
|
||||
int res;
|
||||
|
||||
if (IS_USED(MODULE_GNRC_NETIF_PKTQ)) {
|
||||
#if IS_USED(MODULE_GNRC_NETIF_PKTQ)
|
||||
/* send queued packets first to keep order */
|
||||
if (!push_back && !gnrc_netif_pktq_empty(netif)) {
|
||||
int put_res;
|
||||
@ -1419,9 +1423,10 @@ static void _send(gnrc_netif_t *netif, gnrc_pktsnip_t *pkt, bool push_back)
|
||||
/* hold in case device was busy to not having to rewrite *all* the link
|
||||
* layer implementations in case `gnrc_netif_pktq` is included */
|
||||
gnrc_pktbuf_hold(pkt, 1);
|
||||
}
|
||||
#endif /* IS_USED(MODULE_GNRC_NETIF_PKTQ) */
|
||||
res = netif->ops->send(netif, pkt);
|
||||
if (IS_USED(MODULE_GNRC_NETIF_PKTQ) && (res == -EBUSY)) {
|
||||
#if IS_USED(MODULE_GNRC_NETIF_PKTQ)
|
||||
if (res == -EBUSY) {
|
||||
int put_res;
|
||||
|
||||
/* Lower layer was busy.
|
||||
@ -1446,10 +1451,11 @@ static void _send(gnrc_netif_t *netif, gnrc_pktsnip_t *pkt, bool push_back)
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if (IS_USED(MODULE_GNRC_NETIF_PKTQ)) {
|
||||
else {
|
||||
/* remove previously held packet */
|
||||
gnrc_pktbuf_release(pkt);
|
||||
}
|
||||
#endif /* IS_USED(MODULE_GNRC_NETIF_PKTQ) */
|
||||
if (res < 0) {
|
||||
DEBUG("gnrc_netif: error sending packet %p (code: %i)\n",
|
||||
(void *)pkt, res);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user