include/rdma/restrack.h
Source file repositories/reference/linux-study-clean/include/rdma/restrack.h
File Facts
- System
- Linux kernel
- Corpus path
include/rdma/restrack.h- Extension
.h- Size
- 4520 bytes
- Lines
- 184
- Domain
- Repository Root And Misc
- Bucket
- include
- Inferred role
- Repository Root And Misc: implementation source
- Status
- source implementation candidate
Why This File Exists
Top-level or miscellaneous repository surface. Use this as map coverage unless a later manual pass promotes the file into a deeper subsystem dossier.
- Top-level or miscellaneous repository surface. Use this as map coverage unless a later manual pass promotes the file into a deeper subsystem dossier.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/typecheck.hlinux/sched.hlinux/kref.hlinux/completion.hlinux/sched/task.huapi/rdma/rdma_netlink.hlinux/xarray.h
Detected Declarations
struct ib_devicestruct sk_buffstruct rdma_restrack_entryenum rdma_restrack_typefunction rdma_is_kernel_resfunction rdma_restrack_no_trackfunction rdma_restrack_is_tracked
Annotated Snippet
struct rdma_restrack_entry {
/**
* @valid: validity indicator
*
* The entries are filled during rdma_restrack_add,
* can be attempted to be free during rdma_restrack_del.
*
* As an example for that, see mlx5 QPs with type MLX5_IB_QPT_HW_GSI
*/
bool valid;
/**
* @no_track: don't add this entry to restrack DB
*
* This field is used to mark an entry that doesn't need to be added to
* internal restrack DB and presented later to the users at the nldev
* query stage.
*/
u8 no_track : 1;
/**
* @kref: Protect destroy of the resource
*/
struct kref kref;
/**
* @comp: Signal that all consumers of resource are completed their work
*/
struct completion comp;
/**
* @task: owner of resource tracking entity
*
* There are two types of entities: created by user and created
* by kernel.
*
* This is relevant for the entities created by users.
* For the entities created by kernel, this pointer will be NULL.
*/
struct task_struct *task;
/**
* @kern_name: name of owner for the kernel created entities.
*/
const char *kern_name;
/**
* @type: various objects in restrack database
*/
enum rdma_restrack_type type;
/**
* @user: user resource
*/
bool user;
/**
* @id: ID to expose to users
*/
u32 id;
};
int rdma_restrack_count(struct ib_device *dev, enum rdma_restrack_type type,
bool show_details);
/**
* rdma_is_kernel_res() - check the owner of resource
* @res: resource entry
*/
static inline bool rdma_is_kernel_res(const struct rdma_restrack_entry *res)
{
return !res->user;
}
/**
* rdma_restrack_get() - grab to protect resource from release
* @res: resource entry
*/
int __must_check rdma_restrack_get(struct rdma_restrack_entry *res);
/**
* rdma_restrack_put() - release resource
* @res: resource entry
*/
int rdma_restrack_put(struct rdma_restrack_entry *res);
/*
* Helper functions for rdma drivers when filling out
* nldev driver attributes.
*/
int rdma_nl_put_driver_u32(struct sk_buff *msg, const char *name, u32 value);
int rdma_nl_put_driver_u32_hex(struct sk_buff *msg, const char *name,
u32 value);
int rdma_nl_put_driver_u64(struct sk_buff *msg, const char *name, u64 value);
int rdma_nl_put_driver_u64_hex(struct sk_buff *msg, const char *name,
u64 value);
int rdma_nl_put_driver_string(struct sk_buff *msg, const char *name,
const char *str);
int rdma_nl_stat_hwcounter_entry(struct sk_buff *msg, const char *name,
Annotation
- Immediate include surface: `linux/typecheck.h`, `linux/sched.h`, `linux/kref.h`, `linux/completion.h`, `linux/sched/task.h`, `uapi/rdma/rdma_netlink.h`, `linux/xarray.h`.
- Detected declarations: `struct ib_device`, `struct sk_buff`, `struct rdma_restrack_entry`, `enum rdma_restrack_type`, `function rdma_is_kernel_res`, `function rdma_restrack_no_track`, `function rdma_restrack_is_tracked`.
- Atlas domain: Repository Root And Misc / include.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.