Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

netdev_tap: port to netdev_new_api #21015

Merged
merged 1 commit into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cpu/native/Makefile.dep
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ ifneq (,$(filter socket_zep,$(USEMODULE)))
endif

ifneq (,$(filter netdev_tap,$(USEMODULE)))
USEMODULE += netdev_legacy_api
USEMODULE += netdev_new_api
endif

ifneq (,$(filter libc_gettimeofday,$(USEMODULE)))
Expand Down
19 changes: 13 additions & 6 deletions cpu/native/netdev_tap/netdev_tap.c
Original file line number Diff line number Diff line change
Expand Up @@ -166,13 +166,25 @@
return res;
}

static int _confirm_send(netdev_t *netdev, void *info)
{
(void)netdev;
(void)info;

/* confirm_send should not be called with synchronos send */
assert(0);

return -EOPNOTSUPP;
}

static const netdev_driver_t netdev_driver_tap = {
.send = _send,
.recv = _recv,
.init = _init,
.isr = _isr,
.get = _get,
.set = _set,
.confirm_send = _confirm_send,
};

/* driver implementation */
Expand Down Expand Up @@ -293,12 +305,7 @@
unsigned n;
iolist_to_iovec(iolist, iov, &n);

int res = _native_writev(dev->tap_fd, iov, n);

if (netdev->event_callback) {
netdev->event_callback(netdev, NETDEV_EVENT_TX_COMPLETE);
}
return res;
return _native_writev(dev->tap_fd, iov, n);
}

void netdev_tap_setup(netdev_tap_t *dev, const netdev_tap_params_t *params, int index) {
Expand Down Expand Up @@ -352,7 +359,7 @@
struct ifaddrs *iflist;
if (real_getifaddrs(&iflist) == 0) {
for (struct ifaddrs *cur = iflist; cur; cur = cur->ifa_next) {
if ((cur->ifa_addr->sa_family == AF_LINK) && (strcmp(cur->ifa_name, name) == 0) && cur->ifa_addr) {

Check warning on line 362 in cpu/native/netdev_tap/netdev_tap.c

View workflow job for this annotation

GitHub Actions / static-tests

line is longer than 100 characters
struct sockaddr_dl *sdl = (struct sockaddr_dl *)cur->ifa_addr;
memcpy(dev->addr, LLADDR(sdl), sdl->sdl_alen);
break;
Expand Down
Loading