- struct vport *vport = internal_dev_get_vport(netdev);
- struct net_device_stats *stats = &internal_dev_priv(netdev)->stats;
-
- if (vport) {
- struct rtnl_link_stats64 vport_stats;
-
- vport_get_stats(vport, &vport_stats);
-
- /* The tx and rx stats need to be swapped because the switch
- * and host OS have opposite perspectives. */
- stats->rx_packets = vport_stats.tx_packets;
- stats->tx_packets = vport_stats.rx_packets;
- stats->rx_bytes = vport_stats.tx_bytes;
- stats->tx_bytes = vport_stats.rx_bytes;
- stats->rx_errors = vport_stats.tx_errors;
- stats->tx_errors = vport_stats.rx_errors;
- stats->rx_dropped = vport_stats.tx_dropped;
- stats->tx_dropped = vport_stats.rx_dropped;
- stats->collisions = vport_stats.collisions;
- }
-
- return stats;
-}