Re: [net-next] seg6: add counters support for SRv6 Behaviors

From: David Ahern
Date: Wed Apr 28 2021 - 22:08:30 EST


On 4/27/21 9:44 AM, Andrea Mayer wrote:
> This patch provides counters for SRv6 Behaviors as defined in [1],
> section 6. For each SRv6 Behavior instance, counters defined in [1] are:
>
> - the total number of packets that have been correctly processed;
> - the total amount of traffic in bytes of all packets that have been
> correctly processed;
>

...

>
> Results of tests are shown in the following table:
>
> Scenario (1): average 1504764,81 pps (~1504,76 kpps); std. dev 3956,82 pps
> Scenario (2): average 1501469,78 pps (~1501,47 kpps); std. dev 2979,85 pps
> Scenario (3): average 1501315,13 pps (~1501,32 kpps); std. dev 2956,00 pps
>
> As can be observed, throughputs achieved in scenarios (2),(3) did not
> suffer any observable degradation compared to scenario (1).
>
> Thanks to Jakub Kicinski and David Ahern for their valuable suggestions
> and comments provided during the discussion of the proposed RFCs.
>
> [2] https://www.cloudlab.us
>
> Signed-off-by: Andrea Mayer <andrea.mayer@xxxxxxxxxxx>
> ---
> include/uapi/linux/seg6_local.h | 30 +++++
> net/ipv6/seg6_local.c | 198 +++++++++++++++++++++++++++++++-
> 2 files changed, 226 insertions(+), 2 deletions(-)

Thanks for the detailed commit message and stats on performance impact.

> @@ -977,7 +1044,14 @@ static int seg6_local_input(struct sk_buff *skb)
> slwt = seg6_local_lwtunnel(orig_dst->lwtstate);
> desc = slwt->desc;
>
> - return desc->input(skb, slwt);
> + rc = desc->input(skb, slwt);
> +
> + if (!seg6_lwtunnel_counters_enabled(slwt))
> + return rc;
> +
> + seg6_local_update_counters(slwt, len, rc);
> +
> + return rc;

Nit: This would be simpler as

if (seg6_lwtunnel_counters_enabled(slwt))
seg6_local_update_counters(slwt, len, rc);

return rc;

but not worth a re-do since net-next is about to close, so:

Reviewed-by: David Ahern <dsahern@xxxxxxxxxx>