Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
RIOT
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cm-projects
RIOT
Commits
3b825c25
Commit
3b825c25
authored
9 years ago
by
Cenk Gündoğan
Browse files
Options
Downloads
Patches
Plain Diff
sixlowpan: use xtimer_now() instead of vtimer_now()
parent
023c0984
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
sys/net/gnrc/network_layer/sixlowpan/ctx/gnrc_sixlowpan_ctx.c
+2
-3
2 additions, 3 deletions
...net/gnrc/network_layer/sixlowpan/ctx/gnrc_sixlowpan_ctx.c
sys/net/gnrc/network_layer/sixlowpan/frag/rbuf.c
+5
-9
5 additions, 9 deletions
sys/net/gnrc/network_layer/sixlowpan/frag/rbuf.c
with
7 additions
and
12 deletions
sys/net/gnrc/network_layer/sixlowpan/ctx/gnrc_sixlowpan_ctx.c
+
2
−
3
View file @
3b825c25
...
@@ -18,6 +18,7 @@
...
@@ -18,6 +18,7 @@
#include
"mutex.h"
#include
"mutex.h"
#include
"net/gnrc/sixlowpan/ctx.h"
#include
"net/gnrc/sixlowpan/ctx.h"
#include
"vtimer.h"
#include
"vtimer.h"
#include
"xtimer.h"
#define ENABLE_DEBUG (0)
#define ENABLE_DEBUG (0)
#include
"debug.h"
#include
"debug.h"
...
@@ -132,9 +133,7 @@ gnrc_sixlowpan_ctx_t *gnrc_sixlowpan_ctx_update(uint8_t id, const ipv6_addr_t *p
...
@@ -132,9 +133,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
)
...
...
This diff is collapsed.
Click to expand it.
sys/net/gnrc/network_layer/sixlowpan/frag/rbuf.c
+
5
−
9
View file @
3b825c25
...
@@ -231,17 +231,15 @@ static bool _rbuf_update_ints(rbuf_t *entry, uint16_t offset, size_t frag_size)
...
@@ -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
.
sec
onds
-
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,
...
@@ -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,
...
@@ -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
.
sec
onds
;
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,
...
@@ -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
.
sec
onds
;
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
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment