1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2018 Intel Corporation
11 * Device specific vhost lib
15 #include "rte_vhost.h"
17 #define MAX_VDPA_NAME_LEN 128
24 struct rte_vdpa_dev_addr {
25 enum vdpa_addr_type type;
28 struct rte_pci_addr pci_addr;
32 struct rte_vdpa_dev_ops {
33 /* Get capabilities of this device */
34 int (*get_queue_num)(int did, uint32_t *queue_num);
35 int (*get_features)(int did, uint64_t *features);
36 int (*get_protocol_features)(int did, uint64_t *protocol_features);
38 /* Driver configure/close the device */
39 int (*dev_conf)(int vid);
40 int (*dev_close)(int vid);
42 /* Enable/disable this vring */
43 int (*set_vring_state)(int vid, int vring, int state);
45 /* Set features when changed */
46 int (*set_features)(int vid);
48 /* Destination operations when migration done */
49 int (*migration_done)(int vid);
51 /* Get the vfio group fd */
52 int (*get_vfio_group_fd)(int vid);
54 /* Get the vfio device fd */
55 int (*get_vfio_device_fd)(int vid);
57 /* Get the notify area info of the queue */
58 int (*get_notify_area)(int vid, int qid,
59 uint64_t *offset, uint64_t *size);
61 /* Reserved for future extension */
65 struct rte_vdpa_device {
66 struct rte_vdpa_dev_addr addr;
67 struct rte_vdpa_dev_ops *ops;
68 } __rte_cache_aligned;
70 /* Register a vdpa device, return did if successful, -1 on failure */
71 int __rte_experimental
72 rte_vdpa_register_device(struct rte_vdpa_dev_addr *addr,
73 struct rte_vdpa_dev_ops *ops);
75 /* Unregister a vdpa device, return -1 on failure */
76 int __rte_experimental
77 rte_vdpa_unregister_device(int did);
79 /* Find did of a vdpa device, return -1 on failure */
80 int __rte_experimental
81 rte_vdpa_find_device_id(struct rte_vdpa_dev_addr *addr);
83 /* Find a vdpa device based on did */
84 struct rte_vdpa_device * __rte_experimental
85 rte_vdpa_get_device(int did);
87 #endif /* _RTE_VDPA_H_ */