X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=lib%2Fnetdev.c;h=09c00af3f14a7bfd6e8225be2d5059e9d35a4d08;hb=ceb4559f662c12eeb2bf9e4665ec88e96d990752;hp=4741e24b3aff78b03b5a0e5a91f15cfde5cb3743;hpb=6f643e4946016399f0b217c2226284e3892b6267;p=openvswitch diff --git a/lib/netdev.c b/lib/netdev.c index 4741e24b..09c00af3 100644 --- a/lib/netdev.c +++ b/lib/netdev.c @@ -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. */