[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20231201204314.220543-4-pctammela@mojatatu.com>
Date: Fri, 1 Dec 2023 17:43:13 -0300
From: Pedro Tammela <pctammela@...atatu.com>
To: netdev@...r.kernel.org
Cc: davem@...emloft.net,
edumazet@...gle.com,
kuba@...nel.org,
pabeni@...hat.com,
jhs@...atatu.com,
xiyou.wangcong@...il.com,
jiri@...nulli.us,
marcelo.leitner@...il.com,
vladbu@...dia.com,
Pedro Tammela <pctammela@...atatu.com>
Subject: [PATCH net-next 3/4] net/sched: act_api: conditional notification of events
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@...atatu.com>
---
net/sched/act_api.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/net/sched/act_api.c b/net/sched/act_api.c
index c39252d61ebb..2570f9702eeb 100644
--- 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;
+ }
+
skb = alloc_skb(attr_size <= NLMSG_GOODSIZE ? NLMSG_GOODSIZE : attr_size,
GFP_KERNEL);
if (!skb)
@@ -1877,6 +1884,13 @@ tcf_del_notify(struct net *net, struct nlmsghdr *n, struct tc_action *actions[],
int ret;
struct sk_buff *skb;
+ if (!tc_should_notify(net, n->nlmsg_flags)) {
+ ret = tcf_action_delete(net, actions);
+ if (ret < 0)
+ NL_SET_ERR_MSG(extack, "Failed to delete TC action");
+ return ret;
+ }
+
skb = alloc_skb(attr_size <= NLMSG_GOODSIZE ? NLMSG_GOODSIZE : attr_size,
GFP_KERNEL);
if (!skb)
@@ -1956,6 +1970,9 @@ tcf_add_notify(struct net *net, struct nlmsghdr *n, struct tc_action *actions[],
{
struct sk_buff *skb;
+ if (!tc_should_notify(net, n->nlmsg_flags))
+ return 0;
+
skb = alloc_skb(attr_size <= NLMSG_GOODSIZE ? NLMSG_GOODSIZE : attr_size,
GFP_KERNEL);
if (!skb)
--
2.40.1
Powered by blists - more mailing lists