public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Jiri Pirko <jiri@resnulli.us>
To: Pedro Tammela <pctammela@mojatatu.com>
Cc: netdev@vger.kernel.org, davem@davemloft.net, edumazet@google.com,
	kuba@kernel.org, pabeni@redhat.com, jhs@mojatatu.com,
	xiyou.wangcong@gmail.com, marcelo.leitner@gmail.com,
	vladbu@nvidia.com
Subject: Re: [PATCH net-next v2 4/5] net/sched: act_api: conditional notification of events
Date: Wed, 6 Dec 2023 08:53:52 +0100	[thread overview]
Message-ID: <ZXAokByEQY//QqXm@nanopsycho> (raw)
In-Reply-To: <6a70805b-953d-494e-a9b9-a2cb0e0aff18@mojatatu.com>

Tue, Dec 05, 2023 at 03:45:52PM CET, pctammela@mojatatu.com wrote:
>On 05/12/2023 08:32, Jiri Pirko wrote:
>> Mon, Dec 04, 2023 at 09:39:06PM CET, pctammela@mojatatu.com wrote:
>> > As of today tc-action events are unconditionally built and sent to
>> > RTNLGRP_TC. As with the introduction of tc_should_notify we can check
>> > before-hand if they are really needed.
>> > 
>> > Signed-off-by: Pedro Tammela <pctammela@mojatatu.com>
>> > ---
>> > net/sched/act_api.c | 105 ++++++++++++++++++++++++++++++++------------
>> > 1 file changed, 76 insertions(+), 29 deletions(-)
>> > 
>> > diff --git a/net/sched/act_api.c b/net/sched/act_api.c
>> > index c39252d61ebb..55c62a8e8803 100644
>> > --- a/net/sched/act_api.c
>> > +++ b/net/sched/act_api.c
>> > @@ -1780,31 +1780,45 @@ static int tcf_action_delete(struct net *net, struct tc_action *actions[])
>> > 	return 0;
>> > }
>> > 
>> > -static int
>> > -tcf_reoffload_del_notify(struct net *net, struct tc_action *action)
>> > +static struct sk_buff *tcf_reoffload_del_notify_msg(struct net *net,
>> 
>> I wonder, why this new function is needed? If I'm reading things
>> correctly, tcf_reoffload_del_notify() with added check would be just ok,
>> woundn't it?
>> 
>> Same for others.
>
>In V1 we had it like what you are suggesting[1].
>Jakub suggested to refactor the functions a bit more. The main argument was
>the code duplication introduced for the delete routines.

Okay.

>Note that for the case that no notification is needed, we still need to do
>the action delete etc...
>I agree that code duplication is bad in the long term, so I did the changes,
>but I don't have a strong opinion here (either way is fine for me).
>Let's see what he has to say, perhaps I overdid what he was suggesting :)
>
>[1]
>https://lore.kernel.org/all/20231201204314.220543-4-pctammela@mojatatu.com/
>
>> 
>> > +						    struct tc_action *action)
>> > {
>> > 	size_t attr_size = tcf_action_fill_size(action);
>> > 	struct tc_action *actions[TCA_ACT_MAX_PRIO] = {
>> > 		[0] = action,
>> > 	};
>> > -	const struct tc_action_ops *ops = action->ops;
>> > 	struct sk_buff *skb;
>> > -	int ret;
>> > 
>> > -	skb = alloc_skb(attr_size <= NLMSG_GOODSIZE ? NLMSG_GOODSIZE : attr_size,
>> > -			GFP_KERNEL);
>> > +	skb = alloc_skb(max(attr_size, NLMSG_GOODSIZE), GFP_KERNEL);
>> 
>> I don't see how this is related to this patch. Can't you do it in separate
>> patch?
>> 
>> Same for others.
>
>Sure, will split it out.
>
>> 
>> > 	if (!skb)
>> > -		return -ENOBUFS;
>> > +		return ERR_PTR(-ENOBUFS);
>> > 
>> > 	if (tca_get_fill(skb, actions, 0, 0, 0, RTM_DELACTION, 0, 1, NULL) <= 0) {
>> > 		kfree_skb(skb);
>> > -		return -EINVAL;
>> > +		return ERR_PTR(-EINVAL);
>> > 	}
>> > 
>> > +	return skb;
>> > +}
>> > +
>> 
>> [...]
>

  reply	other threads:[~2023-12-06  7:53 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-04 20:39 [PATCH net-next v2 0/5] net/sched: conditional notification of events for cls and act Pedro Tammela
2023-12-04 20:39 ` [PATCH net-next v2 1/5] rtnl: add helper to check if rtnl group has listeners Pedro Tammela
2023-12-05 11:50   ` Jiri Pirko
2023-12-04 20:39 ` [PATCH net-next v2 2/5] rtnl: add helper to check if a notification is needed Pedro Tammela
2023-12-05 11:50   ` Jiri Pirko
2023-12-04 20:39 ` [PATCH net-next v2 3/5] rtnl: add helper to send if skb is not null Pedro Tammela
2023-12-05 11:50   ` Jiri Pirko
2023-12-04 20:39 ` [PATCH net-next v2 4/5] net/sched: act_api: conditional notification of events Pedro Tammela
2023-12-05 11:32   ` Jiri Pirko
2023-12-05 14:45     ` Pedro Tammela
2023-12-06  7:53       ` Jiri Pirko [this message]
2023-12-04 20:39 ` [PATCH net-next v2 5/5] net/sched: cls_api: " Pedro Tammela
2023-12-05 11:51   ` Jiri Pirko
2023-12-05 14:49 ` [PATCH net-next v2 0/5] net/sched: conditional notification of events for cls and act Pedro Tammela

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=ZXAokByEQY//QqXm@nanopsycho \
    --to=jiri@resnulli.us \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=jhs@mojatatu.com \
    --cc=kuba@kernel.org \
    --cc=marcelo.leitner@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pctammela@mojatatu.com \
    --cc=vladbu@nvidia.com \
    --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