diff options
author | Jiri Pirko <jiri@nvidia.com> | 2023-12-16 13:29:55 +0100 |
---|---|---|
committer | Paolo Abeni <pabeni@redhat.com> | 2023-12-19 15:31:40 +0100 |
commit | cddbff470e3318834af518168d3a917b6e975062 (patch) | |
tree | 2932277f4dfc374f098cf39b24f0b52b89efffbe /net/devlink/linecard.c | |
parent | 11280ddeae238e3ea27d153794472cfca5e8d121 (diff) |
devlink: send notifications only if there are listeners
Introduce devlink_nl_notify_need() helper and using it to check at the
beginning of notification functions to avoid overhead of composing
notification messages in case nobody listens.
Signed-off-by: Jiri Pirko <jiri@nvidia.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Diffstat (limited to 'net/devlink/linecard.c')
-rw-r--r-- | net/devlink/linecard.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/net/devlink/linecard.c b/net/devlink/linecard.c index 9d080ac1734b..45b36975ee6f 100644 --- a/net/devlink/linecard.c +++ b/net/devlink/linecard.c @@ -136,7 +136,7 @@ static void devlink_linecard_notify(struct devlink_linecard *linecard, WARN_ON(cmd != DEVLINK_CMD_LINECARD_NEW && cmd != DEVLINK_CMD_LINECARD_DEL); - if (!__devl_is_registered(devlink)) + if (!__devl_is_registered(devlink) || !devlink_nl_notify_need(devlink)) return; msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); |