return netdev_dev->vport_stats_error;
}
+static int
+netdev_internal_set_stats(struct netdev *netdev,
+ const struct netdev_stats *stats)
+{
+ struct ovs_vport_stats vport_stats;
+ struct dpif_linux_vport vport;
+ int err;
+
+ vport_stats.rx_packets = stats->rx_packets;
+ vport_stats.tx_packets = stats->tx_packets;
+ vport_stats.rx_bytes = stats->rx_bytes;
+ vport_stats.tx_bytes = stats->tx_bytes;
+ vport_stats.rx_errors = stats->rx_errors;
+ vport_stats.tx_errors = stats->tx_errors;
+ vport_stats.rx_dropped = stats->rx_dropped;
+ vport_stats.tx_dropped = stats->tx_dropped;
+
+ dpif_linux_vport_init(&vport);
+ vport.cmd = OVS_VPORT_CMD_SET;
+ vport.name = netdev_get_name(netdev);
+ vport.stats = &vport_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;
+}
+
static void
netdev_linux_read_features(struct netdev_dev_linux *netdev_dev)
{
"internal",
netdev_linux_create,
netdev_internal_get_stats,
- netdev_vport_set_stats,
+ netdev_internal_set_stats,
NULL, /* get_features */
netdev_internal_get_drv_info);
\f
dst->tx_window_errors = 0;
}
-/* Copies 'src' into 'dst', performing format conversion in the process. */
-static void
-netdev_stats_to_ovs_vport_stats(struct ovs_vport_stats *dst,
- const struct netdev_stats *src)
-{
- 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
netdev_vport_get_stats(const struct netdev *netdev, struct netdev_stats *stats)
{
return 0;
}
-int
-netdev_vport_set_stats(struct netdev *netdev, const struct netdev_stats *stats)
-{
- struct ovs_vport_stats rtnl_stats;
- struct dpif_linux_vport vport;
- int err;
-
- netdev_stats_to_ovs_vport_stats(&rtnl_stats, stats);
-
- dpif_linux_vport_init(&vport);
- vport.cmd = OVS_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;
-}
-
static int
netdev_vport_get_drv_info(const struct netdev *netdev, struct smap *smap)
{
NULL, /* get_carrier_resets */ \
NULL, /* get_miimon */ \
netdev_vport_get_stats, \
- netdev_vport_set_stats, \
+ NULL, /* set_stats */ \
\
NULL, /* get_features */ \
NULL, /* set_advertisements */ \