X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=lib%2Fnetdev-tunnel.c;h=6b54697536aa6fa6b0dc4aaa391b716f1b60eff9;hb=90b4feffb9a9031775b949090db6c1c3f963779a;hp=a985ce9055147fd250211d62725b14426bdb89bc;hpb=f263172c99fd0a72c3f6666ffbaeaab786a3f1a8;p=sliver-openvswitch.git diff --git a/lib/netdev-tunnel.c b/lib/netdev-tunnel.c index a985ce905..6b5469753 100644 --- a/lib/netdev-tunnel.c +++ b/lib/netdev-tunnel.c @@ -264,27 +264,29 @@ netdev_tunnel_rx_dealloc(struct netdev_rx *rx_) } static int -netdev_tunnel_rx_recv(struct netdev_rx *rx_, void *buffer, size_t size) +netdev_tunnel_rx_recv(struct netdev_rx *rx_, struct ofpbuf *buffer) { + size_t size = ofpbuf_tailroom(buffer); struct netdev_rx_tunnel *rx = netdev_rx_tunnel_cast(rx_); struct netdev_tunnel *netdev = netdev_tunnel_cast(rx_->netdev); if (!netdev->connected) - return -EAGAIN; + return EAGAIN; for (;;) { ssize_t retval; - retval = recv(rx->fd, buffer, size, MSG_TRUNC); + retval = recv(rx->fd, buffer->data, size, MSG_TRUNC); VLOG_DBG("%s: recv(%"PRIxPTR", %"PRIuSIZE", MSG_TRUNC) = %"PRIdSIZE, - netdev_rx_get_name(rx_), (uintptr_t)buffer, size, retval); + netdev_rx_get_name(rx_), (uintptr_t)buffer->data, size, retval); if (retval >= 0) { - netdev->stats.rx_packets++; - netdev->stats.rx_bytes += retval; + netdev->stats.rx_packets++; + netdev->stats.rx_bytes += retval; if (retval <= size) { - return retval; + buffer->size += retval; + return 0; } else { netdev->stats.rx_errors++; netdev->stats.rx_length_errors++; - return -EMSGSIZE; + return EMSGSIZE; } } else if (errno != EINTR) { if (errno != EAGAIN) { @@ -292,7 +294,7 @@ netdev_tunnel_rx_recv(struct netdev_rx *rx_, void *buffer, size_t size) netdev_rx_get_name(rx_), ovs_strerror(errno)); netdev->stats.rx_errors++; } - return -errno; + return errno; } } } @@ -614,13 +616,11 @@ const struct netdev_class netdev_tunnel_class = { NULL, /* get_in6 */ NULL, /* add_router */ NULL, /* get_next_hop */ - NULL, /* get_drv_info */ + NULL, /* get_status */ NULL, /* arp_lookup */ netdev_tunnel_update_flags, - netdev_tunnel_change_seq, - netdev_tunnel_rx_alloc, netdev_tunnel_rx_construct, netdev_tunnel_rx_destruct,