X-Git-Url: http://git.onelab.eu/?p=sliver-openvswitch.git;a=blobdiff_plain;f=lib%2Fnetdev-tunnel.c;h=574115e8243779a6dbf77d238cc8af5cfe4b9a4f;hp=dcc5e2ca92d07121e3d642115db226e17f8659b4;hb=8d25251929c8f325bed0fff24192d5a87034b32e;hpb=7efa3dccd1968535ae32caf59746aa11ce7532f2 diff --git a/lib/netdev-tunnel.c b/lib/netdev-tunnel.c index dcc5e2ca9..574115e82 100644 --- a/lib/netdev-tunnel.c +++ b/lib/netdev-tunnel.c @@ -282,6 +282,7 @@ netdev_tunnel_rxq_recv(struct netdev_rxq *rx_, struct ofpbuf **packet, int *c) struct netdev_tunnel *netdev = netdev_tunnel_cast(rx_->netdev); struct ofpbuf *buffer = NULL; + void *data; size_t size; int error = 0; @@ -289,18 +290,19 @@ netdev_tunnel_rxq_recv(struct netdev_rxq *rx_, struct ofpbuf **packet, int *c) return EAGAIN; buffer = ofpbuf_new_with_headroom(VLAN_ETH_HEADER_LEN + ETH_PAYLOAD_MAX, DP_NETDEV_HEADROOM); + data = ofpbuf_data(buffer); size = ofpbuf_tailroom(buffer); for (;;) { ssize_t retval; - retval = recv(rx->fd, buffer->data, size, MSG_TRUNC); + retval = recv(rx->fd, data, size, MSG_TRUNC); VLOG_DBG("%s: recv(%"PRIxPTR", %"PRIuSIZE", MSG_TRUNC) = %"PRIdSIZE, - netdev_rxq_get_name(rx_), (uintptr_t)buffer->data, size, retval); + netdev_rxq_get_name(rx_), (uintptr_t)data, size, retval); if (retval >= 0) { netdev->stats.rx_packets++; netdev->stats.rx_bytes += retval; if (retval <= size) { - buffer->size += retval; + ofpbuf_set_size(buffer, ofpbuf_size(buffer) + retval); goto out; } else { netdev->stats.rx_errors++; @@ -343,8 +345,8 @@ netdev_tunnel_rxq_wait(struct netdev_rxq *rx_) static int netdev_tunnel_send(struct netdev *netdev_, struct ofpbuf *pkt, bool may_steal) { - const void *buffer = pkt->data; - size_t size = pkt->size; + const void *buffer = ofpbuf_data(pkt); + size_t size = ofpbuf_size(pkt); struct netdev_tunnel *dev = netdev_tunnel_cast(netdev_); int error = 0;