Merge pull request #4186 from cgundogan/pr/ipv6/last_vtimers

network_layer: remove last occurences of vtimer
This commit is contained in:
Cenk Gündoğan 2015-11-02 15:42:50 +01:00
commit 42c5666357
10 changed files with 26 additions and 29 deletions

View File

@ -98,7 +98,7 @@ endif
ifneq (,$(filter gnrc_sixlowpan_frag,$(USEMODULE))) ifneq (,$(filter gnrc_sixlowpan_frag,$(USEMODULE)))
USEMODULE += gnrc_sixlowpan USEMODULE += gnrc_sixlowpan
USEMODULE += vtimer USEMODULE += xtimer
endif endif
ifneq (,$(filter gnrc_sixlowpan_iphc,$(USEMODULE))) ifneq (,$(filter gnrc_sixlowpan_iphc,$(USEMODULE)))
@ -114,7 +114,7 @@ endif
ifneq (,$(filter gnrc_sixlowpan_ctx,$(USEMODULE))) ifneq (,$(filter gnrc_sixlowpan_ctx,$(USEMODULE)))
USEMODULE += ipv6_addr USEMODULE += ipv6_addr
USEMODULE += vtimer USEMODULE += xtimer
endif endif
ifneq (,$(filter gnrc_sixlowpan_nd_border_router,$(USEMODULE))) ifneq (,$(filter gnrc_sixlowpan_nd_border_router,$(USEMODULE)))
@ -130,7 +130,7 @@ ifneq (,$(filter gnrc_sixlowpan_nd,$(USEMODULE)))
USEMODULE += gnrc_ndp_internal USEMODULE += gnrc_ndp_internal
USEMODULE += gnrc_sixlowpan_ctx USEMODULE += gnrc_sixlowpan_ctx
USEMODULE += random USEMODULE += random
USEMODULE += vtimer USEMODULE += xtimer
endif endif
ifneq (,$(filter gnrc_ipv6_default,$(USEMODULE))) ifneq (,$(filter gnrc_ipv6_default,$(USEMODULE)))
@ -160,13 +160,13 @@ endif
ifneq (,$(filter gnrc_ndp_host,$(USEMODULE))) ifneq (,$(filter gnrc_ndp_host,$(USEMODULE)))
USEMODULE += gnrc_ndp_node USEMODULE += gnrc_ndp_node
USEMODULE += random USEMODULE += random
USEMODULE += vtimer USEMODULE += xtimer
endif endif
ifneq (,$(filter gnrc_ndp_router,$(USEMODULE))) ifneq (,$(filter gnrc_ndp_router,$(USEMODULE)))
USEMODULE += gnrc_ndp_node USEMODULE += gnrc_ndp_node
USEMODULE += random USEMODULE += random
USEMODULE += vtimer USEMODULE += xtimer
endif endif
ifneq (,$(filter gnrc_ndp_node,$(USEMODULE))) ifneq (,$(filter gnrc_ndp_node,$(USEMODULE)))
@ -181,7 +181,7 @@ ifneq (,$(filter gnrc_ndp,$(USEMODULE)))
USEMODULE += gnrc_icmpv6 USEMODULE += gnrc_icmpv6
USEMODULE += random USEMODULE += random
USEMODULE += timex USEMODULE += timex
USEMODULE += vtimer USEMODULE += xtimer
endif endif
ifneq (,$(filter gnrc_icmpv6_echo,$(USEMODULE))) ifneq (,$(filter gnrc_icmpv6_echo,$(USEMODULE)))
@ -243,7 +243,7 @@ ifneq (,$(filter gnrc_ipv6_netif,$(USEMODULE)))
USEMODULE += ipv6_addr USEMODULE += ipv6_addr
USEMODULE += gnrc_netif USEMODULE += gnrc_netif
USEMODULE += bitfield USEMODULE += bitfield
USEMODULE += vtimer USEMODULE += xtimer
endif endif
ifneq (,$(filter gnrc_udp,$(USEMODULE))) ifneq (,$(filter gnrc_udp,$(USEMODULE)))

View File

