From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.bufferbloat.net (Postfix) with ESMTPS id 6EB243CB37 for ; Tue, 20 Sep 2022 09:45:32 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1663681532; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=DxHKjrVMawJTVmFBN2tlPLoDEtk3zoTr+D6pCmrZ1R0=; b=H98o82lqESLFvdPQwf6SaepGAe89kzdJvk/PbJQMSrovPloq7fffv4nAmnpwoChuAbR8NE gdT2rYExf9Cq7wMG4DcsajqxwjgJmuGW5JG7ostYCjFEvX5Nxa+8XSe73lFThHw/ns4gPr OxssKa+CLxLfteCXvR+EW8yQPidICyY= Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-203-7RxRYnh5NT2bAXcpuDTmaQ-1; Tue, 20 Sep 2022 09:45:31 -0400 X-MC-Unique: 7RxRYnh5NT2bAXcpuDTmaQ-1 Received: by mail-ed1-f70.google.com with SMTP id w20-20020a05640234d400b00450f24c8ca6so1902271edc.13 for ; Tue, 20 Sep 2022 06:45:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date; bh=DxHKjrVMawJTVmFBN2tlPLoDEtk3zoTr+D6pCmrZ1R0=; b=FKkNjsAKHHKV5IHM+1usrUAxXYnmpiO+VgMifxtLpK+xgYpBe949Mngc005QYY7DWt x3gsvE05a6iStVxknwN41bTg9wSkiir4HDyb73jgPnGvu+SuNqdxz3es7nqp4Sv9PwVS ZJs7HyUM6eapsduykOcc8BlIml1bLUGfD2oEjxmAmZ1xLf3H5md7e5jqYEJpikgvtpJh fWRUgljosfjeCv9RvkNG/uc/fuzOh+rgKX06T00xJVp96bb8+Iz4ih4Xr7SYALzxpJpZ tcNANnCgHoNk+hZmwJbbN15F4M+Cv6Cs/LnMUpTHo7afRlw53JNsSvVT7+qWdETIsXNU sKfA== X-Gm-Message-State: ACrzQf1eDMVVwZqi07IwgVf4g3XALM4Lq7EVMiWM3GPUbiU3/6nrBoDz vR+cI6cfwpWknRgZZX4JQUEoW2AZ2yJyYxf9FcOFpTQt2m/8BgoEYkkxhswS+/ZMIrRwlj51qG1 l/J3qJI9y47xiupY6Q9DUZg== X-Received: by 2002:a17:906:ef8c:b0:77c:8d9a:9aed with SMTP id ze12-20020a170906ef8c00b0077c8d9a9aedmr17889331ejb.704.1663681527155; Tue, 20 Sep 2022 06:45:27 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7E33JWAP3AhjFxcYXywbXSv1ZvnnxSk+uY3JXkypwF5KGToMYJwipqmJ/n7IuetlIHtn+W/Q== X-Received: by 2002:a17:906:ef8c:b0:77c:8d9a:9aed with SMTP id ze12-20020a170906ef8c00b0077c8d9a9aedmr17889281ejb.704.1663681526444; Tue, 20 Sep 2022 06:45:26 -0700 (PDT) Received: from alrua-x1.borgediget.toke.dk ([2a0c:4d80:42:443::2]) by smtp.gmail.com with ESMTPSA id g13-20020a170906c18d00b0078015cebd8csm905122ejz.117.2022.09.20.06.45.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Sep 2022 06:45:25 -0700 (PDT) Received: by alrua-x1.borgediget.toke.dk (Postfix, from userid 1000) id 4842D61C33C; Tue, 20 Sep 2022 15:45:25 +0200 (CEST) From: Toke =?utf-8?Q?H=C3=B8iland-J=C3=B8rgensen?= To: Zhengchao Shao , netdev@vger.kernel.org, cake@lists.bufferbloat.net, linux-kselftest@vger.kernel.org, jhs@mojatatu.com, xiyou.wangcong@gmail.com, jiri@resnulli.us, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, vinicius.gomes@intel.com, stephen@networkplumber.org, shuah@kernel.org, victor@mojatatu.com Cc: zhijianx.li@intel.com, weiyongjun1@huawei.com, yuehaibing@huawei.com, shaozhengchao@huawei.com In-Reply-To: <20220917050217.127342-1-shaozhengchao@huawei.com> References: <20220917050217.127342-1-shaozhengchao@huawei.com> X-Clacks-Overhead: GNU Terry Pratchett Date: Tue, 20 Sep 2022 15:45:25 +0200 Message-ID: <87sfkmw45m.fsf@toke.dk> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain Subject: Re: [Cake] [PATCH net-next, v2 01/18] net/sched: sch_api: add helper for tc qdisc walker stats dump X-BeenThere: cake@lists.bufferbloat.net X-Mailman-Version: 2.1.20 Precedence: list List-Id: Cake - FQ_codel the next generation List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Sep 2022 13:45:32 -0000 Zhengchao Shao writes: > The walk implementation of most qdisc class modules is basically the > same. That is, the values of count and skip are checked first. If > count is greater than or equal to skip, the registered fn function is > executed. Otherwise, increase the value of count. So we can reconstruct > them. > > Signed-off-by: Zhengchao Shao > --- > include/net/pkt_sched.h | 13 +++++++++++++ > 1 file changed, 13 insertions(+) > > diff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h > index 29f65632ebc5..243e8b0cb7ea 100644 > --- a/include/net/pkt_sched.h > +++ b/include/net/pkt_sched.h > @@ -222,4 +222,17 @@ static inline struct tc_skb_cb *tc_skb_cb(const struct sk_buff *skb) > return cb; > } > > +static inline bool tc_qdisc_stats_dump(struct Qdisc *sch, > + struct qdisc_walker *arg, > + unsigned long cl) > +{ > + if (arg->count >= arg->skip && arg->fn(sch, cl, arg) < 0) { Seems a bit confusing that tc_qdisc_stats_dump() reverses the order of the 'cl' and 'arg' parameters relative to the callback? -Toke