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
f6f65011
Unverified
Commit
f6f65011
authored
6 years ago
by
Cenk Gündoğan
Committed by
GitHub
6 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #10681 from miri64/gnrc_sixlowpan_frag/cleanup/unroll-recursion
gnrc_sixlowpan_frag: unroll recursion
parents
a9a30c0c
7452f48c
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
sys/net/gnrc/network_layer/sixlowpan/frag/rbuf.c
+24
-7
24 additions, 7 deletions
sys/net/gnrc/network_layer/sixlowpan/frag/rbuf.c
with
24 additions
and
7 deletions
sys/net/gnrc/network_layer/sixlowpan/frag/rbuf.c
+
24
−
7
View file @
f6f65011
...
...
@@ -64,9 +64,27 @@ static bool _rbuf_update_ints(rbuf_t *entry, uint16_t offset, size_t frag_size);
static
rbuf_t
*
_rbuf_get
(
const
void
*
src
,
size_t
src_len
,
const
void
*
dst
,
size_t
dst_len
,
size_t
size
,
uint16_t
tag
,
unsigned
page
);
/* internal add to repeat add when fragments overlapped */
static
int
_rbuf_add
(
gnrc_netif_hdr_t
*
netif_hdr
,
gnrc_pktsnip_t
*
pkt
,
size_t
offset
,
unsigned
page
);
/* status codes for _rbuf_add() */
enum
{
RBUF_ADD_SUCCESS
,
RBUF_ADD_ERROR
,
RBUF_ADD_REPEAT
,
};
void
rbuf_add
(
gnrc_netif_hdr_t
*
netif_hdr
,
gnrc_pktsnip_t
*
pkt
,
size_t
offset
,
unsigned
page
)
{
if
(
_rbuf_add
(
netif_hdr
,
pkt
,
offset
,
page
)
==
RBUF_ADD_REPEAT
)
{
_rbuf_add
(
netif_hdr
,
pkt
,
offset
,
page
);
}
}
static
int
_rbuf_add
(
gnrc_netif_hdr_t
*
netif_hdr
,
gnrc_pktsnip_t
*
pkt
,
size_t
offset
,
unsigned
page
)
{
rbuf_t
*
entry
;
sixlowpan_frag_t
*
frag
=
pkt
->
data
;
...
...
@@ -83,7 +101,7 @@ void rbuf_add(gnrc_netif_hdr_t *netif_hdr, gnrc_pktsnip_t *pkt,
if
(
entry
==
NULL
)
{
DEBUG
(
"6lo rbuf: reassembly buffer full.
\n
"
);
gnrc_pktbuf_release
(
pkt
);
return
;
return
RBUF_ADD_ERROR
;
}
ptr
=
entry
->
ints
;
...
...
@@ -104,7 +122,7 @@ void rbuf_add(gnrc_netif_hdr_t *netif_hdr, gnrc_pktsnip_t *pkt,
DEBUG
(
"6lo rfrag: fragment too big for resulting datagram, discarding datagram
\n
"
);
gnrc_pktbuf_release
(
entry
->
super
.
pkt
);
rbuf_rm
(
entry
);
return
;
return
RBUF_ADD_ERROR
;
}
/* If the fragment overlaps another fragment and differs in either the size
...
...
@@ -119,9 +137,7 @@ void rbuf_add(gnrc_netif_hdr_t *netif_hdr, gnrc_pktsnip_t *pkt,
/* "A fresh reassembly may be commenced with the most recently
* received link fragment"
* https://tools.ietf.org/html/rfc4944#section-5.3 */
rbuf_add
(
netif_hdr
,
pkt
,
offset
,
page
);
return
;
return
RBUF_ADD_REPEAT
;
}
ptr
=
ptr
->
next
;
...
...
@@ -139,10 +155,10 @@ void rbuf_add(gnrc_netif_hdr_t *netif_hdr, gnrc_pktsnip_t *pkt,
gnrc_pktbuf_release
(
entry
->
super
.
pkt
);
gnrc_pktbuf_release
(
pkt
);
rbuf_rm
(
entry
);
return
;
return
RBUF_ADD_ERROR
;
}
gnrc_sixlowpan_iphc_recv
(
pkt
,
&
entry
->
super
,
0
);
return
;
return
RBUF_ADD_SUCCESS
;
}
else
#endif
...
...
@@ -155,6 +171,7 @@ void rbuf_add(gnrc_netif_hdr_t *netif_hdr, gnrc_pktsnip_t *pkt,
}
gnrc_sixlowpan_frag_rbuf_dispatch_when_complete
(
&
entry
->
super
,
netif_hdr
);
gnrc_pktbuf_release
(
pkt
);
return
RBUF_ADD_SUCCESS
;
}
static
inline
bool
_rbuf_int_overlap_partially
(
rbuf_int_t
*
i
,
uint16_t
start
,
uint16_t
end
)
...
...
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