@ -70,7 +70,8 @@ typedef struct {
uint16_t ltime; /**< the time in minutes until deletion */ uint16_t ltime; /**< the time in minutes until deletion */
BITFIELD(ctxs, GNRC_SIXLOWPAN_CTX_SIZE);/**< contexts associated with BR */ BITFIELD(ctxs, GNRC_SIXLOWPAN_CTX_SIZE);/**< contexts associated with BR */
gnrc_sixlowpan_nd_router_prf_t *prfs; /**< prefixes associated with BR */ gnrc_sixlowpan_nd_router_prf_t *prfs; /**< prefixes associated with BR */
vtimer_t ltimer; /**< timer for deletion */ xtimer_t ltimer; /**< timer for deletion */
msg_t ltimer_msg; /**< msg_t for gnrc_sixlowpan_nd_router_abr_t::ltimer */
} gnrc_sixlowpan_nd_router_abr_t; } gnrc_sixlowpan_nd_router_abr_t;
/** /**

View File

@ -24,7 +24,7 @@
#include "net/gnrc/sixlowpan/nd.h" #include "net/gnrc/sixlowpan/nd.h"
#include "thread.h" #include "thread.h"
#include "timex.h" #include "timex.h"
#include "vtimer.h" #include "xtimer.h"
#define ENABLE_DEBUG (0) #define ENABLE_DEBUG (0)
#include "debug.h" #include "debug.h"

View File

@ -30,7 +30,7 @@
#include "random.h" #include "random.h"
#include "utlist.h" #include "utlist.h"
#include "thread.h" #include "thread.h"
#include "vtimer.h" #include "xtimer.h"
#include "net/gnrc/ndp/internal.h" #include "net/gnrc/ndp/internal.h"

View File

@ -17,7 +17,7 @@
#include "net/gnrc/ipv6.h" #include "net/gnrc/ipv6.h"
#include "net/gnrc/ndp.h" #include "net/gnrc/ndp.h"
#include "net/gnrc/ndp/internal.h" #include "net/gnrc/ndp/internal.h"
#include "vtimer.h" #include "xtimer.h"
#include "net/gnrc/ndp/host.h" #include "net/gnrc/ndp/host.h"

View File

@ -21,7 +21,7 @@
#include "net/gnrc/sixlowpan/nd.h" #include "net/gnrc/sixlowpan/nd.h"
#include "random.h" #include "random.h"
#include "timex.h" #include "timex.h"
#include "vtimer.h" #include "xtimer.h"
#include "net/gnrc/ndp/internal.h" #include "net/gnrc/ndp/internal.h"

View File

@ -17,7 +17,7 @@
#include "net/gnrc/ndp/internal.h" #include "net/gnrc/ndp/internal.h"
#include "random.h" #include "random.h"
#include "timex.h" #include "timex.h"
#include "vtimer.h" #include "xtimer.h"
#include "net/gnrc/ndp/router.h" #include "net/gnrc/ndp/router.h"

View File

@ -17,7 +17,7 @@
#include "mutex.h" #include "mutex.h"
#include "net/gnrc/sixlowpan/ctx.h" #include "net/gnrc/sixlowpan/ctx.h"
#include "vtimer.h" #include "xtimer.h"
#define ENABLE_DEBUG (0) #define ENABLE_DEBUG (0)
#include "debug.h" #include "debug.h"
@ -132,9 +132,7 @@ gnrc_sixlowpan_ctx_t *gnrc_sixlowpan_ctx_update(uint8_t id, const ipv6_addr_t *p
static uint32_t _current_minute(void) static uint32_t _current_minute(void)
{ {
timex_t now; return xtimer_now() / (SEC_IN_USEC * 60);
vtimer_now(&now);
return now.seconds / 60;
} }
static void _update_lifetime(uint8_t id) static void _update_lifetime(uint8_t id)

View File

@ -24,7 +24,7 @@
#include "net/sixlowpan.h" #include "net/sixlowpan.h"
#include "thread.h" #include "thread.h"
#include "timex.h" #include "timex.h"
#include "vtimer.h" #include "xtimer.h"
#include "utlist.h" #include "utlist.h"
#define ENABLE_DEBUG (0) #define ENABLE_DEBUG (0)
@ -231,17 +231,15 @@ static bool _rbuf_update_ints(rbuf_t *entry, uint16_t offset, size_t frag_size)
static void _rbuf_gc(void) static void _rbuf_gc(void)
{ {
rbuf_t *oldest = NULL; rbuf_t *oldest = NULL;
timex_t now; uint32_t now_sec = xtimer_now() / SEC_IN_USEC;
unsigned int i; unsigned int i;
vtimer_now(&now);
for (i = 0; i < RBUF_SIZE; i++) { for (i = 0; i < RBUF_SIZE; i++) {
if (rbuf[i].pkt == NULL) { /* leave GC early if there is still room */ if (rbuf[i].pkt == NULL) { /* leave GC early if there is still room */
return; return;
} }
else if ((rbuf[i].pkt != NULL) && else if ((rbuf[i].pkt != NULL) &&
((now.seconds - rbuf[i].arrival) > RBUF_TIMEOUT)) { ((now_sec - rbuf[i].arrival) > RBUF_TIMEOUT)) {
DEBUG("6lo rfrag: entry (%s, ", gnrc_netif_addr_to_str(l2addr_str, DEBUG("6lo rfrag: entry (%s, ", gnrc_netif_addr_to_str(l2addr_str,
sizeof(l2addr_str), rbuf[i].src, rbuf[i].src_len)); sizeof(l2addr_str), rbuf[i].src, rbuf[i].src_len));
DEBUG("%s, %u, %u) timed out\n", DEBUG("%s, %u, %u) timed out\n",
@ -269,9 +267,7 @@ static rbuf_t *_rbuf_get(const void *src, size_t src_len,
size_t size, uint16_t tag) size_t size, uint16_t tag)
{ {
rbuf_t *res = NULL; rbuf_t *res = NULL;
timex_t now; uint32_t now_sec = xtimer_now() / SEC_IN_USEC;
vtimer_now(&now);
for (unsigned int i = 0; i < RBUF_SIZE; i++) { for (unsigned int i = 0; i < RBUF_SIZE; i++) {
/* check first if entry already available */ /* check first if entry already available */
@ -287,7 +283,7 @@ static rbuf_t *_rbuf_get(const void *src, size_t src_len,
gnrc_netif_addr_to_str(l2addr_str, sizeof(l2addr_str), gnrc_netif_addr_to_str(l2addr_str, sizeof(l2addr_str),
rbuf[i].dst, rbuf[i].dst_len), rbuf[i].dst, rbuf[i].dst_len),
(unsigned)rbuf[i].pkt->size, rbuf[i].tag); (unsigned)rbuf[i].pkt->size, rbuf[i].tag);
rbuf[i].arrival = now.seconds; rbuf[i].arrival = now_sec;
return &(rbuf[i]); return &(rbuf[i]);
} }
@ -306,7 +302,7 @@ static rbuf_t *_rbuf_get(const void *src, size_t src_len,
*((uint64_t *)res->pkt->data) = 0; /* clean first few bytes for later *((uint64_t *)res->pkt->data) = 0; /* clean first few bytes for later
* look-ups */ * look-ups */
res->arrival = now.seconds; res->arrival = now_sec;
memcpy(res->src, src, src_len); memcpy(res->src, src, src_len);
memcpy(res->dst, dst, dst_len); memcpy(res->dst, dst, dst_len);
res->src_len = src_len; res->src_len = src_len;

View File

@ -241,8 +241,10 @@ void gnrc_sixlowpan_nd_opt_abr_handle(kernel_pid_t iface, ndp_rtr_adv_t *rtr_adv
t.seconds = abr->ltime * 60; t.seconds = abr->ltime * 60;
vtimer_set_msg(&abr->ltimer, t, gnrc_ipv6_pid, xtimer_remove(&abr->ltimer);
GNRC_SIXLOWPAN_ND_MSG_ABR_TIMEOUT, abr); abr->ltimer_msg.type = GNRC_SIXLOWPAN_ND_MSG_ABR_TIMEOUT;
abr->ltimer_msg.content.ptr = (char *) abr;
xtimer_set_msg(&abr->ltimer, (uint32_t) timex_uint64(t), &abr->ltimer_msg, gnrc_ipv6_pid);
} }
gnrc_pktsnip_t *gnrc_sixlowpan_nd_opt_6ctx_build(uint8_t prefix_len, uint8_t flags, uint16_t ltime, gnrc_pktsnip_t *gnrc_sixlowpan_nd_opt_6ctx_build(uint8_t prefix_len, uint8_t flags, uint16_t ltime,