diff options
| author | Cosmin Ratiu <cratiu@nvidia.com> | 2026-07-01 10:32:47 +0300 |
|---|---|---|
| committer | Paolo Abeni <pabeni@redhat.com> | 2026-07-07 11:31:26 +0200 |
| commit | 6bbd1bce3099eec42cb3e90099f5f9910c0dc84f (patch) | |
| tree | d4f9817091d7e81bef4096171acdbca73bb0e42e /include | |
| parent | 58132b6fc4a58441d2b99c65a3548f6875cd52d0 (diff) | |
| download | linux-6bbd1bce3099eec42cb3e90099f5f9910c0dc84f.tar.gz linux-6bbd1bce3099eec42cb3e90099f5f9910c0dc84f.zip | |
devlink: Allow rate node parents from other devlinks
This commit makes use of the building blocks previously added to
implement cross-device rate nodes.
A new 'supported_cross_device_rate_nodes' bool is added to devlink_ops
which lets drivers advertise support for cross-device rate objects.
If enabled and if there is a common shared devlink instance, then:
- all rate objects will be stored in the top-most common nested instance
and
- rate objects can have parents from other devices sharing the same
common instance.
Storing rates in the common shared ancestor is safe, because it is
reference counted by its nested devlink instances, so it's guaranteed to
outlive them. Furthermore, the shared devlink infra guarantees a given
nested devlink hierarchy is managed by the same driver.
The parent devlink from info->ctx is not locked, so none of its mutable
fields can be used. But parent setting only requires comparing devlink
pointer comparisons. Additionally, since the shared devlink is locked,
other rate operations cannot concurrently happen.
Signed-off-by: Cosmin Ratiu <cratiu@nvidia.com>
Reviewed-by: Carolina Jubran <cjubran@nvidia.com>
Reviewed-by: Jiri Pirko <jiri@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
Link: https://patch.msgid.link/20260701073254.754518-8-tariqt@nvidia.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Diffstat (limited to 'include')
| -rw-r--r-- | include/net/devlink.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/include/net/devlink.h b/include/net/devlink.h index dd546dbd57cf..ffe1ad5fb70b 100644 --- a/include/net/devlink.h +++ b/include/net/devlink.h @@ -1594,6 +1594,15 @@ struct devlink_ops { struct devlink_rate *parent, void *priv_child, void *priv_parent, struct netlink_ext_ack *extack); + /* Indicates if cross-device rate nodes are supported. + * This also requires a shared common ancestor object all devices that + * could share rate nodes are nested in. + * If enabled, rate operations may be called on an instance with only + * the common ancestor lock held and *without that instance lock held*. + * It is the driver's responsibility to ensure proper serialization + * with other operations. + */ + bool supported_cross_device_rate_nodes; /** * selftests_check() - queries if selftest is supported * @devlink: devlink instance |
