1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright (c) 2021 NVIDIA Corporation & Affiliates
6 * This header file must be included only by drivers.
7 * It is considered internal, i.e. hidden for the application.
8 * The prefix rte_ is used to avoid namespace clash in drivers.
11 #ifndef RTE_GPUDEV_DRIVER_H
12 #define RTE_GPUDEV_DRIVER_H
18 #include "rte_gpudev.h"
20 /* Flags indicate current state of device. */
22 RTE_GPU_STATE_UNUSED, /* not initialized */
23 RTE_GPU_STATE_INITIALIZED, /* initialized */
27 typedef int (rte_gpu_close_t)(struct rte_gpu *dev);
28 typedef int (rte_gpu_info_get_t)(struct rte_gpu *dev, struct rte_gpu_info *info);
31 /* Get device info. If NULL, info is just copied. */
32 rte_gpu_info_get_t *dev_info_get;
34 rte_gpu_close_t *dev_close;
39 struct rte_device *device;
40 /* Unique identifier name. */
41 char name[RTE_DEV_NAME_MAX_LEN]; /* Updated by this library. */
42 /* Device info structure. */
43 struct rte_gpu_info info;
44 /* Driver functions. */
45 struct rte_gpu_ops ops;
46 /* Current state (used or not) in the running process. */
47 enum rte_gpu_state state; /* Updated by this library. */
48 /* Driver-specific private data for the running process. */
49 void *process_private;
50 } __rte_cache_aligned;
53 struct rte_gpu *rte_gpu_get_by_name(const char *name);
55 /* First step of initialization */
57 struct rte_gpu *rte_gpu_allocate(const char *name);
59 /* Last step of initialization. */
61 void rte_gpu_complete_new(struct rte_gpu *dev);
63 /* Last step of removal. */
65 int rte_gpu_release(struct rte_gpu *dev);
67 #endif /* RTE_GPUDEV_DRIVER_H */