if (IS_ERR(vport))
goto exit_unlock_free;
- err = 0;
- if (a[OVS_VPORT_ATTR_STATS])
- ovs_vport_set_stats(vport, nla_data(a[OVS_VPORT_ATTR_STATS]));
-
err = ovs_vport_cmd_fill_info(vport, reply, info->snd_portid,
info->snd_seq, 0, OVS_VPORT_CMD_NEW);
BUG_ON(err < 0);
goto exit_unlock_free;
}
- if (a[OVS_VPORT_ATTR_STATS])
- ovs_vport_set_stats(vport, nla_data(a[OVS_VPORT_ATTR_STATS]));
-
-
if (a[OVS_VPORT_ATTR_UPCALL_PID]) {
err = ovs_vport_set_upcall_portids(vport,
a[OVS_VPORT_ATTR_UPCALL_PID]);
vport->ops->destroy(vport);
}
-/**
- * ovs_vport_set_stats - sets offset device stats
- *
- * @vport: vport on which to set stats
- * @stats: stats to set
- *
- * Provides a set of transmit, receive, and error stats to be added as an
- * offset to the collected data when stats are retrieved. Some devices may not
- * support setting the stats, in which case the result will always be
- * -EOPNOTSUPP.
- *
- * Must be called with ovs_mutex.
- */
-void ovs_vport_set_stats(struct vport *vport, struct ovs_vport_stats *stats)
-{
- spin_lock_bh(&vport->stats_lock);
- vport->offset_stats = *stats;
- spin_unlock_bh(&vport->stats_lock);
-}
-
/**
* ovs_vport_get_stats - retrieve device stats
*
{
int i;
- /* We potentially have 3 sources of stats that need to be
+ /* We potentially have two surces of stats that need to be
* combined: those we have collected (split into err_stats and
- * percpu_stats), offset_stats from set_stats(), and device
- * error stats from netdev->get_stats() (for errors that happen
- * downstream and therefore aren't reported through our
- * vport_record_error() function).
- * Stats from first two sources are merged and reported by ovs over
+ * percpu_stats), and device error stats from netdev->get_stats()
+ * (for errors that happen downstream and therefore aren't
+ * reported through our vport_record_error() function).
+ * Stats from first source are reported by ovs over
* OVS_VPORT_ATTR_STATS.
* netdev-stats can be directly read over netlink-ioctl.
*/
spin_lock_bh(&vport->stats_lock);
- *stats = vport->offset_stats;
-
- stats->rx_errors += vport->err_stats.rx_errors;
- stats->tx_errors += vport->err_stats.tx_errors;
- stats->tx_dropped += vport->err_stats.tx_dropped;
- stats->rx_dropped += vport->err_stats.rx_dropped;
+ stats->rx_errors = vport->err_stats.rx_errors;
+ stats->tx_errors = vport->err_stats.tx_errors;
+ stats->tx_dropped = vport->err_stats.tx_dropped;
+ stats->rx_dropped = vport->err_stats.rx_dropped;
spin_unlock_bh(&vport->stats_lock);
+ stats->rx_bytes = 0;
+ stats->rx_packets = 0;
+ stats->tx_bytes = 0;
+ stats->tx_packets = 0;
+
for_each_possible_cpu(i) {
const struct pcpu_sw_netstats *percpu_stats;
struct pcpu_sw_netstats local_stats;
struct vport *ovs_vport_locate(struct net *net, const char *name);
-void ovs_vport_set_stats(struct vport *, struct ovs_vport_stats *);
void ovs_vport_get_stats(struct vport *, struct ovs_vport_stats *);
int ovs_vport_set_options(struct vport *, struct nlattr *options);
* @dp_hash_node: Element in @datapath->ports hash table in datapath.c.
* @ops: Class structure.
* @percpu_stats: Points to per-CPU statistics used and maintained by vport
- * @stats_lock: Protects @err_stats and @offset_stats.
+ * @stats_lock: Protects @err_stats.
* @err_stats: Points to error statistics used and maintained by vport
- * @offset_stats: Added to actual statistics as a sop to compatibility with
- * XAPI for Citrix XenServer. Deprecated.
*/
struct vport {
struct rcu_head rcu;
spinlock_t stats_lock;
struct vport_err_stats err_stats;
- struct ovs_vport_stats offset_stats;
};
/**