2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 22:35:15 +00:00

Avoid indeterminate statistics in offload implementations.

A lot of the offload implementations didn't bother to initialize the
statistics they were supposed to return.  I don't know whether any of
the callers actually use them, but it looked wrong.

Found by inspection.

Acked-by: Ilya Maximets <i.maximets@ovn.org>
Signed-off-by: Ben Pfaff <blp@ovn.org>
This commit is contained in:
Ben Pfaff
2019-10-25 11:46:24 -07:00
parent cd7ea52172
commit 75ad1cd6e9
3 changed files with 20 additions and 5 deletions

View File

@@ -710,7 +710,7 @@ static int
netdev_offload_dpdk_flow_put(struct netdev *netdev, struct match *match,
struct nlattr *actions, size_t actions_len,
const ovs_u128 *ufid, struct offload_info *info,
struct dpif_flow_stats *stats OVS_UNUSED)
struct dpif_flow_stats *stats)
{
struct rte_flow *rte_flow;
int ret;
@@ -732,13 +732,16 @@ netdev_offload_dpdk_flow_put(struct netdev *netdev, struct match *match,
return ret;
}
if (stats) {
memset(stats, 0, sizeof *stats);
}
return netdev_offload_dpdk_add_flow(netdev, match, actions,
actions_len, ufid, info);
}
static int
netdev_offload_dpdk_flow_del(struct netdev *netdev, const ovs_u128 *ufid,
struct dpif_flow_stats *stats OVS_UNUSED)
struct dpif_flow_stats *stats)
{
struct rte_flow *rte_flow = ufid_to_rte_flow_find(ufid);
@@ -746,6 +749,9 @@ netdev_offload_dpdk_flow_del(struct netdev *netdev, const ovs_u128 *ufid,
return -1;
}
if (stats) {
memset(stats, 0, sizeof *stats);
}
return netdev_offload_dpdk_destroy_flow(netdev, ufid, rte_flow);
}