From c981665a3d6cd0a2e60cf08f6a34691ba9e8f314 Mon Sep 17 00:00:00 2001 From: Pravin B Shelar Date: Sat, 20 Sep 2014 05:02:54 -0700 Subject: [PATCH] datapath: Remove support to set vport stats. This was required for old compatibility code which update stats on fake bond interface. Now vswitchd has dropped it. This support was always deprecated, so finally removing it. Signed-off-by: Pravin B Shelar Acked-by: Andy Zhou --- datapath/datapath.c | 8 -------- datapath/vport.c | 46 ++++++++++++++------------------------------- datapath/vport.h | 6 +----- 3 files changed, 15 insertions(+), 45 deletions(-) diff --git a/datapath/datapath.c b/datapath/datapath.c index ed9d7bd3c..3e5ff72c7 100644 --- a/datapath/datapath.c +++ b/datapath/datapath.c @@ -1831,10 +1831,6 @@ static int ovs_vport_cmd_new(struct sk_buff *skb, struct genl_info *info) 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); @@ -1878,10 +1874,6 @@ static int ovs_vport_cmd_set(struct sk_buff *skb, struct genl_info *info) 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]); diff --git a/datapath/vport.c b/datapath/vport.c index cf7f917e8..0709c33aa 100644 --- a/datapath/vport.c +++ b/datapath/vport.c @@ -242,26 +242,6 @@ void ovs_vport_del(struct vport *vport) 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 * @@ -276,28 +256,30 @@ void ovs_vport_get_stats(struct vport *vport, struct ovs_vport_stats *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; diff --git a/datapath/vport.h b/datapath/vport.h index 8c3da0501..07a9d5d8c 100644 --- a/datapath/vport.h +++ b/datapath/vport.h @@ -45,7 +45,6 @@ void ovs_vport_del(struct vport *); 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); @@ -101,10 +100,8 @@ struct vport_portids { * @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; @@ -120,7 +117,6 @@ struct vport { spinlock_t stats_lock; struct vport_err_stats err_stats; - struct ovs_vport_stats offset_stats; }; /** -- 2.20.1