netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Pedro Tammela <pctammela@mojatatu.com>
Cc: netdev@vger.kernel.org, davem@davemloft.net, edumazet@google.com,
	pabeni@redhat.com, jhs@mojatatu.com, xiyou.wangcong@gmail.com,
	jiri@resnulli.us, marcelo.leitner@gmail.com, vladbu@nvidia.com
Subject: Re: [PATCH net-next 3/4] net/sched: act_api: conditional notification of events
Date: Sat, 2 Dec 2023 11:21:04 -0800	[thread overview]
Message-ID: <20231202112104.0ca43022@kernel.org> (raw)
In-Reply-To: <20231201204314.220543-4-pctammela@mojatatu.com>

On Fri,  1 Dec 2023 17:43:13 -0300 Pedro Tammela wrote:
> --- a/net/sched/act_api.c
> +++ b/net/sched/act_api.c
> @@ -1791,6 +1791,13 @@ tcf_reoffload_del_notify(struct net *net, struct tc_action *action)
>  	struct sk_buff *skb;
>  	int ret;
>  
> +	if (!tc_should_notify(net, 0)) {
> +		ret = tcf_idr_release_unsafe(action);
> +		if (ret == ACT_P_DELETED)
> +			module_put(ops->owner);
> +		return ret;
> +	}

I fell like we can do better than this.. let's refactor this code a bit
harder. Maybe factor out the alloc_skb() and fill()? Then add a wrapper
around rtnetlink_send() which does nothing if skb is NULL?

>  	skb = alloc_skb(attr_size <= NLMSG_GOODSIZE ? NLMSG_GOODSIZE : attr_size,
>  			GFP_KERNEL);
>  	if (!skb)

  reply	other threads:[~2023-12-02 19:21 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-01 20:43 [PATCH net-next 0/4] net/sched: conditional notification of events for cls and act Pedro Tammela
2023-12-01 20:43 ` [PATCH net-next 1/4] rtnl: add helper to check if rtnl group has listeners Pedro Tammela
2023-12-01 20:43 ` [PATCH net-next 2/4] net/sched: add helper to check if a notification is needed Pedro Tammela
2023-12-02 19:18   ` Jakub Kicinski
2023-12-04 14:50     ` Pedro Tammela
2023-12-01 20:43 ` [PATCH net-next 3/4] net/sched: act_api: conditional notification of events Pedro Tammela
2023-12-02 19:21   ` Jakub Kicinski [this message]
2023-12-04 14:52     ` Pedro Tammela
2023-12-01 20:43 ` [PATCH net-next 4/4] net/sched: cls_api: " 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=20231202112104.0ca43022@kernel.org \
    --to=kuba@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=jhs@mojatatu.com \
    --cc=jiri@resnulli.us \
    --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;
as well as URLs for NNTP newsgroup(s).