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
ff6b8aa4
You need to sign in or sign up before continuing.
Commit
ff6b8aa4
authored
7 years ago
by
Kaspar Schleiser
Browse files
Options
Downloads
Patches
Plain Diff
cpu/native/netdev_tap: adapt to netdev with iolist
parent
51dabf93
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
Makefile.dep
+1
-0
1 addition, 0 deletions
Makefile.dep
cpu/native/netdev_tap/netdev_tap.c
+13
-8
13 additions, 8 deletions
cpu/native/netdev_tap/netdev_tap.c
with
14 additions
and
8 deletions
Makefile.dep
+
1
−
0
View file @
ff6b8aa4
...
@@ -110,6 +110,7 @@ endif
...
@@ -110,6 +110,7 @@ endif
ifneq
(,$(filter netdev_tap,$(USEMODULE)))
ifneq
(,$(filter netdev_tap,$(USEMODULE)))
USEMODULE
+=
netif
USEMODULE
+=
netif
USEMODULE
+=
netdev_eth
USEMODULE
+=
netdev_eth
USEMODULE
+=
iolist
endif
endif
ifneq
(,$(filter gnrc_tftp,$(USEMODULE)))
ifneq
(,$(filter gnrc_tftp,$(USEMODULE)))
...
...
This diff is collapsed.
Click to expand it.
cpu/native/netdev_tap/netdev_tap.c
+
13
−
8
View file @
ff6b8aa4
...
@@ -26,6 +26,7 @@
...
@@ -26,6 +26,7 @@
#include
<stdlib.h>
#include
<stdlib.h>
#include
<string.h>
#include
<string.h>
#include
<sys/ioctl.h>
#include
<sys/ioctl.h>
#include
<sys/uio.h>
#include
<unistd.h>
#include
<unistd.h>
/* needs to be included before native's declarations of ntohl etc. */
/* needs to be included before native's declarations of ntohl etc. */
...
@@ -51,6 +52,7 @@
...
@@ -51,6 +52,7 @@
#include
"async_read.h"
#include
"async_read.h"
#include
"iolist.h"
#include
"net/eui64.h"
#include
"net/eui64.h"
#include
"net/netdev.h"
#include
"net/netdev.h"
#include
"net/netdev/eth.h"
#include
"net/netdev/eth.h"
...
@@ -64,7 +66,7 @@
...
@@ -64,7 +66,7 @@
/* netdev interface */
/* netdev interface */
static
int
_init
(
netdev_t
*
netdev
);
static
int
_init
(
netdev_t
*
netdev
);
static
int
_send
(
netdev_t
*
netdev
,
const
struct
iovec
*
vector
,
unsigned
n
);
static
int
_send
(
netdev_t
*
netdev
,
const
iolist_t
*
iolist
);
static
int
_recv
(
netdev_t
*
netdev
,
void
*
buf
,
size_t
n
,
void
*
info
);
static
int
_recv
(
netdev_t
*
netdev
,
void
*
buf
,
size_t
n
,
void
*
info
);
static
inline
void
_get_mac_addr
(
netdev_t
*
netdev
,
uint8_t
*
dst
)
static
inline
void
_get_mac_addr
(
netdev_t
*
netdev
,
uint8_t
*
dst
)
...
@@ -273,17 +275,20 @@ static int _recv(netdev_t *netdev, void *buf, size_t len, void *info)
...
@@ -273,17 +275,20 @@ static int _recv(netdev_t *netdev, void *buf, size_t len, void *info)
return
-
1
;
return
-
1
;
}
}
static
int
_send
(
netdev_t
*
netdev
,
const
struct
iovec
*
vector
,
unsigned
n
)
static
int
_send
(
netdev_t
*
netdev
,
const
iolist_t
*
iolist
)
{
{
netdev_tap_t
*
dev
=
(
netdev_tap_t
*
)
netdev
;
netdev_tap_t
*
dev
=
(
netdev_tap_t
*
)
netdev
;
int
res
=
_native_writev
(
dev
->
tap_fd
,
vector
,
n
);
struct
iovec
iov
[
iolist_count
(
iolist
)];
unsigned
n
;
size_t
bytes
=
iolist_to_iovec
(
iolist
,
iov
,
&
n
);
int
res
=
_native_writev
(
dev
->
tap_fd
,
iov
,
n
);
#ifdef MODULE_NETSTATS_L2
#ifdef MODULE_NETSTATS_L2
size_t
bytes
=
0
;
for
(
unsigned
i
=
0
;
i
<
n
;
i
++
)
{
bytes
+=
vector
->
iov_len
;
vector
++
;
}
netdev
->
stats
.
tx_bytes
+=
bytes
;
netdev
->
stats
.
tx_bytes
+=
bytes
;
#else
(
void
)
bytes
;
#endif
#endif
if
(
netdev
->
event_callback
)
{
if
(
netdev
->
event_callback
)
{
netdev
->
event_callback
(
netdev
,
NETDEV_EVENT_TX_COMPLETE
);
netdev
->
event_callback
(
netdev
,
NETDEV_EVENT_TX_COMPLETE
);
...
...
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