From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-io0-f193.google.com ([209.85.223.193]:33122 "EHLO mail-io0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1034000AbeCASqC (ORCPT ); Thu, 1 Mar 2018 13:46:02 -0500 Received: by mail-io0-f193.google.com with SMTP id f1so8190161iob.0 for ; Thu, 01 Mar 2018 10:46:02 -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 4/5] net sched actions: implement get_fill_size routine in act_gact Date: Thu, 1 Mar 2018 13:45:30 -0500 Message-Id: <1519929931-1119-5-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_gact.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/net/sched/act_gact.c b/net/sched/act_gact.c index 7456325..ee775ac 100644 --- a/net/sched/act_gact.c +++ b/net/sched/act_gact.c @@ -217,6 +217,22 @@ static int tcf_gact_search(struct net *net, struct tc_action **a, u32 index, return tcf_idr_search(tn, a, index); } +static size_t tcf_gact_get_fill_size(const struct tc_action *act) +{ +#ifdef CONFIG_GACT_PROB + struct tcf_gact *gact = to_gact(act); + int prob_len = 0; + + if (gact->tcfg_ptype) + prob_len = nla_total_size(sizeof(struct tc_gact_p)); +#endif + return nla_total_size(sizeof(struct tc_gact)) /* TCA_GACT_PARMS */ +#ifdef CONFIG_GACT_PROB + + prob_len /* TCA_GACT_PROB */ +#endif + ; +} + static struct tc_action_ops act_gact_ops = { .kind = "gact", .type = TCA_ACT_GACT, @@ -227,6 +243,7 @@ static struct tc_action_ops act_gact_ops = { .init = tcf_gact_init, .walk = tcf_gact_walker, .lookup = tcf_gact_search, + .get_fill_size = tcf_gact_get_fill_size, .size = sizeof(struct tcf_gact), }; -- 2.7.4