2019-02-18 20:25:47 +00:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
|
|
|
|
/*
|
|
|
|
* Copyright (c) 2017-2019 Mellanox Technologies. All rights reserved.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _RDMA_CORE_RESTRACK_H_
|
|
|
|
#define _RDMA_CORE_RESTRACK_H_
|
|
|
|
|
|
|
|
#include <linux/mutex.h>
|
|
|
|
|
|
|
|
/**
|
|
|
|
* struct rdma_restrack_root - main resource tracking management
|
|
|
|
* entity, per-device
|
|
|
|
*/
|
|
|
|
struct rdma_restrack_root {
|
|
|
|
/**
|
2019-02-18 20:25:48 +00:00
|
|
|
* @xa: Array of XArray structure to hold restrack entries.
|
2019-02-18 20:25:47 +00:00
|
|
|
*/
|
2019-02-18 20:25:48 +00:00
|
|
|
struct xarray xa;
|
2019-02-18 20:25:47 +00:00
|
|
|
/**
|
|
|
|
* @next_id: Next ID to support cyclic allocation
|
|
|
|
*/
|
2019-02-18 20:25:48 +00:00
|
|
|
u32 next_id;
|
2019-02-18 20:25:47 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
int rdma_restrack_init(struct ib_device *dev);
|
|
|
|
void rdma_restrack_clean(struct ib_device *dev);
|
2019-07-02 10:02:32 +00:00
|
|
|
void rdma_restrack_attach_task(struct rdma_restrack_entry *res,
|
|
|
|
struct task_struct *task);
|
2019-07-02 10:02:33 +00:00
|
|
|
bool rdma_is_visible_in_pid_ns(struct rdma_restrack_entry *res);
|
2019-02-18 20:25:47 +00:00
|
|
|
#endif /* _RDMA_CORE_RESTRACK_H_ */
|