-int
-netdev_vport_set_stats(struct netdev *netdev, const struct netdev_stats *stats)
-{
- struct rtnl_link_stats64 rtnl_stats;
- struct dpif_linux_vport vport;
- int err;
-
- rtnl_stats.rx_packets = stats->rx_packets;
- rtnl_stats.tx_packets = stats->tx_packets;
- rtnl_stats.rx_bytes = stats->rx_bytes;
- rtnl_stats.tx_bytes = stats->tx_bytes;
- rtnl_stats.rx_errors = stats->rx_errors;
- rtnl_stats.tx_errors = stats->tx_errors;
- rtnl_stats.rx_dropped = stats->rx_dropped;
- rtnl_stats.tx_dropped = stats->tx_dropped;
- rtnl_stats.multicast = stats->multicast;
- rtnl_stats.collisions = stats->collisions;
- rtnl_stats.rx_length_errors = stats->rx_length_errors;
- rtnl_stats.rx_over_errors = stats->rx_over_errors;
- rtnl_stats.rx_crc_errors = stats->rx_crc_errors;
- rtnl_stats.rx_frame_errors = stats->rx_frame_errors;
- rtnl_stats.rx_fifo_errors = stats->rx_fifo_errors;
- rtnl_stats.rx_missed_errors = stats->rx_missed_errors;
- rtnl_stats.tx_aborted_errors = stats->tx_aborted_errors;
- rtnl_stats.tx_carrier_errors = stats->tx_carrier_errors;
- rtnl_stats.tx_fifo_errors = stats->tx_fifo_errors;
- rtnl_stats.tx_heartbeat_errors = stats->tx_heartbeat_errors;
- rtnl_stats.tx_window_errors = stats->tx_window_errors;
-
- dpif_linux_vport_init(&vport);
- vport.cmd = ODP_VPORT_CMD_SET;
- vport.name = netdev_get_name(netdev);
- vport.stats = &rtnl_stats;
-
- err = dpif_linux_vport_transact(&vport, NULL, NULL);
-
- /* If the vport layer doesn't know about the device, that doesn't mean it
- * doesn't exist (after all were able to open it when netdev_open() was
- * called), it just means that it isn't attached and we'll be getting
- * stats a different way. */
- if (err == ENODEV) {
- err = EOPNOTSUPP;
- }
-
- return err;
-}
-