@@ -912,6 +912,7 @@ netdev_tc_flow_del(struct netdev *netdev OVS_UNUSED,
const ovs_u128 *ufid,
struct dpif_flow_stats *stats)
{
+ struct tc_flower flower;
struct netdev *dev;
int prio = 0;
int ifindex;
@@ -931,14 +932,18 @@ netdev_tc_flow_del(struct netdev *netdev OVS_UNUSED,
return -ifindex;
}
+ if (stats && !tc_get_flower(ifindex, prio, handle, &flower)) {
+ memset(stats, 0, sizeof *stats);
+ stats->n_packets = get_32aligned_u64(&flower.stats.n_packets);
+ stats->n_bytes = get_32aligned_u64(&flower.stats.n_bytes);
+ stats->used = flower.lastused;
+ }
+
error = tc_del_filter(ifindex, prio, handle);
del_ufid_tc_mapping(ufid);
netdev_close(dev);
- if (stats) {
- memset(stats, 0, sizeof *stats);
- }
return error;
}
Currently, when an offloaded DP flow is deleted, the related stats are unconditionally cleared. As a result the counters for the originating open flow are corrupted. This change addresses the issue updating the DP stats with the current values provided by the flower APIs before deleting the tc filter, as currently done by others DP providers. Fixes: 30b6b047260b ("netdev-tc-offloads: Implement netdev flow del using tc interface") CC: Paul Blakey <paulb@mellanox.com> Reported-by: Kumar Sanghvi <kumaras@chelsio.com> Signed-off-by: Paolo Abeni <pabeni@redhat.com> --- lib/netdev-tc-offloads.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)