aboutsummaryrefslogtreecommitdiffstats
path: root/include/rdma
diff options
context:
space:
mode:
authorSteve Wise <swise@opengridcomputing.com>2018-05-03 08:41:30 -0700
committerDoug Ledford <dledford@redhat.com>2018-05-03 15:51:27 -0400
commitda5c8507821573b8ed6e3f47e009f273493ffaf7 (patch)
tree4666b0a2242ebb9deda02fcd6b7eaeacb3b44048 /include/rdma
parentRDMA/nldev: Add explicit pad attribute (diff)
downloadlinux-dev-da5c8507821573b8ed6e3f47e009f273493ffaf7.tar.xz
linux-dev-da5c8507821573b8ed6e3f47e009f273493ffaf7.zip
RDMA/nldev: add driver-specific resource tracking
Each driver can register a "fill entry" function with the restrack core. This function will be called when filling out a resource, allowing the driver to add driver-specific details. The details consist of a nltable of nested attributes, that are in the form of <key, [print-type], value> tuples. Both key and value attributes are mandatory. The key nlattr must be a string, and the value nlattr can be one of the driver attributes that are generic, but typed, allowing the attributes to be validated. Currently the driver nlattr types include string, s32, u32, s64, and u64. The print-type nlattr allows a driver to specify an alternative display format for user tools displaying the attribute. For example, a u32 attribute will default to "%u", but a print-type attribute can be included for it to be displayed in hex. This allows the user tool to print the number in the format desired by the driver driver. More attrs can be defined as they become needed by drivers. Signed-off-by: Steve Wise <swise@opengridcomputing.com> Reviewed-by: Leon Romanovsky <leonro@mellanox.com> Signed-off-by: Doug Ledford <dledford@redhat.com>
Diffstat (limited to 'include/rdma')
-rw-r--r--include/rdma/restrack.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/rdma/restrack.h b/include/rdma/restrack.h
index f3b3e3576f6a..14304e249685 100644
--- a/include/rdma/restrack.h
+++ b/include/rdma/restrack.h
@@ -44,6 +44,8 @@ enum rdma_restrack_type {
};
#define RDMA_RESTRACK_HASH_BITS 8
+struct rdma_restrack_entry;
+
/**
* struct rdma_restrack_root - main resource tracking management
* entity, per-device
@@ -57,6 +59,13 @@ struct rdma_restrack_root {
* @hash: global database for all resources per-device
*/
DECLARE_HASHTABLE(hash, RDMA_RESTRACK_HASH_BITS);
+ /**
+ * @fill_res_entry: driver-specific fill function
+ *
+ * Allows rdma drivers to add their own restrack attributes.
+ */
+ int (*fill_res_entry)(struct sk_buff *msg,
+ struct rdma_restrack_entry *entry);
};
/**