netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Roman Mashak <mrv@mojatatu.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, kernel@mojatatu.com, jhs@mojatatu.com,
	xiyou.wangcong@gmail.com, jiri@resnulli.us,
	Roman Mashak <mrv@mojatatu.com>
Subject: [PATCH v2 net-next 4/4] net sched actions: implement get_fill_size routine in act_gact
Date: Tue,  6 Mar 2018 16:55:24 -0500	[thread overview]
Message-ID: <1520373324-17433-5-git-send-email-mrv@mojatatu.com> (raw)
In-Reply-To: <1520373324-17433-1-git-send-email-mrv@mojatatu.com>

Signed-off-by: Roman Mashak <mrv@mojatatu.com>
---
 net/sched/act_gact.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/net/sched/act_gact.c b/net/sched/act_gact.c
index 7456325..88fbb84 100644
--- a/net/sched/act_gact.c
+++ b/net/sched/act_gact.c
@@ -217,6 +217,19 @@ 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)
+{
+	size_t sz = nla_total_size(sizeof(struct tc_gact)); /* TCA_GACT_PARMS */
+
+#ifdef CONFIG_GACT_PROB
+	if (to_gact(act)->tcfg_ptype)
+		/* TCA_GACT_PROB */
+		sz += nla_total_size(sizeof(struct tc_gact_p));
+#endif
+
+	return sz;
+}
+
 static struct tc_action_ops act_gact_ops = {
 	.kind		=	"gact",
 	.type		=	TCA_ACT_GACT,
@@ -227,6 +240,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

      parent reply	other threads:[~2018-03-06 21:55 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-06 21:55 [PATCH v2 net-next 0/4] Fix event generation for actions batch Add/Delete mode Roman Mashak
2018-03-06 21:55 ` [PATCH v2 net-next 1/4] net sched actions: update Add/Delete action API with new argument Roman Mashak
2018-03-06 21:55 ` [PATCH v2 net-next 2/4] net sched actions: add new tc_action_ops callback Roman Mashak
2018-03-06 21:55 ` [PATCH v2 net-next 3/4] net sched actions: calculate add/delete event message size Roman Mashak
2018-03-07 19:55   ` David Miller
2018-03-07 20:43     ` Roman Mashak
2018-03-06 21:55 ` Roman Mashak [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1520373324-17433-5-git-send-email-mrv@mojatatu.com \
    --to=mrv@mojatatu.com \
    --cc=davem@davemloft.net \
    --cc=jhs@mojatatu.com \
    --cc=jiri@resnulli.us \
    --cc=kernel@mojatatu.com \
    --cc=netdev@vger.kernel.org \
    --cc=xiyou.wangcong@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).