X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=lib%2Fnetdev-vport.c;h=620c22e945fbe7478e3215ba467fd5462798262d;hb=refs%2Fheads%2Fbranch-1.3;hp=d85d528454b46201675ff252ab022482bd914217;hpb=f613a0d72c521ca3a4eeb2c29ac523f6fdf72667;p=sliver-openvswitch.git diff --git a/lib/netdev-vport.c b/lib/netdev-vport.c index d85d52845..620c22e94 100644 --- a/lib/netdev-vport.c +++ b/lib/netdev-vport.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -38,12 +39,12 @@ #include "netlink-notifier.h" #include "netlink-socket.h" #include "ofpbuf.h" -#include "openvswitch/datapath-protocol.h" #include "openvswitch/tunnel.h" #include "packets.h" #include "route-table.h" #include "shash.h" #include "socket-util.h" +#include "unaligned.h" #include "vlog.h" VLOG_DEFINE_THIS_MODULE(netdev_vport); @@ -130,7 +131,8 @@ netdev_vport_get_vport_type(const struct netdev *netdev) return (is_vport_class(class) ? vport_class_cast(class)->type : class == &netdev_internal_class ? OVS_VPORT_TYPE_INTERNAL - : class == &netdev_linux_class ? OVS_VPORT_TYPE_NETDEV + : (class == &netdev_linux_class || + class == &netdev_tap_class) ? OVS_VPORT_TYPE_NETDEV : OVS_VPORT_TYPE_UNSPEC); } @@ -361,22 +363,21 @@ netdev_vport_get_etheraddr(const struct netdev *netdev, return error; } -#define COPY_OVS_STATS \ - dst->rx_packets = src->rx_packets; \ - dst->tx_packets = src->tx_packets; \ - dst->rx_bytes = src->rx_bytes; \ - dst->tx_bytes = src->tx_bytes; \ - dst->rx_errors = src->rx_errors; \ - dst->tx_errors = src->tx_errors; \ - dst->rx_dropped = src->rx_dropped; \ - dst->tx_dropped = src->tx_dropped; - -/* Copies 'src' into 'dst', performing format conversion in the process. */ +/* Copies 'src' into 'dst', performing format conversion in the process. + * + * 'src' is allowed to be misaligned. */ static void netdev_stats_from_ovs_vport_stats(struct netdev_stats *dst, const struct ovs_vport_stats *src) { - COPY_OVS_STATS + dst->rx_packets = get_unaligned_u64(&src->rx_packets); + dst->tx_packets = get_unaligned_u64(&src->tx_packets); + dst->rx_bytes = get_unaligned_u64(&src->rx_bytes); + dst->tx_bytes = get_unaligned_u64(&src->tx_bytes); + dst->rx_errors = get_unaligned_u64(&src->rx_errors); + dst->tx_errors = get_unaligned_u64(&src->tx_errors); + dst->rx_dropped = get_unaligned_u64(&src->rx_dropped); + dst->tx_dropped = get_unaligned_u64(&src->tx_dropped); dst->multicast = 0; dst->collisions = 0; dst->rx_length_errors = 0; @@ -397,7 +398,14 @@ static void netdev_stats_to_ovs_vport_stats(struct ovs_vport_stats *dst, const struct netdev_stats *src) { - COPY_OVS_STATS + dst->rx_packets = src->rx_packets; + dst->tx_packets = src->tx_packets; + dst->rx_bytes = src->rx_bytes; + dst->tx_bytes = src->tx_bytes; + dst->rx_errors = src->rx_errors; + dst->tx_errors = src->tx_errors; + dst->rx_dropped = src->rx_dropped; + dst->tx_dropped = src->tx_dropped; } int @@ -885,8 +893,6 @@ unparse_patch_config(const char *name OVS_UNUSED, const char *type OVS_UNUSED, netdev_vport_open, \ netdev_vport_close, \ \ - NULL, /* enumerate */ \ - \ NULL, /* listen */ \ NULL, /* recv */ \ NULL, /* recv_wait */ \ @@ -901,6 +907,7 @@ unparse_patch_config(const char *name OVS_UNUSED, const char *type OVS_UNUSED, NULL, /* set_mtu */ \ NULL, /* get_ifindex */ \ NULL, /* get_carrier */ \ + NULL, /* get_carrier_resets */ \ NULL, /* get_miimon */ \ netdev_vport_get_stats, \ netdev_vport_set_stats, \