mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 11:41:38 -04:00
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 <[email protected]> Reviewed-by: Leon Romanovsky <[email protected]> Signed-off-by: Doug Ledford <[email protected]>
This commit is contained in:
parent
25a0ad8515
commit
da5c850782
4 changed files with 68 additions and 0 deletions
|
|
@ -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);
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in a new issue