X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;ds=sidebyside;f=lib%2Fnetdev.c;h=c21afef829ca22d1bca8e475813df654dc5f9955;hb=2158888d8d8f3b4c00dcf979390a19fa7fcf7942;hp=4741e24b3aff78b03b5a0e5a91f15cfde5cb3743;hpb=4c0f178060b740faac9a5aec915a24dc3b61770c;p=sliver-openvswitch.git diff --git a/lib/netdev.c b/lib/netdev.c index 4741e24b3..c21afef82 100644 --- a/lib/netdev.c +++ b/lib/netdev.c @@ -44,8 +44,8 @@ static const struct netdev_class *base_netdev_classes[] = { &netdev_linux_class, &netdev_tap_class, - &netdev_gre_class, &netdev_patch_class, + &netdev_gre_class, }; static struct shash netdev_classes = SHASH_INITIALIZER(&netdev_classes); @@ -958,6 +958,19 @@ netdev_get_stats(const struct netdev *netdev, struct netdev_stats *stats) return error; } +/* Attempts to change the stats for 'netdev' to those provided in 'stats'. + * Returns 0 if successful, otherwise a positive errno value. + * + * This will probably fail for most network devices. Some devices might only + * allow setting their stats to 0. */ +int +netdev_set_stats(struct netdev *netdev, const struct netdev_stats *stats) +{ + return (netdev_get_dev(netdev)->netdev_class->set_stats + ? netdev_get_dev(netdev)->netdev_class->set_stats(netdev, stats) + : EOPNOTSUPP); +} + /* Attempts to set input rate limiting (policing) policy, such that up to * 'kbits_rate' kbps of traffic is accepted, with a maximum accumulative burst * size of 'kbits' kb. */