mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-12-16 18:13:49 +01:00
netdev_tap: port to netdev_new_api
This commit is contained in:
parent
7832253f39
commit
3ba131c0f2
@ -41,7 +41,7 @@ ifneq (,$(filter socket_zep,$(USEMODULE)))
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
ifneq (,$(filter netdev_tap,$(USEMODULE)))
|
ifneq (,$(filter netdev_tap,$(USEMODULE)))
|
||||||
USEMODULE += netdev_legacy_api
|
USEMODULE += netdev_new_api
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifneq (,$(filter libc_gettimeofday,$(USEMODULE)))
|
ifneq (,$(filter libc_gettimeofday,$(USEMODULE)))
|
||||||
|
|||||||
@ -166,6 +166,17 @@ static int _set(netdev_t *dev, netopt_t opt, const void *value, size_t value_len
|
|||||||
return res;
|
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 = {
|
static const netdev_driver_t netdev_driver_tap = {
|
||||||
.send = _send,
|
.send = _send,
|
||||||
.recv = _recv,
|
.recv = _recv,
|
||||||
@ -173,6 +184,7 @@ static const netdev_driver_t netdev_driver_tap = {
|
|||||||
.isr = _isr,
|
.isr = _isr,
|
||||||
.get = _get,
|
.get = _get,
|
||||||
.set = _set,
|
.set = _set,
|
||||||
|
.confirm_send = _confirm_send,
|
||||||
};
|
};
|
||||||
|
|
||||||
/* driver implementation */
|
/* driver implementation */
|
||||||
@ -293,12 +305,7 @@ static int _send(netdev_t *netdev, const iolist_t *iolist)
|
|||||||
unsigned n;
|
unsigned n;
|
||||||
iolist_to_iovec(iolist, iov, &n);
|
iolist_to_iovec(iolist, iov, &n);
|
||||||
|
|
||||||
int res = _native_writev(dev->tap_fd, iov, n);
|
return _native_writev(dev->tap_fd, iov, n);
|
||||||
|
|
||||||
if (netdev->event_callback) {
|
|
||||||
netdev->event_callback(netdev, NETDEV_EVENT_TX_COMPLETE);
|
|
||||||
}
|
|
||||||
return res;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void netdev_tap_setup(netdev_tap_t *dev, const netdev_tap_params_t *params, int index) {
|
void netdev_tap_setup(netdev_tap_t *dev, const netdev_tap_params_t *params, int index) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user