static int _send(netdev2_t *netdev, const struct iovec *vector, unsigned n) { netdev2_tap_t *dev = (netdev2_tap_t*)netdev; int res = _native_writev(dev->tap_fd, vector, n); #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; #endif if (netdev->event_callback) { netdev->event_callback(netdev, NETDEV2_EVENT_TX_COMPLETE); } return res; }
static int _send(netdev_t *netdev, const iolist_t *iolist) { netdev_tap_t *dev = (netdev_tap_t*)netdev; 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 netdev->stats.tx_bytes += bytes; #else (void)bytes; #endif if (netdev->event_callback) { netdev->event_callback(netdev, NETDEV_EVENT_TX_COMPLETE); } return res; }
static int _send(netdev2_t *netdev, const struct iovec *vector, int n) { netdev2_tap_t *dev = (netdev2_tap_t*)netdev; return _native_writev(dev->tap_fd, vector, n); }