diff options
| author | Pravin Shelar <pshelar@nicira.com> | 2011-09-15 19:36:17 -0700 |
|---|---|---|
| committer | Pravin Shelar <pshelar@nicira.com> | 2011-09-15 19:36:17 -0700 |
| commit | f613a0d72c521ca3a4eeb2c29ac523f6fdf72667 (patch) | |
| tree | 40b7ff023ad2899dfe1d8e96cb1620ad0804c8c7 /datapath/datapath.c | |
| parent | 9197df76b46ff6fbe1f7a522961730ffc55a860d (diff) | |
| download | openvswitch-f613a0d72c521ca3a4eeb2c29ac523f6fdf72667.tar.gz | |
datapath: Always use generic stats for devices (vports)
Currently ovs is using device stats for Linux devices and count them
itself in other situations. This leads to overlap with hardware stats,
inconsistencies, etc. It's much better to just always count the packets
flowing through the switch and let userspace do any merging that it wants.
Following patch removes vport->get_stats() interface. vport-stat is changed
to use new `struct ovs_vport_stat` rather than rtnl_link_stats64.
Definitions of rtnl_link_stats64 is removed from OVS. dipf_port->stat is also
removed as aggregate stats are only available at netdev layer.
Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Acked-by: Jesse Gross <jesse@nicira.com>
Diffstat (limited to 'datapath/datapath.c')
| -rw-r--r-- | datapath/datapath.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/datapath/datapath.c b/datapath/datapath.c index 0238c5f3b..98c2bafd3 100644 --- a/datapath/datapath.c +++ b/datapath/datapath.c @@ -1504,10 +1504,10 @@ static const struct nla_policy vport_policy[OVS_VPORT_ATTR_MAX + 1] = { [OVS_VPORT_ATTR_NAME] = { .type = NLA_NUL_STRING, .len = IFNAMSIZ - 1 }, [OVS_VPORT_ATTR_PORT_NO] = { .type = NLA_U32 }, [OVS_VPORT_ATTR_TYPE] = { .type = NLA_U32 }, - [OVS_VPORT_ATTR_STATS] = { .len = sizeof(struct rtnl_link_stats64) }, + [OVS_VPORT_ATTR_STATS] = { .len = sizeof(struct ovs_vport_stats) }, [OVS_VPORT_ATTR_ADDRESS] = { .len = ETH_ALEN }, #else - [OVS_VPORT_ATTR_STATS] = { .minlen = sizeof(struct rtnl_link_stats64) }, + [OVS_VPORT_ATTR_STATS] = { .minlen = sizeof(struct ovs_vport_stats) }, [OVS_VPORT_ATTR_ADDRESS] = { .minlen = ETH_ALEN }, #endif [OVS_VPORT_ATTR_OPTIONS] = { .type = NLA_NESTED }, @@ -1545,11 +1545,11 @@ static int ovs_vport_cmd_fill_info(struct vport *vport, struct sk_buff *skb, NLA_PUT_U32(skb, OVS_VPORT_ATTR_TYPE, vport_get_type(vport)); NLA_PUT_STRING(skb, OVS_VPORT_ATTR_NAME, vport_get_name(vport)); - nla = nla_reserve(skb, OVS_VPORT_ATTR_STATS, sizeof(struct rtnl_link_stats64)); + nla = nla_reserve(skb, OVS_VPORT_ATTR_STATS, sizeof(struct ovs_vport_stats)); if (!nla) goto nla_put_failure; - if (vport_get_stats(vport, nla_data(nla))) - __skb_trim(skb, skb->len - nla->nla_len); + + vport_get_stats(vport, nla_data(nla)); NLA_PUT(skb, OVS_VPORT_ATTR_ADDRESS, ETH_ALEN, vport_get_addr(vport)); @@ -1628,10 +1628,13 @@ static struct vport *lookup_vport(struct ovs_header *ovs_header, static int change_vport(struct vport *vport, struct nlattr *a[OVS_VPORT_ATTR_MAX + 1]) { int err = 0; + if (a[OVS_VPORT_ATTR_STATS]) - err = vport_set_stats(vport, nla_data(a[OVS_VPORT_ATTR_STATS])); - if (!err && a[OVS_VPORT_ATTR_ADDRESS]) + vport_set_stats(vport, nla_data(a[OVS_VPORT_ATTR_STATS])); + + if (a[OVS_VPORT_ATTR_ADDRESS]) err = vport_set_addr(vport, nla_data(a[OVS_VPORT_ATTR_ADDRESS])); + return err; } |
