From: Roman Mashak <mrv@mojatatu•com>
To: Marcelo Ricardo Leitner <marcelo.leitner@gmail•com>
Cc: davem@davemloft•net, netdev@vger•kernel.org, jhs@mojatatu•com,
jiri@resnulli•us, xiyou.wangcong@gmail•com
Subject: Re: [PATCH 4/5] net sched actions: implement get_fill_size routine in act_gact
Date: Fri, 02 Mar 2018 10:52:08 -0500 [thread overview]
Message-ID: <85d10mqxuf.fsf@sevai.TCC.com> (raw)
In-Reply-To: <20180301190329.GD3887@localhost.localdomain> (Marcelo Ricardo Leitner's message of "Thu, 1 Mar 2018 16:03:29 -0300")
Marcelo Ricardo Leitner <marcelo.leitner@gmail•com> writes:
> On Thu, Mar 01, 2018 at 01:45:30PM -0500, Roman Mashak wrote:
>> Signed-off-by: Roman Mashak <mrv@mojatatu•com>
>> ---
>> 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
>> + ;
>> +}
>
> This is quite bad to the eye. What about:
>
> 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)
> sz += nla_total_size(sizeof(struct tc_gact_p)); /* TCA_GACT_PROB */
> #endif
>
> return sz;
> }
>
> Should be the same, bug easier to read.
Agree, I will send v2.
next prev parent reply other threads:[~2018-03-02 15:52 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-01 18:45 [PATCH 0/5] Fix event generation for actions batch Add/Delete mode Roman Mashak
2018-03-01 18:45 ` [PATCH 1/5] net sched actions: routines to calculate common TLVs size Roman Mashak
2018-03-01 18:45 ` [PATCH 2/5] net sched actions: add new tc_action_ops callback Roman Mashak
2018-03-01 18:45 ` [PATCH 3/5] net sched actions: calculate add/delete event message size Roman Mashak
2018-03-01 18:45 ` [PATCH 4/5] net sched actions: implement get_fill_size routine in act_gact Roman Mashak
2018-03-01 19:03 ` Marcelo Ricardo Leitner
2018-03-02 15:52 ` Roman Mashak [this message]
2018-03-01 18:45 ` [PATCH 5/5] net sched actions: implement get_fill_size routine in act_police Roman Mashak
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=85d10mqxuf.fsf@sevai.TCC.com \
--to=mrv@mojatatu$(echo .)com \
--cc=davem@davemloft$(echo .)net \
--cc=jhs@mojatatu$(echo .)com \
--cc=jiri@resnulli$(echo .)us \
--cc=marcelo.leitner@gmail$(echo .)com \
--cc=netdev@vger$(echo .)kernel.org \
--cc=xiyou.wangcong@gmail$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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