X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=lib%2Fnetdev-linux.c;h=c1d93237eb59165d9fbd13b008d1812dcde0bce3;hb=HEAD;hp=6848850c4351bfa4f927275f243d620c49066df5;hpb=f77917408a404d4660c6fb2cbe4d4c0f9f123cf2;p=sliver-openvswitch.git diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c index 6848850c4..c1d93237e 100644 --- a/lib/netdev-linux.c +++ b/lib/netdev-linux.c @@ -47,7 +47,6 @@ #include #include -#include "connectivity.h" #include "coverage.h" #include "dpif-linux.h" #include "dpif-netdev.h" @@ -66,7 +65,6 @@ #include "packets.h" #include "poll-loop.h" #include "rtnetlink-link.h" -#include "seq.h" #include "shash.h" #include "socket-util.h" #include "sset.h" @@ -616,7 +614,7 @@ netdev_linux_changed(struct netdev_linux *dev, unsigned int ifi_flags, unsigned int mask) OVS_REQUIRES(dev->mutex) { - seq_change(connectivity_seq_get()); + netdev_change_seq_changed(&dev->up); if ((dev->ifi_flags ^ ifi_flags) & IFF_RUNNING) { dev->carrier_resets++; @@ -919,7 +917,7 @@ netdev_linux_rxq_recv_sock(int fd, struct ofpbuf *buffer) ofpbuf_reserve(buffer, VLAN_HEADER_LEN); size = ofpbuf_tailroom(buffer); - iov.iov_base = buffer->data; + iov.iov_base = ofpbuf_data(buffer); iov.iov_len = size; msgh.msg_name = NULL; msgh.msg_namelen = 0; @@ -939,7 +937,7 @@ netdev_linux_rxq_recv_sock(int fd, struct ofpbuf *buffer) return EMSGSIZE; } - buffer->size += retval; + ofpbuf_set_size(buffer, ofpbuf_size(buffer) + retval); for (cmsg = CMSG_FIRSTHDR(&msgh); cmsg; cmsg = CMSG_NXTHDR(&msgh, cmsg)) { const struct tpacket_auxdata *aux; @@ -972,7 +970,7 @@ netdev_linux_rxq_recv_tap(int fd, struct ofpbuf *buffer) size_t size = ofpbuf_tailroom(buffer); do { - retval = read(fd, buffer->data, size); + retval = read(fd, ofpbuf_data(buffer), size); } while (retval < 0 && errno == EINTR); if (retval < 0) { @@ -981,7 +979,7 @@ netdev_linux_rxq_recv_tap(int fd, struct ofpbuf *buffer) return EMSGSIZE; } - buffer->size += retval; + ofpbuf_set_size(buffer, ofpbuf_size(buffer) + retval); return 0; } @@ -1056,8 +1054,8 @@ netdev_linux_rxq_drain(struct netdev_rxq *rxq_) static int netdev_linux_send(struct netdev *netdev_, struct ofpbuf *pkt, bool may_steal) { - const void *data = pkt->data; - size_t size = pkt->size; + const void *data = ofpbuf_data(pkt); + size_t size = ofpbuf_size(pkt); for (;;) { ssize_t retval; @@ -1565,9 +1563,17 @@ netdev_linux_get_stats(const struct netdev *netdev_, error = 0; } } else if (netdev->vport_stats_error) { - /* stats not available from OVS then use ioctl stats. */ + /* stats not available from OVS then use netdev stats. */ *stats = dev_stats; } else { + /* Use kernel netdev's packet and byte counts since vport's counters + * do not reflect packet counts on the wire when GSO, TSO or GRO are + * enabled. */ + stats->rx_packets = dev_stats.rx_packets; + stats->rx_bytes = dev_stats.rx_bytes; + stats->tx_packets = dev_stats.tx_packets; + stats->tx_bytes = dev_stats.tx_bytes; + stats->rx_errors += dev_stats.rx_errors; stats->tx_errors += dev_stats.tx_errors; stats->rx_dropped += dev_stats.rx_dropped; @@ -1631,6 +1637,14 @@ netdev_tap_get_stats(const struct netdev *netdev_, struct netdev_stats *stats) stats->tx_heartbeat_errors = 0; stats->tx_window_errors = 0; } else { + /* Use kernel netdev's packet and byte counts since vport counters + * do not reflect packet counts on the wire when GSO, TSO or GRO + * are enabled. */ + stats->rx_packets = dev_stats.tx_packets; + stats->rx_bytes = dev_stats.tx_bytes; + stats->tx_packets = dev_stats.rx_packets; + stats->tx_bytes = dev_stats.rx_bytes; + stats->rx_dropped += dev_stats.tx_dropped; stats->tx_dropped += dev_stats.rx_dropped;