[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20231201204314.220543-3-pctammela@mojatatu.com>
Date: Fri, 1 Dec 2023 17:43:12 -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,
Victor Nogueira <victor@...atatu.com>,
Pedro Tammela <pctammela@...atatu.com>
Subject: [PATCH net-next 2/4] net/sched: add helper to check if a notification is needed
From: Victor Nogueira <victor@...atatu.com>
Building on the rtnl_has_listeners helper, add the tc_should_notify
helper to check if we can bail out early in the tc notification
routines.
Signed-off-by: Victor Nogueira <victor@...atatu.com>
Signed-off-by: Pedro Tammela <pctammela@...atatu.com>
---
include/net/pkt_cls.h | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/include/net/pkt_cls.h b/include/net/pkt_cls.h
index a76c9171db0e..39c24cf30984 100644
--- a/include/net/pkt_cls.h
+++ b/include/net/pkt_cls.h
@@ -1065,4 +1065,9 @@ static inline void tc_skb_ext_tc_disable(void) { }
#define tc_skb_ext_tc_enabled() false
#endif
+static inline bool tc_should_notify(const struct net *net, u16 nlflags)
+{
+ return (nlflags & NLM_F_ECHO) || rtnl_has_listeners(net, RTNLGRP_TC);
+}
+
#endif
--
2.40.1
Powered by blists - more mailing lists