diff options
author | Jiri Pirko <jiri@nvidia.com> | 2023-12-16 15:29:55 +0300 |
---|---|---|
committer | Paolo Abeni <pabeni@redhat.com> | 2023-12-19 17:31:40 +0300 |
commit | cddbff470e3318834af518168d3a917b6e975062 (patch) | |
tree | 2932277f4dfc374f098cf39b24f0b52b89efffbe /net/devlink/param.c | |
parent | 11280ddeae238e3ea27d153794472cfca5e8d121 (diff) | |
download | linux-cddbff470e3318834af518168d3a917b6e975062.tar.xz |
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/param.c')
-rw-r--r-- | net/devlink/param.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/net/devlink/param.c b/net/devlink/param.c index d74df09311a9..7516b524ffb7 100644 --- a/net/devlink/param.c +++ b/net/devlink/param.c @@ -343,7 +343,7 @@ static void devlink_param_notify(struct devlink *devlink, * will replay the notifications if the params are added/removed * outside of the lifetime of the instance. */ - if (!devl_is_registered(devlink)) + if (!devl_is_registered(devlink) || !devlink_nl_notify_need(devlink)) return; msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); |