[ovs-dev] [PATCH 2/2] tc: Fix stats byte count on fragmented packets

Maxime Coquelin maxime.coquelin at redhat.com
Tue Nov 16 15:23:07 UTC 2021

On 11/7/21 13:12, Roi Dayan via dev wrote:
> From: Paul Blakey <paulb at nvidia.com>
> Fragmented packets with offset=0 are defragmented by tc act_ct, and
> only when assembled pass to next action, in ovs offload case,
> a goto action. Since stats are overwritten on each action dump,
> only the stats for last action in the tc filter action priority
> list is taken, the stats on the goto action, which count
> only the assembled packets. See below for example.
> Hardware updates just part of the actions (gact, ct, mirred) - those
> that support stats_update() operation. Since datapath rules end
> with either an output (mirred) or recirc/drop (both gact), tc rule
> will at least have one action that supports it. For software packets,
> the first action will have the max software packets count.
> Tc dumps total packets (hw + sw) and hardware packets, then
> software packets needs to be calculated from this (total - hw).
> To fix the above, get hardware packets and calculate software packets
> for each action, take the max of each set, then combine back
> to get the total packets that went through software and hardware.
> Example by running ping above MTU (ping <IP> -s 2000):
> ct_state(-trk),recirc_id(0),...,ipv4(proto=1,frag=first),
>    packets:14, bytes:19544,..., actions:ct(zone=1),recirc(0x1)
> ct_state(-trk),recirc_id(0),...,ipv4(proto=1,frag=later),
>    packets:14, bytes:28392,..., actions:ct(zone=1),recirc(0x1)
> Second rule should have had bytes=14*<size of 'later' frag>, but instead
> it's bytes=14*<size of assembled packets - size of 'first' + 'later'
> frags>.
> Fixes: 576126a931cd ("netdev-offload-tc: Add conntrack support")
> Signed-off-by: Paul Blakey <paulb at nvidia.com>
> Reviewed-by: Roi Dayan <roid at nvidia.com>
> ---
>   lib/netdev-offload-tc.c | 10 +++++-----
>   lib/tc.c                | 34 ++++++++++++++++++++++++++++------
>   lib/tc.h                |  3 ++-
>   3 files changed, 35 insertions(+), 12 deletions(-)

Reviewed-by: Maxime Coquelin <maxime.coquelin at redhat.com>


More information about the dev mailing list