From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-it0-f67.google.com ([209.85.214.67]:54231 "EHLO mail-it0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1034086AbeCASqE (ORCPT ); Thu, 1 Mar 2018 13:46:04 -0500 Received: by mail-it0-f67.google.com with SMTP id w63so8764619ita.3 for ; Thu, 01 Mar 2018 10:46:04 -0800 (PST) From: Roman Mashak To: davem@davemloft.net Cc: netdev@vger.kernel.org, jhs@mojatatu.com, jiri@resnulli.us, xiyou.wangcong@gmail.com, Roman Mashak Subject: [PATCH 5/5] net sched actions: implement get_fill_size routine in act_police Date: Thu, 1 Mar 2018 13:45:31 -0500 Message-Id: <1519929931-1119-6-git-send-email-mrv@mojatatu.com> In-Reply-To: <1519929931-1119-1-git-send-email-mrv@mojatatu.com> References: <1519929931-1119-1-git-send-email-mrv@mojatatu.com> Sender: netdev-owner@vger.kernel.org List-ID: Signed-off-by: Roman Mashak --- net/sched/act_police.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/net/sched/act_police.c b/net/sched/act_police.c index 51fe4fe..d4b4b15 100644 --- a/net/sched/act_police.c +++ b/net/sched/act_police.c @@ -314,6 +314,13 @@ static int tcf_police_search(struct net *net, struct tc_action **a, u32 index, return tcf_idr_search(tn, a, index); } +static size_t tcf_police_get_fill_size(const struct tc_action *act) +{ + return nla_total_size(sizeof(struct tc_police)) /* TCA_POLICE_TBF */ + + nla_total_size(sizeof(u32)) /* TCA_POLICE_RESULT */ + + nla_total_size(sizeof(u32)); /* TCA_POLICE_AVRATE */ +} + MODULE_AUTHOR("Alexey Kuznetsov"); MODULE_DESCRIPTION("Policing actions"); MODULE_LICENSE("GPL"); @@ -327,6 +334,7 @@ static struct tc_action_ops act_police_ops = { .init = tcf_act_police_init, .walk = tcf_act_police_walker, .lookup = tcf_police_search, + .get_fill_size = tcf_police_get_fill_size, .size = sizeof(struct tcf_police), }; -- 2.7.4